On Tue, 26 Mar 2019 at 15:42, Dridi Boukelmoune <dridi.boukelmoune@gmail.com> wrote:
[..]
> Japheth Cleaver explained why in response to me a couple of days ago:
> apparently changing it would also change the shell used for some
> scriptlets...

He also posted this link:
http://web.archive.org/web/20150821020837/http://rpm.org/ticket/877

Just FTR: Fedora macros are already polluted by bashisms;

$ rpm --showrc | egrep -e "popd|pushd"
pushd %{buildsubdir} 
popd 
$ egrep -e "popd|pushd" /usr/lib/rpm/macros.d/*
/usr/lib/rpm/macros.d/macros.perl:pushd %{buildsubdir} \
/usr/lib/rpm/macros.d/macros.perl:popd \

So here it is whole macro which is using pushd/popd:

%__perl_check_pre %{expand: \
%{?__spec_check_pre} \
pushd %{buildsubdir} \
%define perl_br_testdir %{buildroot}%{perl_testdir}/%{cpan_dist_name} \
%{__mkdir_p} %{perl_br_testdir} \
%{__tar} -cf - %{__perl_test_dirs} | ( cd %{perl_br_testdir} && %{__tar} -xf - ) \
find . -maxdepth 1 -type f -name '*META*' -exec %{__cp} -vp {} %{perl_br_testdir} ';' \
find %{perl_br_testdir} -type f -exec %{__chmod} -c -x {} ';' \
T_FILES=`find %{perl_br_testdir} -type f -name '*.t'` \
%fix_shbang_line $T_FILES \
%{__chmod} +x $T_FILES \
%{_fixperms} %{perl_br_testdir} \
popd \
}

and:
%perl_testdir   %{_libexecdir}/perl5-tests

That %check_pre extension looks like it is about archiving some post %build files (what???).
Just checked:

[tkloczko@domek SPECS.fedora]$ grep perl5-tests *
perl.spec:%global perl5_testdir   %{_libexecdir}/perl5-tests

I could be wrong so please correct me if I'm wrong.
Looks like someone to add something in single perl package build process one additional macro has been added to global rpm macros.
If above is correct IMO collecting such files  (it those files are really needed and used) should be done outside of the scope of regular "rpmbuild -ba".
Collecting and preserving some build logs always should be part of the build automation.

Conclusion: whole macro should be removed and there is nothing to fix about fixing some bashisms here.
If that macro is needed in perl build process it should be moved to the perl.spec (I would even verify that part carefully as well).
It would be good if someone else as well will carefully review whole content of the macros.perl. I would be not surprised it that file contains more such <things>.

That is result of abandoning strict controlling macros used during rpm build process.
I've been telling here something like +2y ago that spreading macros across many packages will blow up.

Nevertheless .. cuts_counter--

kloczek
-- 
Tomasz Kłoczko | LinkedIn: http://lnkd.in/FXPWxH