diff options
author | Will Dietz <w@wdtz.org> | 2018-09-27 17:40:16 -0500 |
---|---|---|
committer | Will Dietz <w@wdtz.org> | 2018-09-28 11:15:36 -0500 |
commit | 830f9fabd4a564bfbc3fbfc33a62b02010c0a7a5 (patch) | |
tree | 4e5d24afd828fa584e9d69bcda570426f357b180 /pkgs/build-support/setup-hooks | |
parent | f66ae2c8b20fd00853246cfd0a32fea0a7e06814 (diff) | |
download | nixlib-830f9fabd4a564bfbc3fbfc33a62b02010c0a7a5.tar nixlib-830f9fabd4a564bfbc3fbfc33a62b02010c0a7a5.tar.gz nixlib-830f9fabd4a564bfbc3fbfc33a62b02010c0a7a5.tar.bz2 nixlib-830f9fabd4a564bfbc3fbfc33a62b02010c0a7a5.tar.lz nixlib-830f9fabd4a564bfbc3fbfc33a62b02010c0a7a5.tar.xz nixlib-830f9fabd4a564bfbc3fbfc33a62b02010c0a7a5.tar.zst nixlib-830f9fabd4a564bfbc3fbfc33a62b02010c0a7a5.zip |
patch-shebangs: use isScript to safely check for shebang start
Fixes commonly encountered errors about broken pipes or null-bytes in command-substitution.
Diffstat (limited to 'pkgs/build-support/setup-hooks')
-rw-r--r-- | pkgs/build-support/setup-hooks/patch-shebangs.sh | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/pkgs/build-support/setup-hooks/patch-shebangs.sh b/pkgs/build-support/setup-hooks/patch-shebangs.sh index d5586fccae67..0ac81102658b 100644 --- a/pkgs/build-support/setup-hooks/patch-shebangs.sh +++ b/pkgs/build-support/setup-hooks/patch-shebangs.sh @@ -19,9 +19,8 @@ patchShebangs() { local newInterpreterLine find "$dir" -type f -perm -0100 | while read f; do - if [ "$(head -1 "$f" | head -c+2)" != '#!' ]; then - # missing shebang => not a script - continue + if ! isScript "$f"; then + continue fi oldInterpreterLine=$(head -1 "$f" | tail -c+3) |