commit:     2cd58ac5a96541d0b1ba0440666114d48dc2c889
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 16 19:58:42 2021 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Fri Nov 19 16:16:07 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=2cd58ac5

estrip: add death messages and debug prints in save_elf_debug

Bug: https://bugs.gentoo.org/823798
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 bin/estrip | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/bin/estrip b/bin/estrip
index 050d30a6f..0ad79e2a3 100755
--- a/bin/estrip
+++ b/bin/estrip
@@ -194,6 +194,8 @@ save_elf_debug() {
        ${FEATURES_splitdebug} || return 0
        ${PORTAGE_RESTRICT_splitdebug} && return 0
 
+       debug-print-function "${FUNCNAME}" "$@"
+
        # NOTE: Debug files must be installed in
        # ${EPREFIX}/usr/lib/debug/${EPREFIX} (note that ${EPREFIX} occurs
        # twice in this path) in order for gdb's debug-file-directory
@@ -213,16 +215,17 @@ save_elf_debug() {
        # dont save debug info twice
        [[ ${src} == *".debug" ]] && return 0
 
-       mkdir -p "${dst_dirname}" || die
+       mkdir -p "${dst_dirname}" || die "failed to create directory 
'${dst_dirname}'"
 
        if [[ -L ${inode_debug} ]] ; then
                # We already created a debug file for this inode.
                # Read back the file name, and create another hard link if 
necessary.
-               dst_basename=$(readlink "${inode_debug}") || die
+               dst_basename=$(readlink "${inode_debug}") || die "failed to 
read link '${inode_debug}'"
                dst_basename=${dst_basename##*/}
                dst=${dst_dirname}/${dst_basename}
                if [[ ! -e ${dst} ]]; then
-                       ln -L "${inode_debug}" "${dst}" || die
+                       debug-print "creating hard link: target: 
'${inode_debug}' name: '${dst}'"
+                       ln -L "${inode_debug}" "${dst}" || die "failed to 
create hard link '${dst}'"
                fi
        else
                dst_basename=${src_basename}.debug
@@ -242,7 +245,7 @@ save_elf_debug() {
                        [[ -g ${src} || -u ${src} ]] && args+=",go-r"
                        chmod ${args} "${dst}"
                        # symlink so we can read the name back.
-                       ln -s "${dst}" "${inode_debug}" || die
+                       ln -s "${dst}" "${inode_debug}" || die "failed to 
create symlink '${inode_debug}'"
 
                        # if we don't already have build-id from debugedit, 
look it up
                        if [[ -z ${buildid} ]] ; then
@@ -255,8 +258,8 @@ save_elf_debug() {
                                local 
src_buildid_rel="../../../../../${src#${ED%/}/}"
                                local 
dst_buildid_rel="../../${dst#${ED%/}/usr/lib/debug/}"
                                mkdir -p "${buildid_dir}" || die
-                               [[ -L "${buildid_file}".debug ]] || ln -s 
"${dst_buildid_rel}" "${buildid_file}.debug" || die
-                               [[ -L "${buildid_file}" ]] || ln -s 
"${src_buildid_rel}" "${buildid_file}" || die
+                               [[ -L "${buildid_file}".debug ]] || ln -s 
"${dst_buildid_rel}" "${buildid_file}.debug" || die "failed to create symlink 
'${buildid_file}.debug'"
+                               [[ -L "${buildid_file}" ]] || ln -s 
"${src_buildid_rel}" "${buildid_file}" || die "failed to create symlink 
'${buildid_file}'"
                        fi
                fi
        fi

Reply via email to