commit:     59b81ecda599e9fbf4084e4595f1fa96c32a9fc1
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Aug  7 19:40:37 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 30 07:35:54 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=59b81ecd

80multilib-strict: use read to split QA_MULTILIB_PATHS

Rather than employ the combination of noglob and unquoted expansions to
convert QA_MULTILIB_PATHS to an array, have read handle it instead. This
addresses an instance of SC2086 which, owing to a recent commit in which
I localised IFS, no longer constitutes a legitimate bug. Still, I
elected to employ read because I do not trust other portage contributors
not to repeat the same mistake in the future. Consider it a case of
leading by example, if you will.

Further, check whether QA_MULTILIB_PATHS is an array by examining its
attributes. This requires bash-4.4 at the minimum. I discussed the
matter with Sam James prior and he consented to the use of its features.

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/install-qa-check.d/80multilib-strict | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/bin/install-qa-check.d/80multilib-strict 
b/bin/install-qa-check.d/80multilib-strict
index 9b687961b4..f88c2d22b7 100644
--- a/bin/install-qa-check.d/80multilib-strict
+++ b/bin/install-qa-check.d/80multilib-strict
@@ -17,12 +17,8 @@ multilib_strict_check() {
                done
 
                if [[ -s ${T}/multilib-strict.log ]] ; then
-                       if [[ ${#QA_MULTILIB_PATHS[@]} -eq 1 ]] ; then
-                               local shopts=$-
-                               set -o noglob
-                               QA_MULTILIB_PATHS=(${QA_MULTILIB_PATHS})
-                               set +o noglob
-                               set -${shopts}
+                       if [[ ${QA_MULTILIB_PATHS@a} != *a* ]] ; then
+                               read -rd '' -a QA_MULTILIB_PATHS 
<<<"${QA_MULTILIB_PATHS}"
                        fi
                        if [ "${QA_STRICT_MULTILIB_PATHS-unset}" = unset ] ; 
then
                                for dir in "${QA_MULTILIB_PATHS[@]}" ; do

Reply via email to