From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from re-prd-fep-042.btinternet.com (mailomta17-re.btinternet.com [213.120.69.110]) by sourceware.org (Postfix) with ESMTPS id B4189385C017 for ; Tue, 1 Feb 2022 17:26:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B4189385C017 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dronecode.org.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=dronecode.org.uk Received: from re-prd-rgout-002.btmx-prd.synchronoss.net ([10.2.54.5]) by re-prd-fep-042.btinternet.com with ESMTP id <20220201172601.HGBF12369.re-prd-fep-042.btinternet.com@re-prd-rgout-002.btmx-prd.synchronoss.net>; Tue, 1 Feb 2022 17:26:01 +0000 Authentication-Results: btinternet.com; none X-SNCR-Rigid: 613A8DE812D6C03E X-Originating-IP: [213.120.30.10] X-OWM-Source-IP: 213.120.30.10 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-VadeSecure-score: verdict=clean score=0/300, class=clean X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgedvvddrgeefgddutddtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuueftkffvkffujffvgffngfevqffopdfqfgfvnecuuegrihhlohhuthemuceftddunecunecujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeflohhnucfvuhhrnhgvhicuoehjohhnrdhtuhhrnhgvhiesughrohhnvggtohguvgdrohhrghdruhhkqeenucggtffrrghtthgvrhhnpeefieduveehgfffffeuueehleefgeevfedvffeljeefheduteelteelvdettefhvdenucfkphepvddufedruddvtddrfedtrddutdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhephhgvlhhopehlohgtrghlhhhoshhtrdhlohgtrghlughomhgrihhnpdhinhgvthepvddufedruddvtddrfedtrddutddpmhgrihhlfhhrohhmpehjohhnrdhtuhhrnhgvhiesughrohhnvggtohguvgdrohhrghdruhhkpdhnsggprhgtphhtthhopedvpdhrtghpthhtoheptgihghifihhnqdgrphhpshestgihghifihhnrdgtohhmpdhrtghpthhtohepjhhonhdrthhurhhnvgihsegurhhonhgvtghouggvrdhorhhgrdhukh X-RazorGate-Vade-Verdict: clean 0 X-RazorGate-Vade-Classification: clean Received: from localhost.localdomain (213.120.30.10) by re-prd-rgout-002.btmx-prd.synchronoss.net (5.8.716.04) (authenticated as jonturney@btinternet.com) id 613A8DE812D6C03E; Tue, 1 Feb 2022 17:26:01 +0000 From: Jon Turney To: cygwin-apps@cygwin.com Cc: Jon Turney Subject: [PATCH cygport 1/2] postinst: Never remove an existing .gnu_debuglink Date: Tue, 1 Feb 2022 17:25:18 +0000 Message-Id: <20220201172519.14881-2-jon.turney@dronecode.org.uk> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220201172519.14881-1-jon.turney@dronecode.org.uk> References: <20220201172519.14881-1-jon.turney@dronecode.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3578.1 required=5.0 tests=BAYES_00, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin-apps@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin package maintainer discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Feb 2022 17:26:04 -0000 Be more careful not to remove an existing .gnu_debuglink, even if we think this package has no useful debug symbols. (Some versions of 'llvm-objdump -l' fail to find line number info even though it's there. Don't break a package which manages it's own debug symbols (e.g. cygwin) when that happens.) --- lib/src_postinst.cygpart | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/lib/src_postinst.cygpart b/lib/src_postinst.cygpart index d8bb226..e29b2cb 100644 --- a/lib/src_postinst.cygpart +++ b/lib/src_postinst.cygpart @@ -1051,23 +1051,31 @@ __prepstrip() { lines=$(${objdump} -d -l "${exe}" 2>/dev/null | sed -ne "s|.*\(/usr/src/debug/${PF}/.*\):[0-9]*$|\1|gp" | sort -u | tee -a ${T}/.dbgsrc.out | wc -l); - if (( lines == 0 )) + # we expect --add-gnu-debuglink to fail if a + # .gnu_debuglink section already exists (e.g. binutils, + # which uses hardlinks, or cygwin which creates a custom + # .dbg file), but leave it alone to make sure we don't + # mess it up. + if ${objdump} -h "${exe}" | grep -q '\.gnu_deb' then - ${objcopy} --strip-all "${exe}"; continue; fi - # --add-gnu-debuglink will fail if .gnu_debuglink section - # already exists, e.g. binutils, which uses hardlinks, - # or cygwin which creates a custom .dbg file - if ! ${objdump} -h "${exe}" | grep -q '\.gnu_deb' + # only create split debuginfo if it's going to contain + # some symbols for which this package has the + # corresponding source files + if (( lines == 0 )) then - dodir "${dbg%/*}"; - ${objcopy} --long-section-names enable --add-gnu-debuglink=/dev/null --only-keep-debug "${exe}" "${D}${dbg}"; - chmod 0644 "${D}${dbg}"; ${objcopy} --strip-all "${exe}"; - ${objcopy} --long-section-names enable --add-gnu-debuglink="${D}${dbg}" "${exe}" 2>/dev/null; + continue; fi + + dodir "${dbg%/*}"; + ${objcopy} --long-section-names enable --add-gnu-debuglink=/dev/null --only-keep-debug "${exe}" "${D}${dbg}"; + chmod 0644 "${D}${dbg}"; + ${objcopy} --strip-all "${exe}"; + ${objcopy} --long-section-names enable --add-gnu-debuglink="${D}${dbg}" "${exe}" 2>/dev/null; + fi done } -- 2.34.1