diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-04-29 06:37:29 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-04-29 06:37:29 +0000 |
commit | 9496d984684b67ca217d1afe82f1ffdaf447415d (patch) | |
tree | 9437e06fbda015ae4b54bc8764ff689b2022b426 | |
parent | b0e6865808f3bd0b31a27a710a0617679d83929f (diff) | |
download | portage-9496d984684b67ca217d1afe82f1ffdaf447415d.tar.gz portage-9496d984684b67ca217d1afe82f1ffdaf447415d.tar.bz2 portage-9496d984684b67ca217d1afe82f1ffdaf447415d.zip |
For bug #175058, avoid potential quoting issues by spawning FETCHCOMMAND without a shell. (trunk r6455:6456)
svn path=/main/branches/2.1.2/; revision=6457
-rw-r--r-- | cnf/make.globals | 4 | ||||
-rw-r--r-- | pym/portage.py | 15 |
2 files changed, 11 insertions, 8 deletions
diff --git a/cnf/make.globals b/cnf/make.globals index 51475f12a..45ffea680 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -29,8 +29,8 @@ RPMDIR=/usr/portage/rpm PORTAGE_TMPDIR=/var/tmp # Fetching command (5 tries, passive ftp for firewall compatibility) -FETCHCOMMAND="/usr/bin/wget -t 5 -T 60 --passive-ftp -P \\\"\${DISTDIR}\\\" \\\"\${URI}\\\"" -RESUMECOMMAND="/usr/bin/wget -c -t 5 -T 60 --passive-ftp -P \\\"\${DISTDIR}\\\" \\\"\${URI}\\\"" +FETCHCOMMAND="/usr/bin/wget -t 5 -T 60 --passive-ftp -P \${DISTDIR} \${URI}" +RESUMECOMMAND="/usr/bin/wget -c -t 5 -T 60 --passive-ftp -P \${DISTDIR} \${URI}" # Default user options FEATURES="sandbox distlocks metadata-transfer" diff --git a/pym/portage.py b/pym/portage.py index 92a2557b3..ceef30f70 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -2534,9 +2534,6 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", else: resumecommand=mysettings["RESUMECOMMAND"] - fetchcommand=fetchcommand.replace("${DISTDIR}",mysettings["DISTDIR"]) - resumecommand=resumecommand.replace("${DISTDIR}",mysettings["DISTDIR"]) - if not can_fetch: if fetched != 2: if fetched == 0: @@ -2566,8 +2563,14 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", locfetch=fetchcommand writemsg_stdout(">>> Downloading '%s'\n" % \ re.sub(r'//(.+):.+@(.+)/',r'//\1:*password*@\2/', loc)) - myfetch=locfetch.replace("${URI}",loc) - myfetch=myfetch.replace("${FILE}",myfile) + myfetch = locfetch.split() + variables = {"${DISTDIR}":mysettings["DISTDIR"], + "${URI}":loc, "${FILE}":myfile} + for i in xrange(len(myfetch)): + token = myfetch[i].strip("\"'") + value = variables.get(token) + if value is not None: + myfetch[i] = value spawn_keywords = {} if "userfetch" in mysettings.features and \ @@ -2585,7 +2588,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", con = con.replace(mysettings["PORTAGE_T"], mysettings["PORTAGE_FETCH_T"]) selinux.setexec(con) - myret = portage_exec.spawn_bash(myfetch, + myret = portage_exec.spawn(myfetch, env=mysettings.environ(), **spawn_keywords) if mysettings.selinux_enabled(): |