public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: Zac Medico <zmedico@gentoo.org>
Subject: [gentoo-portage-dev] [PATCH] dispatch-conf: fix popen UnicodeDecode error (bug 576788)
Date: Sun, 13 Mar 2016 20:18:12 -0700	[thread overview]
Message-ID: <1457925492-28252-1-git-send-email-zmedico@gentoo.org> (raw)

X-Gentoo-Bug: 576788
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=576788
---
 bin/dispatch-conf | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/bin/dispatch-conf b/bin/dispatch-conf
index 678a66d..fdf564e 100755
--- a/bin/dispatch-conf
+++ b/bin/dispatch-conf
@@ -1,5 +1,5 @@
 #!/usr/bin/python -bO
-# Copyright 1999-2014 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 #
@@ -16,6 +16,7 @@ from __future__ import print_function, unicode_literals
 import atexit
 import io
 import re
+import subprocess
 import sys
 
 from stat import ST_GID, ST_MODE, ST_UID
@@ -137,9 +138,15 @@ class dispatch:
                 path, basename = os.path.split(path)
                 find_opts = "-maxdepth 1"
 
-            with os.popen(FIND_EXTANT_CONFIGS %
-                (path, find_opts, basename)) as proc:
-                confs += self.massage(proc.readlines())
+            try:
+                path_list = _unicode_decode(subprocess.check_output(
+                    portage.util.shlex_split(FIND_EXTANT_CONFIGS %
+                    (path, find_opts, basename))),
+                    errors='strict').splitlines()
+            except subprocess.CalledProcessError:
+                pass
+            else:
+                confs.extend(self.massage(path_list))
 
         if self.options['use-rcs'] == 'yes':
             for rcs_util in ("rcs", "ci", "co", "rcsmerge"):
-- 
2.7.2



             reply	other threads:[~2016-03-14  3:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-14  3:18 Zac Medico [this message]
2016-03-14 10:28 ` [gentoo-portage-dev] [PATCH] dispatch-conf: fix popen UnicodeDecode error (bug 576788) Alexander Berntsen
2016-03-14 17:18   ` Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1457925492-28252-1-git-send-email-zmedico@gentoo.org \
    --to=zmedico@gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox