teknoraver / rpms / rpm

Forked from rpms/rpm 3 months ago
Clone

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

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