* [gentoo-portage-dev] [PATCH] dispatch_conf: use portage.os unicode wrapper (bug 545270)
@ 2015-04-01 22:28 Zac Medico
2015-04-01 22:43 ` [gentoo-portage-dev] [PATCH v2] dispatch_conf: use portage.os, shutil unicode wrappers " Zac Medico
2015-04-01 23:17 ` [gentoo-portage-dev] [PATCH v3] dispatch-conf: fix unicode handling " Zac Medico
0 siblings, 2 replies; 3+ messages in thread
From: Zac Medico @ 2015-04-01 22:28 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Zac Medico
This avoids UnicodeDecodeError problems by using UTF-8 encoding
regardless of the locale.
X-Gentoo-Bug: 545270
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=545270
---
pym/portage/dispatch_conf.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/pym/portage/dispatch_conf.py b/pym/portage/dispatch_conf.py
index 790eacb..df02bf2 100644
--- a/pym/portage/dispatch_conf.py
+++ b/pym/portage/dispatch_conf.py
@@ -10,7 +10,6 @@ from __future__ import print_function, unicode_literals
import io
import functools
-import os
import shutil
import stat
import subprocess
@@ -18,7 +17,7 @@ import sys
import tempfile
import portage
-from portage import _encodings
+from portage import _encodings, os
from portage.env.loaders import KeyValuePairFileLoader
from portage.localization import _
from portage.util import shlex_split, varexpand
--
2.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-portage-dev] [PATCH v2] dispatch_conf: use portage.os, shutil unicode wrappers (bug 545270)
2015-04-01 22:28 [gentoo-portage-dev] [PATCH] dispatch_conf: use portage.os unicode wrapper (bug 545270) Zac Medico
@ 2015-04-01 22:43 ` Zac Medico
2015-04-01 23:17 ` [gentoo-portage-dev] [PATCH v3] dispatch-conf: fix unicode handling " Zac Medico
1 sibling, 0 replies; 3+ messages in thread
From: Zac Medico @ 2015-04-01 22:43 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Zac Medico
This avoids UnicodeDecodeError problems by using UTF-8 encoding
regardless of the locale.
X-Gentoo-Bug: 545270
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=545270
---
[PATCH v2] adds portage.shutil to the imports
pym/portage/dispatch_conf.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/pym/portage/dispatch_conf.py b/pym/portage/dispatch_conf.py
index 790eacb..98939fd 100644
--- a/pym/portage/dispatch_conf.py
+++ b/pym/portage/dispatch_conf.py
@@ -10,15 +10,13 @@ from __future__ import print_function, unicode_literals
import io
import functools
-import os
-import shutil
import stat
import subprocess
import sys
import tempfile
import portage
-from portage import _encodings
+from portage import _encodings, os, shutil
from portage.env.loaders import KeyValuePairFileLoader
from portage.localization import _
from portage.util import shlex_split, varexpand
--
2.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-portage-dev] [PATCH v3] dispatch-conf: fix unicode handling (bug 545270)
2015-04-01 22:28 [gentoo-portage-dev] [PATCH] dispatch_conf: use portage.os unicode wrapper (bug 545270) Zac Medico
2015-04-01 22:43 ` [gentoo-portage-dev] [PATCH v2] dispatch_conf: use portage.os, shutil unicode wrappers " Zac Medico
@ 2015-04-01 23:17 ` Zac Medico
1 sibling, 0 replies; 3+ messages in thread
From: Zac Medico @ 2015-04-01 23:17 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Zac Medico
This avoids UnicodeDecodeError problems by using UTF-8 encoding
regardless of the locale.
X-Gentoo-Bug: 545270
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=545270
---
[PATCH v3] adds related fixes in bin/dispatch-conf
bin/dispatch-conf | 9 +++++----
pym/portage/dispatch_conf.py | 4 +---
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/bin/dispatch-conf b/bin/dispatch-conf
index b679910..678a66d 100755
--- a/bin/dispatch-conf
+++ b/bin/dispatch-conf
@@ -11,12 +11,11 @@
# dialog menus
#
-from __future__ import print_function
+from __future__ import print_function, unicode_literals
import atexit
import io
import re
-import shutil
import sys
from stat import ST_GID, ST_MODE, ST_UID
@@ -27,7 +26,7 @@ if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".porta
sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
portage._internal_caller = True
-from portage import os
+from portage import os, shutil
from portage import _encodings, _unicode_decode
from portage.dispatch_conf import diffstatusoutput, diff_mixed_wrapper
from portage.process import find_binary, spawn
@@ -403,7 +402,9 @@ class dispatch:
newconfigs.sort ()
for nconf in newconfigs:
- nconf = nconf.rstrip ()
+ # Use strict mode here, because we want to know if it fails,
+ # and portage only merges files with valid UTF-8 encoding.
+ nconf = _unicode_decode(nconf, errors='strict').rstrip()
conf = re.sub (r'\._cfg\d+_', '', nconf)
dirname = os.path.dirname(nconf)
conf_map = {
diff --git a/pym/portage/dispatch_conf.py b/pym/portage/dispatch_conf.py
index 790eacb..98939fd 100644
--- a/pym/portage/dispatch_conf.py
+++ b/pym/portage/dispatch_conf.py
@@ -10,15 +10,13 @@ from __future__ import print_function, unicode_literals
import io
import functools
-import os
-import shutil
import stat
import subprocess
import sys
import tempfile
import portage
-from portage import _encodings
+from portage import _encodings, os, shutil
from portage.env.loaders import KeyValuePairFileLoader
from portage.localization import _
from portage.util import shlex_split, varexpand
--
2.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-04-01 23:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-01 22:28 [gentoo-portage-dev] [PATCH] dispatch_conf: use portage.os unicode wrapper (bug 545270) Zac Medico
2015-04-01 22:43 ` [gentoo-portage-dev] [PATCH v2] dispatch_conf: use portage.os, shutil unicode wrappers " Zac Medico
2015-04-01 23:17 ` [gentoo-portage-dev] [PATCH v3] dispatch-conf: fix unicode handling " Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox