On Wed, Jan 21, 2026 at 5:15 AM Michal Rostecki
<[email protected]> wrote:
>
> 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.
>
> Fix that by using -name with -o, so the command fails only if neither
> of the files are found.
>
> Bug: https://bugs.gentoo.org/969092
> Signed-off-by: Michal Rostecki <[email protected]>
> ---
> eclass/sysroot.eclass | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/eclass/sysroot.eclass b/eclass/sysroot.eclass
> index f17d6bcec2b4..a06a0dae3ecf 100644
> --- a/eclass/sysroot.eclass
> +++ b/eclass/sysroot.eclass
> @@ -83,7 +83,8 @@ 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=$(find "${MYEROOT}"/usr/bin/ \( -name ld.so -o
> -name ldd \) \
> + -type l -print -quit 2>/dev/null || 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.
> --
> 2.52.0
I don't understand why we are using find here. I don't think we want
to search recursively under ${MYROOT}/usr/bin.
I think it would make more sense to replace this with simple [[ -L ]]
checks for each path.