From 54740d830b4737f4fb6350abd4b8d8d321bfa4a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Covarrubias?= Date: Fri, 12 Dec 2025 17:48:18 -0300 Subject: [PATCH] test: add shebangs to shell.nix test scripts Fix intermittent SIGSEGV (exit code 139) on macOS when running nix-shell and shebang tests inside the nix sandbox. The foo, bar, and ruby test scripts were created without shebangs, which causes intermittent crashes when executed via command substitution on macOS. Adding proper shebangs resolves the flakiness. Potentially closes: #13106 (cherry picked from commit 7b3d7eb6343f33a14a9ec55be909f806ff6c49ab) --- tests/functional/shell.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/functional/shell.nix b/tests/functional/shell.nix index 5e9f4881819..fb10ebc1d5c 100644 --- a/tests/functional/shell.nix +++ b/tests/functional/shell.nix @@ -96,14 +96,16 @@ let 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 ''; @@ -116,7 +118,8 @@ let # 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 '';