From 8f59b756ca26ce9944ee082ea642ab35ba1bff52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 20 Feb 2018 11:34:07 +0100 Subject: [PATCH] Don't mangle shebangs with whitespace only changes (#1546993) --- brp-mangle-shebangs | 9 +++++---- redhat-rpm-config.spec | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/brp-mangle-shebangs b/brp-mangle-shebangs index 9b25ed3..b9b22b8 100755 --- a/brp-mangle-shebangs +++ b/brp-mangle-shebangs @@ -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 diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 8c9a4fb..acc2ead 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -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 - 100-1 +- Don't mangle shebangs with whitespace only changes (#1546993) + * Thu Feb 22 2018 Igor Gnatenko - 99-1 - Move %%end to %%ldconfig_scriptlets