From 65de6e6beb990dfb880ac1263698f5b109a1d62e 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: [PATCH] brp-mangle-shebangs: Strip env flags when mangling shebangs - For example, mangle "#!/usr/bin/env -S vd" to "#!/usr/bin/vd" - Fixes: rhbz#2265038 --- brp-mangle-shebangs | 8 ++++---- redhat-rpm-config.spec | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/brp-mangle-shebangs b/brp-mangle-shebangs index ab7af60..2abd6e0 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 diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 429aa05..cbec483 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -4,7 +4,7 @@ # 2) When making changes, increment the version (in baserelease) by 1. # rpmdev-bumpspec and other tools update the macro below, which is used # in Version: to get the desired effect. -%global baserelease 284 +%global baserelease 285 Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config @@ -261,6 +261,11 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora common.lua %doc buildflags.md %changelog +* Tue Feb 20 2024 Miro Hrončok - 285-1 +- brp-mangle-shebangs: Strip env flags when mangling shebangs +- For example, mangle "#!/usr/bin/env -S vd" to "#!/usr/bin/vd" +- Fixes: rhbz#2265038 + * Wed Feb 14 2024 Florian Weimer - 284-1 - Correct advise for disabling debuginfo packages (#2264161)