Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/
Date: Wed, 02 May 2012 19:56:04
Message-Id: 1335988531.15b98eb570a734c9505cb3b82674e7dc36c90b56.zmedico@gentoo
1 commit: 15b98eb570a734c9505cb3b82674e7dc36c90b56
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 2 19:55:31 2012 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Wed May 2 19:55:31 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=15b98eb5
7
8 dispatch-conf: use shlex to parse diff command
9
10 ---
11 pym/portage/dispatch_conf.py | 10 +++++++---
12 1 files changed, 7 insertions(+), 3 deletions(-)
13
14 diff --git a/pym/portage/dispatch_conf.py b/pym/portage/dispatch_conf.py
15 index c81153a..4c68dfc 100644
16 --- a/pym/portage/dispatch_conf.py
17 +++ b/pym/portage/dispatch_conf.py
18 @@ -13,7 +13,7 @@ import os, shutil, subprocess, sys
19 import portage
20 from portage.env.loaders import KeyValuePairFileLoader
21 from portage.localization import _
22 -from portage.util import varexpand
23 +from portage.util import shlex_split, varexpand
24
25 RCS_BRANCH = '1.1.1'
26 RCS_LOCK = 'rcs -ko -M -l'
27 @@ -30,8 +30,12 @@ def diffstatusoutput(cmd, file1, file2):
28 """
29 # Use Popen to emulate getstatusoutput(), since getstatusoutput() may
30 # raise a UnicodeDecodeError which makes the output inaccessible.
31 - proc = subprocess.Popen(cmd % (file1, file2),
32 - stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
33 + args = shlex_split(cmd % (file1, file2))
34 + if sys.hexversion < 0x3000000 or sys.hexversion >= 0x3020000:
35 + # Python 3.1 does not support bytes in Popen args.
36 + args = [portage._unicode_encode(x, errors='strict') for x in args]
37 + proc = subprocess.Popen(args,
38 + stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
39 output = portage._unicode_decode(proc.communicate()[0])
40 if output and output[-1] == "\n":
41 # getstatusoutput strips one newline