git: ensure we are using the correct shell binary for tests

Previosuly the test scripts used /bin/sh which is a bit of an impurity.
It is mostly well-behaved but it essentially leaks the hosts state into
the build as /bin/sh points to some minimal shell implementation
configured on the host OS.

By patching the shebgangs of all the test scripts in the test folder
(t/*.sh) we can make sure that those run with the correct shell binary.

This was found as part of a random build failure of gitMinimal in
response to the systemd v249 PR being merged [0]. Since we have to
somehow touch the hash of the derivation to make the build failure go
away we might as well fix the hardcoded /bin/sh issue.

[0] 64556974b6 (commitcomment-56385360)
This commit is contained in:
Andreas Rammhold 2021-09-13 19:58:06 +02:00
parent f38791f082
commit a683d78ed0

View file

@ -65,6 +65,9 @@ stdenv.mkDerivation {
# Fix references to gettext introduced by ./git-sh-i18n.patch
substituteInPlace git-sh-i18n.sh \
--subst-var-by gettext ${gettext}
# ensure we are using the correct shell when executing the test scripts
patchShebangs t/*.sh
'';
nativeBuildInputs = [ gettext perlPackages.perl makeWrapper ]