From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (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 finch.gentoo.org (Postfix) with ESMTPS id 71A3C1580E0 for ; Tue, 03 Jun 2025 20:50:14 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (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) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 4F55C34312A for ; Tue, 03 Jun 2025 20:50:14 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 82A4F1103DD; Tue, 03 Jun 2025 20:50:09 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (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 bobolink.gentoo.org (Postfix) with ESMTPS id 77D7F1103DD for ; Tue, 03 Jun 2025 20:50:09 +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) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2A0073430D1 for ; Tue, 03 Jun 2025 20:50:09 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 7F1A3290D for ; Tue, 03 Jun 2025 20:50:07 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1748983793.86b4553f5c38bc96b876ce625c7990e559f40885.sam@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: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 86b4553f5c38bc96b876ce625c7990e559f40885 X-VCS-Branch: master Date: Tue, 03 Jun 2025 20:50:07 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 3247caed-ac8f-4482-a940-f37e2e00c903 X-Archives-Hash: 3e57f14592ae2efae818eb085b8713b0 commit: 86b4553f5c38bc96b876ce625c7990e559f40885 Author: Kerin Millar plushkava net> AuthorDate: Tue Jun 3 20:12:15 2025 +0000 Commit: Sam James gentoo org> CommitDate: Tue Jun 3 20:49:53 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=86b4553f estrip: reliably detect missing tools Presently, estrip performs a PATH search for tools such as strip(1) and objcopy(1), yet only in the case of their CHOST-prefixed names. Should this initial PATH search fail, the tool will be presumed to exist by its non-prefixed name, without going so far as to check whether it actually does. Consider the following scenario. 1) the "type -P x86_64-pc-linux-gnu-dwz" command exits with 1 2) the tool is thus assumed to be available as "dwz" (without checking) Though I recently reworked the code, it was not I that introduced this bug. Rather, I inadvertently preserved it. However, now that I have identified it, I can certainly fix it. Do so by assigning nothing but the captured output of the type builtin as values of the 'path_of' map, irrespective of the name being searched for. Fixes: a67dc215adb52392505d03870c236e828dca3625 Signed-off-by: Kerin Millar plushkava.net> Signed-off-by: Sam James gentoo.org> bin/estrip | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bin/estrip b/bin/estrip index 1f4cfceb27..086c717a44 100755 --- a/bin/estrip +++ b/bin/estrip @@ -159,11 +159,10 @@ fi # Look up the tools we might be using declare -A path_of -for bin in strip objcopy readelf ranlib; do - if [[ $CHOST ]] && path_of[$bin]=$(type -P -- "${CHOST}-${bin}" 2>/dev/null); then - continue - fi - path_of[$bin]=$bin +for bin in {"${CHOST}-",}{'strip','objcopy','readelf','ranlib'}; do + if [[ ! ${path_of[$bin]} ]]; then + path_of[$bin]=$(type -P -- "${bin}" 2>/dev/null) + fi done # Declare a map to keep track of whether warnings in certain categories have