stdenv/patchShebangs: fix shebang check
patchShebangs has a bug that shows itself on files that have the executable bit set but have no shebang (i.e. a blank/empty first line). The shell would then evaluate this: if [ != '#!' ]; then # not evaluated fi With proper quoting we get the correct behaviour: if [ "" != '#!' ]; then # this will be evaluated fi
This commit is contained in:
parent
c32bf83301
commit
4e385fcda7
@ -669,7 +669,7 @@ patchShebangs() {
|
|||||||
local newInterpreterLine
|
local newInterpreterLine
|
||||||
|
|
||||||
for f in $(find "$dir" -type f -perm +0100); do
|
for f in $(find "$dir" -type f -perm +0100); do
|
||||||
if [ $(head -1 "$f" | head -c +2) != '#!' ]; then
|
if [ "$(head -1 "$f" | head -c +2)" != '#!' ]; then
|
||||||
# missing shebang => not a script
|
# missing shebang => not a script
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user