commit:     65bb6ae01f359d82be453bf01a9e8f49171d8436
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  6 04:05:11 2023 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Tue Jun  6 15:50:32 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=65bb6ae0

dosym: Prevent globbing of argument in dosym_canonicalize

Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 NEWS                     | 4 ++++
 bin/ebuild-helpers/dosym | 6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 8727e5623..09dd0675d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+Bug fixes:
+* dosym: Prevent globbing of argument in dosym_canonicalize().
+
 portage-3.0.48.1 (2023-06-06)
 ----------------
 
@@ -6,6 +9,7 @@ Bug fixes:
 
 portage-3.0.48 (2023-06-01)
 --------------
+
 Breaking changes:
 * Output deprecation warnings for portageq, prepstrip and prepallstrip
   when they are called from an ebuild (bug #906129, bug #906156).

diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym
index e41558a15..9ed27b8ce 100755
--- a/bin/ebuild-helpers/dosym
+++ b/bin/ebuild-helpers/dosym
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
@@ -33,7 +33,7 @@ if [[ ${option_r} ]]; then
        dosym_canonicalize() {
                local path slash i prev out IFS=/
 
-               path=( ${1} )
+               read -r -d '' -a path <<< "${1}"
                [[ ${1} == /* ]] && slash=/
 
                while true; do
@@ -41,7 +41,7 @@ if [[ ${option_r} ]]; then
                        # or as a special case, "/.." at the beginning of the 
path.
                        # Also drop empty and "." path components as we go 
along.
                        prev=
-                       for i in ${!path[@]}; do
+                       for i in "${!path[@]}"; do
                                if [[ -z ${path[i]} || ${path[i]} == . ]]; then
                                        unset "path[i]"
                                elif [[ ${path[i]} != .. ]]; then

Reply via email to