Merge pull request #47446 from dtzWill/fix/patch-shebangs-head-error-writing-broken-pipe
patch-shebangs: use isScript to safely check for shebang start
This commit is contained in:
commit
14fee84429
@ -18,11 +18,11 @@ patchShebangs() {
|
|||||||
local oldInterpreterLine
|
local oldInterpreterLine
|
||||||
local newInterpreterLine
|
local newInterpreterLine
|
||||||
|
|
||||||
find "$dir" -type f -perm -0100 | while read f; do
|
[ -e "$dir" ] || return 0
|
||||||
if [ "$(head -1 "$f" | head -c+2)" != '#!' ]; then
|
|
||||||
# missing shebang => not a script
|
local f
|
||||||
continue
|
while IFS= read -r -d $'\0' f; do
|
||||||
fi
|
isScript "$f" || continue
|
||||||
|
|
||||||
oldInterpreterLine=$(head -1 "$f" | tail -c+3)
|
oldInterpreterLine=$(head -1 "$f" | tail -c+3)
|
||||||
read -r oldPath arg0 args <<< "$oldInterpreterLine"
|
read -r oldPath arg0 args <<< "$oldInterpreterLine"
|
||||||
@ -61,7 +61,7 @@ patchShebangs() {
|
|||||||
rm "$f.timestamp"
|
rm "$f.timestamp"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done < <(find "$dir" -type f -perm -0100 -print0)
|
||||||
|
|
||||||
stopNest
|
stopNest
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user