Finally exorcise Darwin Demons causing flakey functional tests

macos-builder02 in particular has been having problems for a while now
that no one could reproduce. We believe we have finally found the cause:
missing shebangs, not just in the tests themselves but *also* in the
inline scripts `nix-shell` itself writes.

Fixes #1042.
I believe this will also fix #1093.

See also: https://github.com/NixOS/nix/pull/14778

Change-Id: I54d04a770b8e78484815db88a8bc88776a6a6964
This commit is contained in:
Qyriad
2026-01-09 12:28:19 +01:00
parent 0800b1588e
commit 68a72d2bdf
3 changed files with 10 additions and 4 deletions
+3 -1
View File
@@ -503,11 +503,13 @@ static int main_nix_build(AsyncIoRoot & aio, std::string programName, Strings ar
auto rcfile = (Path) tmpDir + "/rc";
auto tz = getEnv("TZ");
std::string rc =
fmt("%1%"
fmt("#!%1%\n"
"%2%"
// always clear PATH.
// when nix-shell is run impure, we rehydrate it with the `p=$PATH` above
"unset PATH;"
"dontAddDisableDepTrack=1;\n",
*shell,
(pure ? "" : "[ -n \"$PS1\" ] && [ -e ~/.bashrc ] && source ~/.bashrc; p=$PATH; "));
rc += structuredAttrsRC;
rc += fmt(
+6 -3
View File
@@ -63,14 +63,16 @@ let pkgs = rec {
foo = runCommand "foo" {} ''
mkdir -p $out/bin
echo 'echo ${fooContents}' > $out/bin/foo
echo '#!${shell}' >> $out/bin/foo
echo 'echo ${fooContents}' >> $out/bin/foo
chmod a+rx $out/bin/foo
ln -s ${shell} $out/bin/bash
'';
bar = runCommand "bar" {} ''
mkdir -p $out/bin
echo 'echo bar' > $out/bin/bar
echo '#!${shell}' > $out/bin/bar
echo 'echo bar' >> $out/bin/bar
chmod a+rx $out/bin/bar
'';
@@ -83,7 +85,8 @@ let pkgs = rec {
# ruby "interpreter" that outputs "$@"
ruby = runCommand "ruby" {} ''
mkdir -p $out/bin
echo 'printf %s "$*"' > $out/bin/ruby
echo '#!${shell}' > $out/bin/ruby
echo 'printf %s "$*"' >> $out/bin/ruby
chmod a+rx $out/bin/ruby
'';
+1
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
mkdir $out
mkdir $out/bin
echo "#! $shell" > $out/bin/$progName