commit: 9266e8e8d5709b9046e085baf3521a9e7a744d5b Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> AuthorDate: Thu May 12 22:08:46 2016 +0000 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> CommitDate: Thu May 12 22:08:46 2016 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9266e8e8
qa-checks: executable-issues: improve logic & output Use more robust shell styles for parsing strings/output, and change the QA log output to include the actual failing rpaths. This helps in debugging/tracking down problems. X-Gentoo-Bug: 582524 X-Gentoo-Bug-URL: https://bugs.gentoo.org/582524 bin/install-qa-check.d/10executable-issues | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/install-qa-check.d/10executable-issues b/bin/install-qa-check.d/10executable-issues index 066f150..b52cc93 100644 --- a/bin/install-qa-check.d/10executable-issues +++ b/bin/install-qa-check.d/10executable-issues @@ -22,26 +22,26 @@ elf_check() { # that directory won't exist on the target system. # 3) Null paths are banned because the loader will search $PWD when # it finds null paths. - local forbidden_dirs="${PORTAGE_BUILDDIR}" - if [[ -n "${ROOT}" && "${ROOT}" != "/" ]]; then - forbidden_dirs+=" ${ROOT}" + local forbidden_dirs=( "${PORTAGE_BUILDDIR}" ) + if [[ "${ROOT:-/}" != "/" ]]; then + forbidden_dirs+=( "${ROOT}" ) fi local dir l rpath_files=$(scanelf -F '%F:%r' -qBR "${ED}") f="" - for dir in ${forbidden_dirs}; do - for l in $(echo "${rpath_files}" | grep -E ":${dir}|::|: "); do - f+=" ${l%%:*}\n" + for dir in "${forbidden_dirs[@]}"; do + while read l; do + f+=" ${l/:/\n RPATH: }\n" if ! has stricter ${FEATURES}; then __vecho "Auto fixing rpaths for ${l%%:*}" TMPDIR="${dir}" scanelf -BXr "${l%%:*}" -o /dev/null fi - done + done < <(echo "${rpath_files}" | grep -F -e ":${dir}" -e "::" -e ": ") done # Reject set*id binaries with $ORIGIN in RPATH #260331 x=$( - find "${ED}" -type f \( -perm -u+s -o -perm -g+s \) -print0 | \ - xargs -0 scanelf -qyRF '%r %p' | grep '$ORIGIN' + find "${ED}" -type f '(' -perm -u+s -o -perm -g+s ')' \ + -exec scanelf -qyRF '%r %p' {} + | grep '$ORIGIN' ) # Print QA notice.