teknoraver / rpms / rpm

Forked from rpms/rpm 3 months ago
Clone

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

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