brp-mangle-shebangs: Strip env flags when mangling shebangs

- For example, mangle "#!/usr/bin/env -S vd" to "#!/usr/bin/vd"
- Fixes: rhbz#2265038
This commit is contained in:
Miro Hrončok 2024-02-20 10:16:21 +01:00
parent 3b9bfae367
commit 65de6e6beb
2 changed files with 10 additions and 5 deletions

View File

@ -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

View File

@ -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 <mhroncok@redhat.com> - 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 <fweimer@redhat.com> - 284-1
- Correct advise for disabling debuginfo packages (#2264161)