commit:     9ad0546772b87df7bcf7ec3c3727e80dc129078f
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Jun 26 05:32:58 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun 28 02:30:18 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=9ad05467

phase-functions.sh: use ${param@a} expansion to test for arrays

Presently, the __dyn_install() function loops over five variable names,
testing whether each has been declared as an indexed array, parsing the
output of declare -p in order to do so. Instead, use the ${param@a} form
of expansion. Doing so is acceptable, given a target of >=bash-4.4.

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

 bin/phase-functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index 4f865fdc87..cbf1e87539 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -567,7 +567,7 @@ __dyn_install() {
                # fnmatch patterns to regular expressions
                for x in QA_DT_NEEDED QA_FLAGS_IGNORED QA_PRESTRIPPED \
                        QA_SONAME QA_SONAME_NO_SYMLINK; do
-                       if [[ $(declare -p ${x} 2>/dev/null) = declare\ -a* ]] 
; then
+                       if [[ ${!x@a} == *a* ]]; then
                                eval "${x}=(\"\${${x}[@]}\" 
${QA_PREBUILT//\*/.*})"
                        else
                                eval "${x}+=\" ${QA_PREBUILT//\*/.*}\""

Reply via email to