Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] dispatch-conf: fix popen UnicodeDecode error (bug 576788)
Date: Mon, 14 Mar 2016 03:18:45
Message-Id: 1457925492-28252-1-git-send-email-zmedico@gentoo.org
1 X-Gentoo-Bug: 576788
2 X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=576788
3 ---
4 bin/dispatch-conf | 15 +++++++++++----
5 1 file changed, 11 insertions(+), 4 deletions(-)
6
7 diff --git a/bin/dispatch-conf b/bin/dispatch-conf
8 index 678a66d..fdf564e 100755
9 --- a/bin/dispatch-conf
10 +++ b/bin/dispatch-conf
11 @@ -1,5 +1,5 @@
12 #!/usr/bin/python -bO
13 -# Copyright 1999-2014 Gentoo Foundation
14 +# Copyright 1999-2016 Gentoo Foundation
15 # Distributed under the terms of the GNU General Public License v2
16
17 #
18 @@ -16,6 +16,7 @@ from __future__ import print_function, unicode_literals
19 import atexit
20 import io
21 import re
22 +import subprocess
23 import sys
24
25 from stat import ST_GID, ST_MODE, ST_UID
26 @@ -137,9 +138,15 @@ class dispatch:
27 path, basename = os.path.split(path)
28 find_opts = "-maxdepth 1"
29
30 - with os.popen(FIND_EXTANT_CONFIGS %
31 - (path, find_opts, basename)) as proc:
32 - confs += self.massage(proc.readlines())
33 + try:
34 + path_list = _unicode_decode(subprocess.check_output(
35 + portage.util.shlex_split(FIND_EXTANT_CONFIGS %
36 + (path, find_opts, basename))),
37 + errors='strict').splitlines()
38 + except subprocess.CalledProcessError:
39 + pass
40 + else:
41 + confs.extend(self.massage(path_list))
42
43 if self.options['use-rcs'] == 'yes':
44 for rcs_util in ("rcs", "ci", "co", "rcsmerge"):
45 --
46 2.7.2

Replies