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. Signed-off-by: Lukasz Gut <lgut(a)lgut.eu> --- 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 } -- 2.46.1