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 87CA61580E0 for ; Sun, 01 Jun 2025 21:47:47 +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 724E8343095 for ; Sun, 01 Jun 2025 21:47:47 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 8BCD41102CD; Sun, 01 Jun 2025 21:47:43 +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 8632411027C for ; Sun, 01 Jun 2025 21:47:43 +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 34E4B343095 for ; Sun, 01 Jun 2025 21:47:43 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id CDDF91EC7 for ; Sun, 01 Jun 2025 21:47:41 +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: <1748814119.856d5481d8da8b0f6945812cdf6aa4f1119a0c9e.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/phase-helpers.sh X-VCS-Directories: bin/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 856d5481d8da8b0f6945812cdf6aa4f1119a0c9e X-VCS-Branch: master Date: Sun, 01 Jun 2025 21:47:41 +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: bf146d27-37df-4f7b-a125-5c00525e761e X-Archives-Hash: 303cd9524712e93327d94148bb3b8ad4 commit: 856d5481d8da8b0f6945812cdf6aa4f1119a0c9e Author: Kerin Millar plushkava net> AuthorDate: Fri May 30 03:53:55 2025 +0000 Commit: Sam James gentoo org> CommitDate: Sun Jun 1 21:41:59 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=856d5481 phase-helpers.sh: use hash to gauge gfind(1) availability Presently, the eapply() function uses the type builtin to determine whether gfind(1) is present in PATH. To do so is questionable. While type -P does coerce bash into performing a PATH search, the manner in which gfind is invoked still permits for it to be a function - even an alias in the case that the expand_aliases option is enabled. Instead, use the hash builtin to determine whether gfind is available as a command. This has the advantage of pre-warming the cache that the shell employs for Command Search and Execution. Signed-off-by: Kerin Millar plushkava.net> Signed-off-by: Sam James gentoo.org> bin/phase-helpers.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh index 365d072317..bef0abbcc9 100644 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@ -981,13 +981,6 @@ if ___eapi_has_eapply; then local f failed patch_cmd path local -a files operands options - # for bsd userland support, use gpatch if available - if type -P gpatch >/dev/null; then - patch_cmd=gpatch - else - patch_cmd=patch - fi - _eapply_get_files() { local LC_ALL=POSIX f @@ -1045,6 +1038,11 @@ if ___eapi_has_eapply; then if (( ! ${#operands[@]} )); then die "eapply: no operands were specified" + elif hash gpatch 2>/dev/null; then + # for bsd userland support, use gpatch if available + patch_cmd=gpatch + else + patch_cmd=patch fi for path in "${operands[@]}"; do