aboutsummaryrefslogtreecommitdiffstats
path: root/brp-mangle-shebangs
diff options
context:
space:
mode:
authorMiro Hrončok <miro@hroncok.cz>2024-02-20 10:16:21 +0100
committerJani Välimaa <wally@mageia.org>2024-03-24 07:08:54 +0200
commit781fe30e10dc538373153163c708d88bc62258cc (patch)
tree153a5c9010f4e67625509bf35f95926990dfdf2e /brp-mangle-shebangs
parent0d3b9a9ee8d0f7b3230ab9f6b5acf8800a7d6bae (diff)
downloadrpm-setup-781fe30e10dc538373153163c708d88bc62258cc.tar
rpm-setup-781fe30e10dc538373153163c708d88bc62258cc.tar.gz
rpm-setup-781fe30e10dc538373153163c708d88bc62258cc.tar.bz2
rpm-setup-781fe30e10dc538373153163c708d88bc62258cc.tar.xz
rpm-setup-781fe30e10dc538373153163c708d88bc62258cc.zip
brp-mangle-shebangs: Strip env flags when mangling shebangs
- For example, mangle "#!/usr/bin/env -S vd" to "#!/usr/bin/vd" - Fixes: rhbz#2265038 Signed-off-by: Jani Välimaa <wally@mageia.org>
Diffstat (limited to 'brp-mangle-shebangs')
-rwxr-xr-xbrp-mangle-shebangs8
1 files changed, 4 insertions, 4 deletions
diff --git a/brp-mangle-shebangs b/brp-mangle-shebangs
index 5343519..f27ad73 100755
--- a/brp-mangle-shebangs
+++ b/brp-mangle-shebangs
@@ -137,10 +137,10 @@ while IFS= read -r line; do
fi
# Replace "special" env shebang:
- # /whatsoever/env /whatever/foo → /whatever/foo
- shebang=$(echo "$shebang" | sed -r -e 's@^(.+)/env /(.+)$@/\2@')
- # /whatsoever/env foo → /whatsoever/foo
- shebang=$(echo "$shebang" | sed -r -e 's@^(.+/)env (.+)$@\1\2@')
+ # /whatsoever/env -whatever /whatever/foo → /whatever/foo
+ shebang=$(echo "$shebang" | sed -r -e 's@^(.+)/env( -[^ ]+)* /(.+)$@/\3@')
+ # /whatsoever/env -whatever foo → /whatsoever/foo
+ shebang=$(echo "$shebang" | sed -r -e 's@^(.+/)env( -[^ ]+)* (.+)$@\1\3@')
# If the shebang now starts with /bin, change it to /usr/bin
# https://bugzilla.redhat.com/show_bug.cgi?id=1581757