From f14d991ee04bfce34bcbb35f032afb463f6ab404 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 22 Aug 2009 19:05:32 +0000 Subject: [PATCH] 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 --- pym/portage/dbapi/vartree.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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: -- 2.26.2