Don't mangle shebangs with whitespace only changes (#1546993)

This commit is contained in:
Miro Hrončok 2018-02-20 11:34:07 +01:00
parent 987e94f6ea
commit 8f59b756ca
2 changed files with 9 additions and 5 deletions

View File

@ -27,8 +27,9 @@ while IFS= read -r -d $'\0' f; do
ts=$(stat -c %y "$f") ts=$(stat -c %y "$f")
read orig_shebang < "$f" || : read shebang_line < "$f" || :
shebang=$(trim $(echo "$orig_shebang" | grep -Po "#!\K.*" || echo)) orig_shebang=$(trim $(echo "$shebang_line" | grep -Po "#!\K.*" || echo))
shebang="$orig_shebang"
if [ -n "$exclude_shebangs" ]; then if [ -n "$exclude_shebangs" ]; then
echo "$shebang" | grep -q -E "$exclude_shebangs" && continue echo "$shebang" | grep -q -E "$exclude_shebangs" && continue
fi fi
@ -59,8 +60,8 @@ while IFS= read -r -d $'\0' f; do
if [ "$shebang" != "$py_shebang" ]; then if [ "$shebang" != "$py_shebang" ]; then
sed -i -e "1c #!$py_shebang" "$f" sed -i -e "1c #!$py_shebang" "$f"
echo >&2 "*** WARNING: mangling shebang in $path from $orig_shebang to #!$py_shebang. This will become an ERROR, fix it manually!" echo >&2 "*** WARNING: mangling shebang in $path from #!$orig_shebang to #!$py_shebang. This will become an ERROR, fix it manually!"
elif [ "#!$shebang" != "$orig_shebang" ]; then elif [ "#!$shebang" != "#!$orig_shebang" ]; then
sed -i -e "1c #!$shebang" "$f" sed -i -e "1c #!$shebang" "$f"
echo "mangling shebang in $path from $orig_shebang to #!$shebang" echo "mangling shebang in $path from $orig_shebang to #!$shebang"
fi fi

View File

@ -6,7 +6,7 @@
Summary: Red Hat specific rpm configuration files Summary: Red Hat specific rpm configuration files
Name: redhat-rpm-config Name: redhat-rpm-config
Version: 99 Version: 100
Release: 1%{?dist} Release: 1%{?dist}
# No version specified. # No version specified.
License: GPL+ License: GPL+
@ -183,6 +183,9 @@ install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kmod.prov
%{_rpmconfigdir}/macros.d/macros.kmp %{_rpmconfigdir}/macros.d/macros.kmp
%changelog %changelog
* Thu Feb 22 2018 Miro Hrončok <mhroncok@redhat.com> - 100-1
- Don't mangle shebangs with whitespace only changes (#1546993)
* Thu Feb 22 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 99-1 * Thu Feb 22 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 99-1
- Move %%end to %%ldconfig_scriptlets - Move %%end to %%ldconfig_scriptlets