Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 508180 - When pre-stripped files found further strip attempt skipped even if trash section exists
Summary: When pre-stripped files found further strip attempt skipped even if trash sec...
Status: UNCONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Enhancement/Feature Requests (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-19 18:46 UTC by and
Modified: 2014-06-11 17:41 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description and 2014-04-19 18:46:51 UTC
As of sys-apps/portage-2.2.8-r1
/usr/lib/portage/bin/ebuild-helpers/prepstrip
will detect stripped files by checking for non-existing section .symtab in elf header.
and will skip further strip attempt.

This is inaccurate because we strip more sections then only .symtab  (currently -R .comment -R .GCC.command.line -R .note.gnu.gold-version)

So lets strip even pre-stripped files again, to catch more removable sections.



Reproducible: Always

Steps to Reproduce:
# emerge app-arch/xz-utils-5.0.5-r1
# tail build.log
 * QA Notice: Pre-stripped files found:
 * /usr/bin/lzmainfo
 * /usr/bin/xz
 * /usr/bin/xzdec
 * /usr/bin/lzmadec
strip: x86_64-pc-linux-gnu-strip --strip-unneeded -R .comment -R .GCC.command.line -R .note.gnu.gold-version
   lib64/liblzma.so.5.0.5

Actual Results:  
# readelf --section-headers /usr/bin/xz | grep .comment
  [25] .comment          PROGBITS         0000000000000000  00013104
# stat /usr/bin/xz | grep Size
  Size: 80152           Blocks: 160        IO Block: 4096   regular file



Expected Results:  
# readelf --section-headers /usr/bin/xz | grep .comment
# stat /usr/bin/xz | grep Size
  Size: 79904           Blocks: 160        IO Block: 4096   regular file


My (tm) solution it to watch for an always(?) existing section in elf file.
Please cross check if .init section is the right choice.


--- a/prepstrip 2014-04-19 00:00:00.000000000 +0000
+++ b/prepstrip 2014-04-19 00:00:00.000000000 +0000
@@ -286,7 +286,7 @@
 done < <(
        # Use sort -u to eliminate duplicates for bug #445336.
        (
-               scanelf -yqRBF '#k%F' -k '.symtab' "$@"
+               scanelf -yqRBF '#k%F' -k '.init' "$@"
                find "$@" -type f ! -type l -name '*.a'
        ) | LC_ALL=C sort -u
 )
Comment 1 and 2014-06-11 17:41:53 UTC
Ding dong,
there was a missing detail to provoke pre-stripped build.
I used LDFLAGS="-s".

Yes, most ebuilds will never trigger pre-stripped warning because ebuild maintainer aware of this.

This bug/request should dealing with rarely cases where pre-stripped (but not fully pre-stripped) files was found.