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")
read orig_shebang < "$f" || :
shebang=$(trim $(echo "$orig_shebang" | grep -Po "#!\K.*" || echo))
read shebang_line < "$f" || :
orig_shebang=$(trim $(echo "$shebang_line" | grep -Po "#!\K.*" || echo))
shebang="$orig_shebang"
if [ -n "$exclude_shebangs" ]; then
echo "$shebang" | grep -q -E "$exclude_shebangs" && continue
fi
@ -59,8 +60,8 @@ while IFS= read -r -d $'\0' f; do
if [ "$shebang" != "$py_shebang" ]; then
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!"
elif [ "#!$shebang" != "$orig_shebang" ]; then
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
sed -i -e "1c #!$shebang" "$f"
echo "mangling shebang in $path from $orig_shebang to #!$shebang"
fi

View File

@ -6,7 +6,7 @@
Summary: Red Hat specific rpm configuration files
Name: redhat-rpm-config
Version: 99
Version: 100
Release: 1%{?dist}
# No version specified.
License: GPL+
@ -183,6 +183,9 @@ install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kmod.prov
%{_rpmconfigdir}/macros.d/macros.kmp
%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
- Move %%end to %%ldconfig_scriptlets