summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-22 19:05:32 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-22 19:05:32 +0000
commitf14d991ee04bfce34bcbb35f032afb463f6ab404 (patch)
tree6c416127adbed43f2cbe501060487aa32dcbcd11
parent9832f811c7b731bfd2d965986cd5a058a9c6c92f (diff)
downloadportage-f14d991ee04bfce34bcbb35f032afb463f6ab404.tar.gz
portage-f14d991ee04bfce34bcbb35f032afb463f6ab404.tar.bz2
portage-f14d991ee04bfce34bcbb35f032afb463f6ab404.zip
Bug #282306 - Inside dblink._security_check(), fall back to utf_8 encoding
it a path cannot be encoded under the user's chosen encoding. svn path=/main/trunk/; revision=14125
-rw-r--r--pym/portage/dbapi/vartree.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index d73311bc0..aa74ed687 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -3136,6 +3136,22 @@ class dblink(object):
0 == i % self._file_merge_yield_interval:
scheduler.scheduleYield()
+ if os is _os_merge:
+ try:
+ _unicode_encode(path,
+ encoding=_encodings['merge'], errors='strict')
+ except UnicodeEncodeError:
+ # The package appears to have been merged with a
+ # different value of sys.getfilesystemencoding(),
+ # so fall back to utf_8 if appropriate.
+ try:
+ _unicode_encode(path,
+ encoding=_encodings['fs'], errors='strict')
+ except UnicodeEncodeError:
+ pass
+ else:
+ os = portage.os
+
try:
s = os.lstat(path)
except OSError, e: