commit: 021f230f009ced07550c9465da44221a81a60d47
Author: Michal Rostecki <vadorovsky <AT> protonmail <DOT> com>
AuthorDate: Thu Jan 22 17:35:09 2026 +0000
Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sat Jan 24 13:35:24 2026 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=021f230f
sysroot.eclass: Fix the dynamic linker check
Using the brace expression {ld.so,lld} in the find command results
in musl's lld being printed, but still returns an error code due to the
lack of glibc's ld.so. See the mentioned bug.
Also, usage of find is not really needed there, since we want to simply
check the existence of paths and there is no need for a recursive check.
Fix that by using a simple [[ -L ]] check.
Bug: https://bugs.gentoo.org/969092
Signed-off-by: Michal Rostecki <vadorovsky <AT> protonmail.com>
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
eclass/sysroot.eclass | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/eclass/sysroot.eclass b/eclass/sysroot.eclass
index f17d6bcec2b4..5775e409da02 100644
--- a/eclass/sysroot.eclass
+++ b/eclass/sysroot.eclass
@@ -1,4 +1,4 @@
-# Copyright 2025 Gentoo Authors
+# Copyright 2025-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: sysroot.eclass
@@ -83,7 +83,14 @@ sysroot_make_run_prefixed() {
if [[ ${QEMU_ARCH} == $(qemu_arch "${CBUILD}") ]]; then
# glibc: ld.so is a symlink, ldd is a binary.
# musl: ld.so doesn't exist, ldd is a symlink.
- local DLINKER=$(find "${MYEROOT}"/usr/bin/{ld.so,ldd} -type l
-print -quit 2>/dev/null || die "failed to find dynamic linker")
+ local DLINKER candidate
+ for candidate in "${MYEROOT}"/usr/bin/{ld.so,ldd}; do
+ if [[ -L ${candidate} ]]; then
+ DLINKER=${candidate}
+ break
+ fi
+ done
+ [[ -n ${DLINKER} ]] || die "failed to find dynamic linker"
# musl symlinks ldd to ld-musl.so to libc.so. We want the
ld-musl.so
# path, not the libc.so path, so don't resolve the symlinks
entirely.