From 781fe30e10dc538373153163c708d88bc62258cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 20 Feb 2024 10:16:21 +0100 Subject: brp-mangle-shebangs: Strip env flags when mangling shebangs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - For example, mangle "#!/usr/bin/env -S vd" to "#!/usr/bin/vd" - Fixes: rhbz#2265038 Signed-off-by: Jani Välimaa --- brp-mangle-shebangs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'brp-mangle-shebangs') 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 -- cgit v1.2.1