From df9234e0a16f34faaa4b0753409216006dfe1a18 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 2 Apr 2014 08:57:35 +0200 Subject: main/lddtree: print resolved interp symlinks otherwise we might get the symlink included in initramfs but not the file(s) that the symlinks points to. --- ...01-lddtree-print-resolved-interp-symlinks.patch | 86 ++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 main/lddtree/0001-lddtree-print-resolved-interp-symlinks.patch (limited to 'main/lddtree/0001-lddtree-print-resolved-interp-symlinks.patch') diff --git a/main/lddtree/0001-lddtree-print-resolved-interp-symlinks.patch b/main/lddtree/0001-lddtree-print-resolved-interp-symlinks.patch new file mode 100644 index 0000000000..81d4951a42 --- /dev/null +++ b/main/lddtree/0001-lddtree-print-resolved-interp-symlinks.patch @@ -0,0 +1,86 @@ +From 0f78645bb0941639bbc11bf047326fb9d7f9292a Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Wed, 2 Apr 2014 08:54:00 +0200 +Subject: [PATCH] lddtree: print resolved interp symlinks + +--- + lddtree.sh | 46 ++++++++++++++++++++++++---------------------- + 1 file changed, 24 insertions(+), 22 deletions(-) + +diff --git a/lddtree.sh b/lddtree.sh +index cb9db42..28c06d0 100644 +--- a/lddtree.sh ++++ b/lddtree.sh +@@ -140,6 +140,28 @@ list_existing_file() { + fi + } + ++# echo all intermediate symlinks and return the resolved path in ++# global variable _resolv_links ++resolv_links() { ++ _resolv_links="$1" ++ local oldpwd="$PWD" ++ list_existing_file "${_resolv_links}" ++ cd "${_resolv_links%/*}" ++ while [ -L "$_resolv_links" ]; do ++ _resolv_links=$(readlink "$_resolv_links") ++ case "$_resolv_links" in ++ /*) _resolv_links="${ROOT}${_resolv_links#/}" ++ cd "${_resolv_links%/*}" ++ ;; ++ */*) cd "${_resolv_links%/*}" ++ ;; ++ esac ++ _resolv_links=$(pwd -P)/${_resolv_links##*/} ++ list_existing_file "${_resolv_links}" ++ done ++ cd "$oldpwd" ++} ++ + show_elf() { + local elf=$1 indent=$2 parent_elfs=$3 + local rlib lib libs +@@ -157,30 +179,10 @@ show_elf() { + esac + parent_elfs="${parent_elfs},${elf}" + if ${LIST} ; then +- list_existing_file "${resolved:-$1}" ++ resolv_links "${resolved:-$1}" + else + printf "${resolved:-not found}" + fi +- local oldpwd="$PWD" +- cd "${resolved%/*}" +- while [ -L "$resolved" ]; do +- resolved=$(readlink "$resolved") +- case "$resolved" in +- /*) resolved="${ROOT}${resolved#/}" +- cd "${resolved%/*}" +- ;; +- */*) cd "${resolved%/*}" +- ;; +- esac +- resolved=$(pwd -P)/${resolved##*/} +- +- if ${LIST} ; then +- list_existing_file "${resolved:-$1}" +- else +- printf "${resolved:-not found}" +- fi +- done +- cd "$oldpwd" + if [ ${indent} -eq 0 ] ; then + elf_specs=$(elf_specs "${resolved}") + interp=$(scanelf -qF '#F%i' "${resolved}") +@@ -189,7 +191,7 @@ show_elf() { + [ -n "${interp}" ] && interp="${ROOT}${interp#/}" + + if ${LIST} ; then +- [ -n "${interp}" ] && echo "${interp}" ++ [ -n "${interp}" ] && resolv_links "${interp}" + else + printf " (interpreter => ${interp:-none})" + fi +-- +1.9.0 + -- cgit v1.2.3