diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-05-02 12:55:31 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-05-02 12:55:31 -0700 |
commit | 15b98eb570a734c9505cb3b82674e7dc36c90b56 (patch) | |
tree | c4186a33f705f50f4fc7825d89c94dd3fcdd76dc | |
parent | 09bdb69ac31146cbb3f258118a1aea0744b96379 (diff) | |
download | portage-15b98eb570a734c9505cb3b82674e7dc36c90b56.tar.gz portage-15b98eb570a734c9505cb3b82674e7dc36c90b56.tar.bz2 portage-15b98eb570a734c9505cb3b82674e7dc36c90b56.zip |
dispatch-conf: use shlex to parse diff command
-rw-r--r-- | pym/portage/dispatch_conf.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/pym/portage/dispatch_conf.py b/pym/portage/dispatch_conf.py index c81153ae1..4c68dfc7b 100644 --- a/pym/portage/dispatch_conf.py +++ b/pym/portage/dispatch_conf.py @@ -13,7 +13,7 @@ import os, shutil, subprocess, sys import portage from portage.env.loaders import KeyValuePairFileLoader from portage.localization import _ -from portage.util import varexpand +from portage.util import shlex_split, varexpand RCS_BRANCH = '1.1.1' RCS_LOCK = 'rcs -ko -M -l' @@ -30,8 +30,12 @@ def diffstatusoutput(cmd, file1, file2): """ # Use Popen to emulate getstatusoutput(), since getstatusoutput() may # raise a UnicodeDecodeError which makes the output inaccessible. - proc = subprocess.Popen(cmd % (file1, file2), - stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) + args = shlex_split(cmd % (file1, file2)) + if sys.hexversion < 0x3000000 or sys.hexversion >= 0x3020000: + # Python 3.1 does not support bytes in Popen args. + args = [portage._unicode_encode(x, errors='strict') for x in args] + proc = subprocess.Popen(args, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) output = portage._unicode_decode(proc.communicate()[0]) if output and output[-1] == "\n": # getstatusoutput strips one newline |