From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1341377-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 9C7CB158086
	for <garchives@archives.gentoo.org>; Fri, 19 Nov 2021 16:17:37 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id A29D8E05AC;
	Fri, 19 Nov 2021 16:17:36 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 3A7EAE07B2
	for <gentoo-commits@lists.gentoo.org>; Fri, 19 Nov 2021 16:17:36 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 061FC34307E
	for <gentoo-commits@lists.gentoo.org>; Fri, 19 Nov 2021 16:17:34 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 9189C1CE
	for <gentoo-commits@lists.gentoo.org>; Fri, 19 Nov 2021 16:17:32 +0000 (UTC)
From: "Mike Gilbert" <floppym@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Mike Gilbert" <floppym@gentoo.org>
Message-ID: <1637338567.2cd58ac5a96541d0b1ba0440666114d48dc2c889.floppym@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: bin/
X-VCS-Repository: proj/portage
X-VCS-Files: bin/estrip
X-VCS-Directories: bin/
X-VCS-Committer: floppym
X-VCS-Committer-Name: Mike Gilbert
X-VCS-Revision: 2cd58ac5a96541d0b1ba0440666114d48dc2c889
X-VCS-Branch: master
Date: Fri, 19 Nov 2021 16:17:32 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 0439f821-8d36-4b00-b58d-76fc04a7cbed
X-Archives-Hash: 6ed1335847edda6ea32a43c0f2d75c7b

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