[Yum-devel] [PATCH] non-ascii pw_name => cachedir => lockfile. BZ 832195

Zdeněk Pavlas zpavlas at redhat.com
Fri Jun 15 10:19:39 UTC 2012


Convert pw_name to unicode.  This turns cachedirs to unicode
which may feel bad, but Python seems to handle unicode paths
correctly (uses utf8 codec instead of ascii).

open('\xc4\x9b') and open(u'\u011b') opens the same file,
as expected.
---
 yum/misc.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/yum/misc.py b/yum/misc.py
index 968b5eb..a48a117 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -622,7 +622,7 @@ def getCacheDir(tmpdir='/var/tmp', reuse=True, prefix='yum-'):
     uid = os.geteuid()
     try:
         usertup = pwd.getpwuid(uid)
-        username = usertup[0]
+        username = to_unicode(usertup[0])
     except KeyError:
         return None # if it returns None then, well, it's bollocksed
 
-- 
1.7.4.4



More information about the Yum-devel mailing list