Summary: | sys-apps/portage: false positives on "QA Notice: Pre-stripped files found:" for files without ".symtab" | ||
---|---|---|---|
Product: | Portage Development | Reporter: | Sergei Trofimovich (RETIRED) <slyfox> |
Component: | Core | Assignee: | Portage team <dev-portage> |
Status: | CONFIRMED --- | ||
Severity: | normal | CC: | esigra, slyfox, toolchain |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
See Also: | https://bugs.gentoo.org/show_bug.cgi?id=847493 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 795810, 933986, 784923 |
Description
Sergei Trofimovich (RETIRED)
2021-06-01 22:11:58 UTC
bug #795810 is another example where ELF file without program headers is slagged as "stripped". `readelf` complains on these files as: "There are no program headers in this file." Ideally `scanelf` should provide a mechanism for us to finter on files with program headers only. I don't think it has that as a one-liner. I wonder if '#e' is expected to Just work. It does not today: $ scanelf -yqRBF '#e#k%F' -k '!.symtab' crtn-2.36.o crtn-2.36.o (In reply to Sergei Trofimovich from comment #2) > Ideally `scanelf` should provide a mechanism for us to finter on files with > program headers only. I don't think it has that as a one-liner. > > I wonder if '#e' is expected to Just work. It does not today: > > $ scanelf -yqRBF '#e#k%F' -k '!.symtab' crtn-2.36.o > crtn-2.36.o Ah, it does not work as is because '#e#k' works as "any of", not "all of". Also, absence of program headers is expected: It's not a final executable. We'll need a different, heuristic. Maybe, presence of non-empty executable PROGBITS sections: [ 1] .text PROGBITS 0000000000000000 00000040 0000000000000007 0000000000000000 AX 0 0 1 Later code in estrip uses 'file' to check type of file: https://gitweb.gentoo.org/proj/portage.git/tree/bin/estrip?id=36dbd3e4336fa199a35b4f74c1679511707138f5#n492 f=$(file "${x}") || exit 0 ... if [[ ${f} == *"current ar archive"* ]] ; then process_ar "${x}" elif [[ ${f} == *"SB executable"* || ${f} == *"SB pie executable"* || ${f} == *"SB shared object"* ]] ; then process_elf "${x}" "${inode_link}" ${PORTAGE_STRIP_FLAGS} elif [[ ${f} == *"SB relocatable"* ]] ; then process_elf "${x}" "${inode_link}" ${SAFE_STRIP_FLAGS} fi So maybe earlier code in estrip (https://gitweb.gentoo.org/proj/portage.git/tree/bin/estrip?id=36dbd3e4336fa199a35b4f74c1679511707138f5#n406) should ignore *"SB relocatable"* files (i.e. *.o files)? |