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