diff options
author | Cireo <reid.price@gmail.com> | 2016-07-07 13:35:08 -0700 |
---|---|---|
committer | Nikolay Amiantov <ab@fmap.me> | 2016-07-09 03:00:27 +0300 |
commit | ff3e7d2b4bebca772d22c7d75bc91204c0cf6316 (patch) | |
tree | bb0d1a2a9f4e79eb54595f1e8cc4b31c2317b9d3 /pkgs/build-support/setup-hooks/patch-shebangs.sh | |
parent | 8b92103ae8de028374b13203f1c9c3e87810246c (diff) | |
download | nixpkgs-ff3e7d2b4bebca772d22c7d75bc91204c0cf6316.tar nixpkgs-ff3e7d2b4bebca772d22c7d75bc91204c0cf6316.tar.gz nixpkgs-ff3e7d2b4bebca772d22c7d75bc91204c0cf6316.tar.bz2 nixpkgs-ff3e7d2b4bebca772d22c7d75bc91204c0cf6316.tar.lz nixpkgs-ff3e7d2b4bebca772d22c7d75bc91204c0cf6316.tar.xz nixpkgs-ff3e7d2b4bebca772d22c7d75bc91204c0cf6316.tar.zst nixpkgs-ff3e7d2b4bebca772d22c7d75bc91204c0cf6316.zip |
patchShebangs: strip trailing whitespace
Prior to this commit, trailing whitespace would be introduced when modifying '#!' lines with no arguments. For example (whitespace added): /nix/store/.../foo: interpreter directive changed from "/bin/bash" to "/nix/store/...-bash-4.3-p42/bin/bash " /nix/store/.../bar: interpreter directive changed from "/bin/baz wef" to "/nix/store/...-baz wef " We add a sed command to strip trailing whitespace, so the above commands would drop the two spaces after "bash", or the one space after "baz wef". abbradar: fixed commit title Closes #16785.
Diffstat (limited to 'pkgs/build-support/setup-hooks/patch-shebangs.sh')
-rw-r--r-- | pkgs/build-support/setup-hooks/patch-shebangs.sh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pkgs/build-support/setup-hooks/patch-shebangs.sh b/pkgs/build-support/setup-hooks/patch-shebangs.sh index 38660718d0e..f3ecfdd96e8 100644 --- a/pkgs/build-support/setup-hooks/patch-shebangs.sh +++ b/pkgs/build-support/setup-hooks/patch-shebangs.sh @@ -46,7 +46,8 @@ patchShebangs() { args="$arg0 $args" fi - newInterpreterLine="$newPath $args" + # Strip trailing whitespace introduced when no arguments are present + newInterpreterLine=$(echo "$newPath $args" | sed 's/[[:space:]]*$//') if [ -n "$oldPath" -a "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ]; then if [ -n "$newPath" -a "$newPath" != "$oldPath" ]; then |