On Wed, Sep 18, 2024 at 12:12:56PM +0200, Lukasz Gut wrote: > On Arch Linux ldd /bin/sh reports: > /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 > Use a regex to pick only right side and use it for path processing. I think this approach is overly specific. The broader point here is that ldd can list libraries (including the dynamic linker) as either a link, or directly as a file. In the cases Stefano wrote for, it was always a single file for the dynamic linker and a link for everything else. For Arch it seems to be a link for everything, but both of those might not be true everywhere. It would make more sense to alter the loop above which processes all libraries to handle both the link and no-link cases, and remove the special case handling of ld.so. > Signed-off-by: Lukasz Gut > --- > mbuto | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/mbuto b/mbuto > index b80ea78..1c3b347 100755 > --- a/mbuto > +++ b/mbuto > @@ -704,9 +704,14 @@ __libs_copy() { > for __l in $("${LDD}" "${1}" 2>/dev/null); do > case ${__l} in "/"*" "*) __ld_so="${__l% *}" ;; *) ;; esac > done > - if [ -n "${__ld_so}" ]; then > - libs_copy_ld_so "${__ld_so}" > - libs_path_add "${__ld_so##${wd}}" > + # On Arch Linux ld is reported by ldd in form: > + # /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 > + # Make sure to take only right part in this case. > + __ld_path="${__ld_so##*=> }" > + > + if [ -n "${__ld_path}" ]; then > + libs_copy_ld_so "${__ld_path}" > + libs_path_add "${__ld_path##${wd}}" > fi > } > -- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson