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 E972D158046 for ; Tue, 14 Oct 2025 12:59:39 +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 CECDE340FE4 for ; Tue, 14 Oct 2025 12:59:39 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 0DA061104A0; Tue, 14 Oct 2025 12:59:35 +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 05D381104A0 for ; Tue, 14 Oct 2025 12:59:35 +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 AF8D5340EAD for ; Tue, 14 Oct 2025 12:59:34 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 23FCB3ADD for ; Tue, 14 Oct 2025 12:59:33 +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: <1760446749.51d23a2686196ff7562b7b506124097674fcd2ac.sam@gentoo> Subject: [gentoo-commits] proj/gentoo-functions:master commit in: functions/, / X-VCS-Repository: proj/gentoo-functions X-VCS-Files: functions.sh functions/experimental.sh X-VCS-Directories: functions/ / X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 51d23a2686196ff7562b7b506124097674fcd2ac X-VCS-Branch: master Date: Tue, 14 Oct 2025 12:59:33 +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: 903cefcb-9a18-44d0-9b91-bc24fe88724c X-Archives-Hash: 1e8d174088105711e21556bc2a8e0fe3 commit: 51d23a2686196ff7562b7b506124097674fcd2ac Author: Kerin Millar plushkava net> AuthorDate: Tue Oct 14 06:17:02 2025 +0000 Commit: Sam James gentoo org> CommitDate: Tue Oct 14 12:59:09 2025 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=51d23a26 Refrain from negating the break builtin Presently, there are two instances in which "! break" is used to break a loop, with the expectation that the resulting status be non-zero. That is, given that the exit status of break is 0, the act of negating it is supposed to produce a status of 1. Unfortunately, the various sh(1) implementations cannot be relied upon to behave in this manner. $ bash -c 'for x in 1; do ! break; done; echo "$?"' 1 $ dash -c 'for x in 1; do ! break; done; echo "$?"' 0 Address this issue by using return instead. Link: https://www.mail-archive.com/austin-group-l opengroup.org/msg12302.html Signed-off-by: Kerin Millar plushkava.net> Signed-off-by: Sam James gentoo.org> functions.sh | 6 +++--- functions/experimental.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/functions.sh b/functions.sh index cff6f5a..771a7bc 100644 --- a/functions.sh +++ b/functions.sh @@ -1068,8 +1068,8 @@ fi for _ in "${genfun_basedir}/functions"/*.sh; do if ! test -e "$_"; then warn "no gentoo-functions modules were found (genfun_basedir might be set incorrectly)" - ! break + false elif _want_module "$_"; then - . "$_" || return - fi + . "$_" + fi || return done diff --git a/functions/experimental.sh b/functions/experimental.sh index 7c2fb25..d3e2e3a 100644 --- a/functions/experimental.sh +++ b/functions/experimental.sh @@ -172,7 +172,7 @@ str_between() printf '%s\n' "$@" | sort | while IFS= read -r line; do - eval "[ \"\${line}\" = \"\$$(( i += 1 ))\" ]" || ! break + eval "[ \"\${line}\" = \"\$$(( i += 1 ))\" ]" || return done fi }