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 CFF961580EB for ; Fri, 30 May 2025 08:14:43 +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 B76363430ED for ; Fri, 30 May 2025 08:14:43 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 4C0FF11049F; Fri, 30 May 2025 08:14: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 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id 3F69711049F for ; Fri, 30 May 2025 08:14: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 EAAB1342F99 for ; Fri, 30 May 2025 08:14:34 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 58E2A28EE for ; Fri, 30 May 2025 08:14: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: <1748592859.e61b3bc230db0bfa2e7ca4c72915ac5154bf73cd.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: e61b3bc230db0bfa2e7ca4c72915ac5154bf73cd X-VCS-Branch: master Date: Fri, 30 May 2025 08:14: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: 6eb593a1-b6c2-4e69-923c-d06083dfe02a X-Archives-Hash: a9a82a9706ea00aeb27cc150d4294fe0 commit: e61b3bc230db0bfa2e7ca4c72915ac5154bf73cd Author: Kerin Millar plushkava net> AuthorDate: Sat Jul 27 19:55:48 2024 +0000 Commit: Sam James gentoo org> CommitDate: Fri May 30 08:14:19 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=e61b3bc2 phase-helpers.sh: use $# to check the argument count in unpack() Because that is the proper way to do it. [[ -z "$*" ]] is simply nonsense. If the intention was to defend against empty arguments then it does no such thing; such a check would be easily circumvented by specifying at least two arguments, be they empty or not. It is also sensitive to the value of IFS. Besides, if the empty string is encountered then unpacking will fail anyway. In that event, so be it. Render the diagnostic message indicating commencement of unpacking more useful by expanding the filename with ${param@Q} expansion. Such is acceptable, given a target of bash 4.4. Signed-off-by: Kerin Millar plushkava.net> Signed-off-by: Sam James gentoo.org> bin/phase-helpers.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh index 41175886dd..ec3316c176 100644 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@ -333,7 +333,9 @@ unpack() { local suffix local f - [[ -z "$*" ]] && die "Nothing passed to the 'unpack' command" + if (( $# == 0 )); then + die "unpack: too few arguments (got 0; expected at least 1)" + fi __unpack_tar() { local inner_suffix @@ -396,13 +398,13 @@ unpack() { fi if [[ -n ${suffix_known} ]]; then - __vecho ">>> Unpacking ${f} to ${PWD}" + __vecho ">>> Unpacking ${f@Q} to ${PWD}" else - __vecho "=== Skipping unpack of ${f}" + __vecho "=== Skipping unpack of ${f@Q}" continue fi - myfail="unpack: failure unpacking ${f}" + myfail="unpack: failure unpacking ${f@Q}" case ${suffix,,} in tar) tar xof "${srcdir}${f}" || die "${myfail}"