diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-09-25 14:56:05 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-09-25 14:56:05 -0700 |
commit | 03cbb6c1d2a08d478dfbe8235d5e4ed47c9574ab (patch) | |
tree | ed24be7e819a135879f6127389fbe59ef91abc01 | |
parent | f22d13e4ecfb472b0bfc20f19bd40c8fc4603f74 (diff) | |
download | portage-03cbb6c1d2a08d478dfbe8235d5e4ed47c9574ab.tar.gz portage-03cbb6c1d2a08d478dfbe8235d5e4ed47c9574ab.tar.bz2 portage-03cbb6c1d2a08d478dfbe8235d5e4ed47c9574ab.zip |
Fix varexpand() so that it doesn't do redundant quote removal that
is already handled by shlex.
This fixes a bug in getconfig() which caused it to remove backslash
characters it front of quote characters in cases where bash would
have preserved them when sourcing the same input.
-rw-r--r-- | pym/portage/util/__init__.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py index 9542826b2..8ba6b6c81 100644 --- a/pym/portage/util/__init__.py +++ b/pym/portage/util/__init__.py @@ -656,8 +656,14 @@ def varexpand(mystring, mydict=None): newstring=newstring+chr(0o11) elif a=='v': newstring=newstring+chr(0o13) + elif a in ('\'', '"'): + # Quote removal is handled by shlex. + newstring = newstring + mystring[pos-2:pos] + continue elif a!='\n': - #remove backslash only, as bash does: this takes care of \\ and \' and \" as well + # Remove backslash only, as bash does. This takes care + # of \\. Note that we don't handle quotes here since + # quote remoal is handled by shlex. newstring=newstring+mystring[pos-1:pos] continue elif (mystring[pos]=="$") and (mystring[pos-1]!="\\"): |