From: Zac Medico Date: Sat, 22 Aug 2009 19:05:32 +0000 (-0000) Subject: Bug #282306 - Inside dblink._security_check(), fall back to utf_8 encoding X-Git-Tag: v2.2_rc40~9 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f14d991ee04bfce34bcbb35f032afb463f6ab404;p=portage.git 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 --- 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: