Blame SOURCES/rpm-4.16.1.3-ELF-files-strip-when-debuginfo-disabled.patch

3f3ddd
From 7f0b7217fb1c20ec6ce0c0e0bfee0349f27a2511 Mon Sep 17 00:00:00 2001
3f3ddd
From: Panu Matilainen <pmatilai@redhat.com>
3f3ddd
Date: Fri, 8 Jan 2021 13:59:59 +0200
3f3ddd
Subject: [PATCH] Ensure ELF files get stripped when debuginfo is disabled
3f3ddd
3f3ddd
Depending on libmagic version, PIE executables can be reported as
3f3ddd
"shared object" avoiding the strip. And so will any libraries because
3f3ddd
we're explicitly skipping them for whatever historical reason - perhaps
3f3ddd
because there's a separate script for stripping the libraries, but that
3f3ddd
has been never enabled in rpm, and relying on "file" strings to do this
3f3ddd
is hopelessly unreliable.
3f3ddd
3f3ddd
Also drop file permissions checks: making shared libraries executable
3f3ddd
just to have them stripped is not sensical, especially in the light of
3f3ddd
commit 80818e4f902ba3cf85e4cfcd8a7a4c71c601f3cf
3f3ddd
3f3ddd
Reported once upon time as RhBug:988812 and later RhBug:1634084
3f3ddd
---
3f3ddd
 scripts/brp-strip | 4 ++--
3f3ddd
 1 file changed, 2 insertions(+), 2 deletions(-)
3f3ddd
3f3ddd
diff --git a/scripts/brp-strip b/scripts/brp-strip
3f3ddd
index c3484fe3c..35fbb593a 100755
3f3ddd
--- a/scripts/brp-strip
3f3ddd
+++ b/scripts/brp-strip
3f3ddd
@@ -13,5 +13,5 @@ Darwin*) exit 0 ;;
3f3ddd
 esac
3f3ddd
 
3f3ddd
 # Strip ELF binaries
3f3ddd
-find "$RPM_BUILD_ROOT" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) \! -regex "${RPM_BUILD_ROOT}/*usr/lib/debug.*" -print0 | \
3f3ddd
-    xargs -0 -r -P$NCPUS -n32 sh -c "file \"\$@\" | grep -v ' shared object,' | sed -n -e 's/^\(.*\):[ 	]*ELF.*, not stripped.*/\1/p' | xargs -I\{\} $STRIP -g \{\}" ARG0
3f3ddd
+find "$RPM_BUILD_ROOT" -type f \! -regex "${RPM_BUILD_ROOT}/*usr/lib/debug.*" -print0 | \
3f3ddd
+    xargs -0 -r -P$NCPUS -n32 sh -c "file \"\$@\" | sed -n -e 's/^\(.*\):[ 	]*ELF.*, not stripped.*/\1/p' | xargs -I\{\} $STRIP -g \{\}" ARG0
3f3ddd
-- 
3f3ddd
2.33.1
3f3ddd