Bug 1661508

Summary: glibc: Adjust to rpm's find-debuginfo.sh changes, to keep stripping binaries [rhel-7.7]
Product: Red Hat Enterprise Linux 7 Reporter: Florian Weimer <fweimer>
Component: glibcAssignee: Florian Weimer <fweimer>
Status: CLOSED ERRATA QA Contact: qe-baseos-tools-bugs
Severity: urgent Docs Contact:
Priority: urgent    
Version: 7.7CC: ashankar, bgollahe, codonell, dj, fweimer, mcermak, mjw, mnewsome, pfrankli, pgm-rhel-tools, sipoyare, skolosov
Target Milestone: rcKeywords: Regression, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glibc-2.17-290.el7 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of:
: 1661510 1980650 1982316 1982317 (view as bug list) Environment:
Last Closed: 2019-08-06 12:49:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1661510, 1663264    
Bug Blocks: 1655768, 1982316    

Description Florian Weimer 2018-12-21 12:12:27 UTC
The fix for bug 1540653 has the side effect that binaries are no longer stripped because glibc.spec uses the -g option.  This adds a measurable overhead to the packages.

We need to fix this in some way, if necessary by calling strip explicitly.

This issue did not effect the glibc binaries in Red Hat Enterprise Linux 7.6 because those were built with an rpm version that did not contain the changes for bug 1540653.

Comment 2 Florian Weimer 2019-01-03 14:58:20 UTC
I tried to restore the old behavior with the current find-debuginfo.sh script, with a change like this:

diff --git a/glibc.spec b/glibc.spec
index 5a388aed..6bb329bc 100644
--- a/glibc.spec
+++ b/glibc.spec
@@ -3692,16 +3692,26 @@ ls -l $RPM_BUILD_ROOT/usr/bin/getconf
 ls -l $RPM_BUILD_ROOT/usr/libexec/getconf
 eu-readelf -hS $RPM_BUILD_ROOT/usr/bin/getconf $RPM_BUILD_ROOT/usr/libexec/getconf/*
 
-find_debuginfo_args='--strict-build-id -g'
+find_debuginfo_args='--strict-build-id'
 %ifarch %{debuginfocommonarches}
-find_debuginfo_args="$find_debuginfo_args \
+# glibc-common contains no libraries, so everything can be stripped
+# (no -g).
+bash /usr/lib/rpm/find-debuginfo.sh $find_debuginfo_args \
   -l common.filelist -l utils.filelist -l nscd.filelist \
-  -p '.*/(sbin|libexec)/.*' \
-  -o debuginfocommon.filelist \
-  -l rpm.filelist -l nosegneg.filelist \
-"
+  -o debuginfocommon.filelist
 %endif
-eval /usr/lib/rpm/find-debuginfo.sh "$find_debuginfo_args" -o debuginfo.filelist
+
+# For the glibc package, we must only use -g for the main libraries.
+lib_pattern='.*/lib[^/]*/[^/]+(\.so\.[^/]+|\.so)$'
+grep -hE "$lib_pattern" rpm.filelist nosegneg.filelist \
+  > libonly-rpm.filelist
+grep -hEv "$lib_pattern" rpm.filelist nosegneg.filelist \
+  > nolib-rpm.filelist
+bash /usr/lib/rpm/find-debuginfo.sh $find_debuginfo_args -g \
+  -o libonly-debuginfo.filelist -l libonly-rpm.filelist
+bash /usr/lib/rpm/find-debuginfo.sh $find_debuginfo_args \
+  -o nolib-debuginfo.filelist -l nolib-rpm.filelist
+cat libonly-debuginfo.filelist nolib-debuginfo.filelist > debuginfo.filelist
 
 # List all of the *.a archives in the debug directory.
 list_debug_archives()

But I don't think invoking the script multiple times like this will work because find-debuginfo.sh is really designed to process all files and then handle the -l split afterwards.

Comment 5 Florian Weimer 2019-04-02 11:37:54 UTC
Fixed with this patch:

diff --git a/glibc.spec b/glibc.spec
index d950a2a5..85bc411f 100644
--- a/glibc.spec
+++ b/glibc.spec
@@ -1677,6 +1677,9 @@ BuildRequires: systemd
 # the required semantics.
 BuildRequires: gcc >= 4.8.5-25
 
+# This RPM version introduced --g-libs.
+BuildRequires: rpm-build >= 4.11.3-38.el7
+
 %define enablekernel 2.6.32
 Conflicts: kernel < %{enablekernel}
 %define target %{_target_cpu}-redhat-linux
@@ -3812,7 +3815,7 @@ ls -l $RPM_BUILD_ROOT/usr/bin/getconf
 ls -l $RPM_BUILD_ROOT/usr/libexec/getconf
 eu-readelf -hS $RPM_BUILD_ROOT/usr/bin/getconf $RPM_BUILD_ROOT/usr/libexec/getconf/*
 
-find_debuginfo_args='--strict-build-id -g'
+find_debuginfo_args='--strict-build-id --g-libs'
 %ifarch %{debuginfocommonarches}
 find_debuginfo_args="$find_debuginfo_args \
   -l common.filelist -l utils.filelist -l nscd.filelist \

Comment 7 Sergey Kolosov 2019-06-14 09:41:11 UTC
Verified,

glibc-2.17-290.el7 contains stripped binaries, it also produces stripped binaries during rpmbuild -bb

Comment 9 errata-xmlrpc 2019-08-06 12:49:40 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:2118

Comment 13 Carlos O'Donell 2021-07-15 19:52:44 UTC
*** Bug 1982316 has been marked as a duplicate of this bug. ***