diff options
Diffstat (limited to 'lddtree.sh')
-rwxr-xr-x | lddtree.sh | 26 |
1 files changed, 9 insertions, 17 deletions
@@ -1,6 +1,6 @@ #!/bin/bash -# Copyright 2007-2013 Gentoo Foundation -# Copyright 2007-2013 Mike Frysinger <vapier@gentoo.org> +# Copyright 2007-2024 Gentoo Foundation +# Copyright 2007-2024 Mike Frysinger <vapier@gentoo.org> # Distributed under the terms of the GNU General Public License v2 argv0=${0##*/} @@ -45,7 +45,7 @@ elf_specs() { sed -E 's: (LINUX|GNU)$: NONE:' } -lib_paths_fallback="${ROOT}lib* ${ROOT}usr/lib* ${ROOT}usr/local/lib*" +lib_paths_fallback="${ROOT}lib* ${ROOT}usr/lib* ${ROOT}usr/local/lib* ${ROOT}usr/X11R6/lib*" c_ldso_paths_loaded='false' find_elf() { _find_elf='' @@ -73,7 +73,7 @@ find_elf() { if [[ ${c_last_needed_by} != ${needed_by} ]] ; then c_last_needed_by=${needed_by} c_last_needed_by_rpaths=$(scanelf -qF '#F%r' "${needed_by}" | \ - sed -e 's|:| |g' -e "s:[$]ORIGIN:${needed_by%/*}:") + sed -E -e 's|:| |g' -e "s:[$](ORIGIN|\{ORIGIN\}):${needed_by%/*}:") fi check_paths "${elf}" ${c_last_needed_by_rpaths} && return 0 @@ -96,8 +96,8 @@ find_elf() { read_ldso_conf() { local line p for p ; do - # if the glob didnt match anything #360041, - # or the files arent readable, skip it + # If the glob didn't match anything #360041, + # or the files aren't readable, skip it. [[ -r ${p} ]] || continue while read line ; do case ${line} in @@ -118,7 +118,7 @@ find_elf() { check_paths "${elf}" "${c_ldso_paths[@]}" && return 0 fi - check_paths "${elf}" ${lib_paths_ldso:-${lib_paths_fallback}} && return 0 + check_paths "${elf}" ${lib_paths_fallback} && return 0 fi return 1 } @@ -154,13 +154,6 @@ show_elf() { else printf " (interpreter => ${interp:-none})" fi - if [[ -r ${interp} ]] ; then - # Extract the default lib paths out of the ldso. - lib_paths_ldso=$( - strings "${interp}" | \ - sed -nr -e "/^\/.*lib/{s|^/?|${ROOT}|;s|/$||;s|/?:/?|\n${ROOT}|g;p}" - ) - fi full_interp=${interp} interp=${interp##*/} # If we are in non-list mode, then we want to show the "duplicate" interp @@ -186,12 +179,12 @@ show_elf() { # No need for leading comma w/my_allhits as we guarantee it always # starts with one due to the way we append the value above. [[ ${my_allhits}, == *,${lib},* ]] && continue - # If the interp is being linked against directly, re-use the existing + # If the interp is being linked against directly, reuse the existing # full path rather than perform a search for it. When systems symlink # the interp to a diff location, we might locate a different path, and # displaying both doesn't make sense as it doesn't match the runtime -- # the ldso won't load another copy of ldso into memory from the search - # path, it'll re-use the existing copy that was loaded from the full + # path, it'll reuse the existing copy that was loaded from the full # hardcoded path. if [[ ${lib} == "${interp}" ]] ; then rlib=${full_interp} @@ -235,7 +228,6 @@ ${SET_X} && set -x ret=0 for elf ; do - unset lib_paths_ldso unset c_last_needed_by if ${AUTO_ROOT} && [[ ${elf} == /* ]] ; then elf="${ROOT}${elf#/}" |