Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] scanelf: fix %p format string for EAPI 7 (bug 659228)
Date: Wed, 27 Jun 2018 02:46:56
Message-Id: 20180627024625.24469-1-zmedico@gentoo.org
1 For all scanelf path arguments that are used in processing of
2 the %p format string, normalize the argument to have a trailing
3 slash, so that the leading slash is consistently stripped in
4 the expansion of the %p format string.
5
6 Bug: https://bugs.gentoo.org/659228
7 ---
8 bin/install-qa-check.d/10executable-issues | 4 ++--
9 bin/install-qa-check.d/10ignored-flags | 6 +++---
10 bin/misc-functions.sh | 2 +-
11 3 files changed, 6 insertions(+), 6 deletions(-)
12
13 diff --git a/bin/install-qa-check.d/10executable-issues b/bin/install-qa-check.d/10executable-issues
14 index 24973fe0d7..8a2c8e8758 100644
15 --- a/bin/install-qa-check.d/10executable-issues
16 +++ b/bin/install-qa-check.d/10executable-issues
17 @@ -66,7 +66,7 @@ elf_check() {
18 [[ -n ${!qa_var} ]] && QA_TEXTRELS=${!qa_var}
19 [[ -n ${QA_STRICT_TEXTRELS} ]] && QA_TEXTRELS=""
20 export QA_TEXTRELS="${QA_TEXTRELS} lib*/modules/*.ko"
21 - f=$(scanelf -qyRF '%t %p' "${ED}" | grep -v 'usr/lib/debug/')
22 + f=$(scanelf -qyRF '%t %p' "${ED%/}/" | grep -v 'usr/lib/debug/')
23 if [[ -n ${f} ]] ; then
24 scanelf -qyRAF '%T %p' "${PORTAGE_BUILDDIR}"/ &> "${T}"/scanelf-textrel.log
25 __vecho -ne '\n'
26 @@ -109,7 +109,7 @@ elf_check() {
27 [[ -n ${QA_STRICT_WX_LOAD} ]] && QA_WX_LOAD=""
28 export QA_EXECSTACK="${QA_EXECSTACK} lib*/modules/*.ko"
29 export QA_WX_LOAD="${QA_WX_LOAD} lib*/modules/*.ko"
30 - f=$(scanelf -qyRAF '%e %p' "${ED}" | grep -v 'usr/lib/debug/')
31 + f=$(scanelf -qyRAF '%e %p' "${ED%/}/" | grep -v 'usr/lib/debug/')
32 ;;
33 esac
34 ;;
35 diff --git a/bin/install-qa-check.d/10ignored-flags b/bin/install-qa-check.d/10ignored-flags
36 index dc160e1822..09bcb57fc6 100644
37 --- a/bin/install-qa-check.d/10ignored-flags
38 +++ b/bin/install-qa-check.d/10ignored-flags
39 @@ -26,7 +26,7 @@ ignored_flag_check() {
40 [[ "${FFLAGS}" == *-frecord-gcc-switches* ]] && \
41 [[ "${FCFLAGS}" == *-frecord-gcc-switches* ]] ; then
42 rm -f "${T}"/scanelf-ignored-CFLAGS.log
43 - for x in $(scanelf -qyRF '#k%p' -k '!.GCC.command.line' "${ED}") ; do
44 + for x in $(scanelf -qyRF '#k%p' -k '!.GCC.command.line' "${ED%/}/") ; do
45 # Separate out file types that are known to support
46 # .GCC.command.line sections, using the `file` command
47 # similar to how prepstrip uses it.
48 @@ -66,8 +66,8 @@ ignored_flag_check() {
49 # Check for files built without respecting LDFLAGS
50 if [[ "${LDFLAGS}" == *,--defsym=__gentoo_check_ldflags__* ]] && \
51 ! has binchecks ${RESTRICT} ; then
52 - f=$(LC_ALL=C comm -3 <(scanelf -qyRF '#k%p' -k .dynsym "${ED}" | LC_ALL=C sort) \
53 - <(scanelf -qyRF '#s%p' -s __gentoo_check_ldflags__ "${ED}" | LC_ALL=C sort))
54 + f=$(LC_ALL=C comm -3 <(scanelf -qyRF '#k%p' -k .dynsym "${ED%/}/" | LC_ALL=C sort) \
55 + <(scanelf -qyRF '#s%p' -s __gentoo_check_ldflags__ "${ED%/}/" | LC_ALL=C sort))
56 if [[ -n ${f} ]] ; then
57 echo "${f}" > "${T}"/scanelf-ignored-LDFLAGS.log
58 if [ "${QA_STRICT_FLAGS_IGNORED-unset}" = unset ] ; then
59 diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
60 index de8af955d4..34492e086d 100755
61 --- a/bin/misc-functions.sh
62 +++ b/bin/misc-functions.sh
63 @@ -237,7 +237,7 @@ install_qa_check() {
64 if type -P scanelf > /dev/null ; then
65 # Save NEEDED information after removing self-contained providers
66 rm -f "$PORTAGE_BUILDDIR"/build-info/NEEDED{,.ELF.2}
67 - scanelf -qyRF '%a;%p;%S;%r;%n' "${D}" | { while IFS= read -r l; do
68 + scanelf -qyRF '%a;%p;%S;%r;%n' "${D%/}/" | { while IFS= read -r l; do
69 arch=${l%%;*}; l=${l#*;}
70 obj="/${l%%;*}"; l=${l#*;}
71 soname=${l%%;*}; l=${l#*;}
72 --
73 2.13.6