about summary refs log tree commit diff
path: root/pkgs/test/stdenv
diff options
context:
space:
mode:
authorRick van Schijndel <Mindavi@users.noreply.github.com>2024-02-16 18:33:27 +0100
committerGitHub <noreply@github.com>2024-02-16 18:33:27 +0100
commitb728d76d0e52eb7647c51ff9b23c94c353163091 (patch)
tree3bac8a55fb1c0c5ce2976b9e394540e32242ec79 /pkgs/test/stdenv
parent98c3051984d6f86ec28186fb9e194f9986858c1b (diff)
parentc47f2452530b9cdb58de578f1c44c37e8aa616f0 (diff)
Merge pull request #255463 from emilylange/stdenv/patch-shebangs-trailing-newline
patch-shebangs: fix crash with shebang without trailing newline
Diffstat (limited to 'pkgs/test/stdenv')
-rw-r--r--pkgs/test/stdenv/patch-shebangs.nix17
1 files changed, 16 insertions, 1 deletions
diff --git a/pkgs/test/stdenv/patch-shebangs.nix b/pkgs/test/stdenv/patch-shebangs.nix
index 888d4a53a2733..db9ca2fcaafef 100644
--- a/pkgs/test/stdenv/patch-shebangs.nix
+++ b/pkgs/test/stdenv/patch-shebangs.nix
@@ -72,11 +72,26 @@ let
       };
     };
 
+    without-trailing-newline = stdenv.mkDerivation {
+      name = "without-trailing-newline";
+      strictDeps = false;
+      dontUnpack = true;
+      installPhase = ''
+        mkdir -p $out/bin
+        printf "#!/bin/bash" > $out/bin/test
+        chmod +x $out/bin/test
+        dontPatchShebangs=
+      '';
+      passthru = {
+        assertion = "grep '^#!${stdenv.shell}' $out/bin/test > /dev/null";
+      };
+    };
+
   };
 in
 stdenv.mkDerivation {
   name = "test-patch-shebangs";
-  passthru = { inherit (tests) bad-shebang ignores-nix-store updates-nix-store split-string; };
+  passthru = { inherit (tests) bad-shebang ignores-nix-store updates-nix-store split-string without-trailing-newline; };
   buildCommand = ''
     validate() {
       local name=$1