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 13FCC15808A for ; Tue, 22 Jul 2025 22:26: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) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id F40FA341707 for ; Tue, 22 Jul 2025 22:26:42 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 88021110563; Tue, 22 Jul 2025 22:26:34 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 7EDAD110563 for ; Tue, 22 Jul 2025 22:26:34 +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 35930340F8F for ; Tue, 22 Jul 2025 22:26:34 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8BC9D329C for ; Tue, 22 Jul 2025 22:26:31 +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: <1753223140.03fca8121a03ef8b5f859a8aeef76b921a83ea15.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/phase-functions.sh X-VCS-Directories: bin/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 03fca8121a03ef8b5f859a8aeef76b921a83ea15 X-VCS-Branch: master Date: Tue, 22 Jul 2025 22:26:31 +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: f63a5895-6c60-4aad-a26c-19b3cebd2b58 X-Archives-Hash: d53e771283aba37b47c6f538e8250364 commit: 03fca8121a03ef8b5f859a8aeef76b921a83ea15 Author: Kerin Millar plushkava net> AuthorDate: Sun Jul 13 23:28:58 2025 +0000 Commit: Sam James gentoo org> CommitDate: Tue Jul 22 22:25:40 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=03fca812 phase-functions.sh: drop the {binpkg_untrusted,filtered_sandbox,misc_garbage}_vars variables As concerns the __filter_readonly_variables() function, it defines three local array variables whose elements undergo no modification after having been declared. - binpkg_untrusted_vars - filtered_sandbox_vars - misc_garbage_vars They do nothing whatsoever to improve the legibility of the function at large. Jettison these variables. Signed-off-by: Kerin Millar plushkava.net> Signed-off-by: Sam James gentoo.org> bin/phase-functions.sh | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh index d2de289996..74771edf52 100644 --- a/bin/phase-functions.sh +++ b/bin/phase-functions.sh @@ -87,7 +87,7 @@ portage_mutable_filtered_vars=( AA HOSTNAME ) # is to preserve various variables as they were at the time that the binary # package was built while protecting against the application of package renames. __filter_readonly_variables() { - local -a {binpkg_untrusted,filtered_sandbox,misc_garbage,bash}_vars + local -a filtered_vars bash_vars local IFS # Collect an initial list of special bash variables by instructing a @@ -115,20 +115,9 @@ __filter_readonly_variables() { # Exported functions bear this prefix. "BASH_FUNC_.*" ) - filtered_sandbox_vars=( - SANDBOX_DEBUG_LOG SANDBOX_DISABLED SANDBOX_ACTIVE - SANDBOX_BASHRC SANDBOX_LIB SANDBOX_LOG SANDBOX_ON - ) - # Untrusted due to possible application of package renames to binpkgs - binpkg_untrusted_vars=( - CATEGORY PVR PF PN PR PV P - ) - misc_garbage_vars=( - _portage_filter_opts - ) filtered_vars+=( "${portage_readonly_vars[@]}" - "${misc_garbage_vars[@]}" + _portage_filter_opts "${bash_vars[@]}" "___.*" ) @@ -155,7 +144,10 @@ __filter_readonly_variables() { if has --filter-sandbox "$@"; then filtered_vars+=( "SANDBOX_.*" ) else - filtered_vars+=( "${filtered_sandbox_vars[@]}" ) + filtered_vars+=( + SANDBOX_DEBUG_LOG SANDBOX_DISABLED SANDBOX_ACTIVE + SANDBOX_BASHRC SANDBOX_LIB SANDBOX_LOG SANDBOX_ON + ) fi if has --filter-features "$@"; then filtered_vars+=( FEATURES PORTAGE_FEATURES ) @@ -173,9 +165,11 @@ __filter_readonly_variables() { : elif [[ "${EMERGE_FROM}" = binary ]]; then # Preserve additional variables from build time, while - # excluding untrusted variables. - filtered_vars+=( "${binpkg_untrusted_vars[@]}" ) + # excluding some variables that are untrusted, due to the + # possible application of package renames to binpkgs. + filtered_vars+=( CATEGORY PVR PF PN PR PV P ) else + # Allow for the option to have its full effect. filtered_vars+=( "${portage_mutable_filtered_vars[@]}" "${portage_saved_readonly_vars[@]}"