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 35258158074 for ; Fri, 04 Jul 2025 02:19:06 +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) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 1DDE534209A for ; Fri, 04 Jul 2025 02:19:06 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 3646311028B; Fri, 04 Jul 2025 02:19:03 +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) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id 28A3D11028B for ; Fri, 04 Jul 2025 02:19:03 +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) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C01F2340D5A for ; Fri, 04 Jul 2025 02:19:02 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 2E3582AF9 for ; Fri, 04 Jul 2025 02:19:01 +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: <1751595420.a921d6ee5670778bcd0606ff29e41932312a50ea.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/emerge-webrsync X-VCS-Directories: bin/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: a921d6ee5670778bcd0606ff29e41932312a50ea X-VCS-Branch: master Date: Fri, 04 Jul 2025 02:19:01 +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: 7b6e7dc9-8e41-42ba-99ff-9639e4254e7f X-Archives-Hash: 432e6c446c1131a36b6f167fe66fac4f commit: a921d6ee5670778bcd0606ff29e41932312a50ea Author: Kerin Millar plushkava net> AuthorDate: Tue Jul 1 18:27:27 2025 +0000 Commit: Sam James gentoo org> CommitDate: Fri Jul 4 02:17:00 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=a921d6ee emerge-webrsync: avoid repeated PATH searches for md5(1) Presently, the md5sum_hex() function checks whether the md5(1) utility is available by using the hash builtin. Given the platforms currently supported by Gentoo, it is rather unlikely that it will be found, in which case the md5sum(1) utility shall be used instead. Under these circumstances, should the function be called again, so shall the hash builtin incur a PATH search again, for reasons twofold. Firstly, the cache of utility locations can only contain positive entries (found paths by utility name), not negative entries (unfound paths by utility name). Secondly, the function is called only from subshells, with their operating environments being lost upon exiting. Address this minor issue by declaring the function in advance. Consequently, a PATH search shall be performed no more than twice in the worst case; once to miss md5(1) and another to hit or miss md5sum(1). Reported-by: Sam James gentoo.org> Signed-off-by: Kerin Millar plushkava.net> Signed-off-by: Sam James gentoo.org> bin/emerge-webrsync | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync index e908a97cbc..e8a816efbb 100755 --- a/bin/emerge-webrsync +++ b/bin/emerge-webrsync @@ -243,16 +243,18 @@ check_file_digest() { fi } -md5sum_hex() { - local output - - if hash md5 2>/dev/null; then +if hash md5 2>/dev/null; then + md5sum_hex() { md5 -q -- "$1" - else + } +else + md5sum_hex() { + local output + output=$(md5sum -- "$1") \ && printf '%s\n' "${output%%[[:blank:]]*}" - fi -} + } +fi check_file_signature_gemato() { local file=$1