commit:     a362242c8a4e9e44c17c3d284dd2dbfc14e59635
Author:     Daniel M. Weeks <dan <AT> danweeks <DOT> net>
AuthorDate: Wed Nov 11 17:27:15 2020 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 03:19:10 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a362242c

Fix varexpand, splitting in fetch

Performing variable expansion after splitting prevents expanding a
variable to an unquoted form:

Given VAR="a b c": "echo \${VAR}" produces ['echo', 'a b c']

It should be possible for a user to control quoting such that:

"echo \"\${VAR}\"" produces ['echo', 'a b c']
"echo \${VAR}" produces ['echo', 'a', 'b', 'c']

Reordering splitting and variable expansion fixes this and mirrors the
order used in _start_gpg_proc of ManifestTask.

Signed-off-by: Daniel M. Weeks <dan <AT> danweeks.net>
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/portage/package/ebuild/fetch.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/portage/package/ebuild/fetch.py 
b/lib/portage/package/ebuild/fetch.py
index ca031f31e..7be9d0239 100644
--- a/lib/portage/package/ebuild/fetch.py
+++ b/lib/portage/package/ebuild/fetch.py
@@ -1296,8 +1296,9 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0,
                                                if v is not None:
                                                        variables[k] = v
 
-                                       myfetch = shlex_split(locfetch)
-                                       myfetch = [varexpand(x, 
mydict=variables) for x in myfetch]
+                                       myfetch = varexpand(locfetch, 
mydict=variables)
+                                       myfetch = shlex_split(myfetch)
+
                                        myret = -1
                                        try:
 

Reply via email to