The pax-utils code is full of odd cases related to the -q, --quiet flag. Within the context of bug 711244, we've found an unexpected interaction with musl's /usr/lib/libc.so that's triggered by the -q, --quiet flag. Therefore, it's probably best to use -B, --nobanner instead of -q, --quiet.
The scanelf -q call actually behaves as intended. It doesn't output anything for musl's /usr/lib/libc.so because the file has no DT_NEEDED or DT_SONAME settings. For the particular scanelf command that's used to generate NEEDED.ELF.2, we can safely omit the scanelf -q option as long as we account for the fact the this will cause the scanelf_file_rpath function to output " - " when there are no DT_NEEDED settings.
Patch posted for review: https://archives.gentoo.org/gentoo-portage-dev/message/64bbae4ae7623e90d6659e18175d726f https://github.com/gentoo/portage/pull/548
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=0bd5b693ef12c266000aafeb9557c1437fdfc1b2 commit 0bd5b693ef12c266000aafeb9557c1437fdfc1b2 Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2020-05-09 22:07:17 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2020-05-24 22:15:24 +0000 NeededEntry: don't use scanelf -q (bug 721336) We don't use scanelf -q, since that would omit libraries like musl's /usr/lib/libc.so which do not have any DT_NEEDED or DT_SONAME settings. Since we don't use scanelf -q, we have to handle the special rpath value " - ". Bug: https://bugs.gentoo.org/721336 Fixes: 25fbe7bc1a92 ("NeededEntry: infer implicit soname from file basename (bug 715162)") Signed-off-by: Zac Medico <zmedico@gentoo.org> bin/misc-functions.sh | 6 +++++- lib/portage/util/_dyn_libs/LinkageMapELF.py | 5 ++++- lib/portage/util/_dyn_libs/NeededEntry.py | 5 +++++ 3 files changed, 14 insertions(+), 2 deletions(-)