aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbrp-mangle-shebangs9
1 files changed, 8 insertions, 1 deletions
diff --git a/brp-mangle-shebangs b/brp-mangle-shebangs
index 4964c09..ef85ee4 100755
--- a/brp-mangle-shebangs
+++ b/brp-mangle-shebangs
@@ -93,7 +93,14 @@ while IFS= read -r line; do
fi
- read shebang_line < "$f" ||:
+ if ! read shebang_line < "$f"; then
+ echo >&2 "*** WARNING: Cannot read the first line from $f, removing executable bit"
+ ts=$(stat -c %y "$f")
+ chmod -x "$f"
+ touch -d "$ts" "$f"
+ continue
+ fi
+
orig_shebang="${shebang_line#\#!}"
if [ "$orig_shebang" = "$shebang_line" ]; then
echo >&2 "*** WARNING: $f is executable but has no shebang, removing executable bit"