Decode directory names where appropriate in digestcheck(). Thanks to
authorZac Medico <zmedico@gentoo.org>
Thu, 24 Sep 2009 06:03:58 +0000 (06:03 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 24 Sep 2009 06:03:58 +0000 (06:03 -0000)
Arfrever for reporting.

svn path=/main/trunk/; revision=14399

pym/portage/__init__.py

index 8e6811ffddba7593939948422548896633349c3e..7909a403e94a51490241200721f851e27f64d63c 100644 (file)
@@ -5357,6 +5357,20 @@ def digestcheck(myfiles, mysettings, strict=0, justmanifest=0):
                                return 0
                        continue
                for d in dirs:
+                       try:
+                               d = _unicode_decode(d,
+                                       encoding=_encodings['fs'], errors='strict')
+                       except UnicodeDecodeError:
+                               d = _unicode_decode(d,
+                                       encoding=_encodings['fs'], errors='replace')
+                               writemsg(_("!!! Path contains invalid "
+                                       "character(s) for encoding '%s': '%s'") \
+                                       % (_encodings['fs'], os.path.join(parent, d)),
+                                       noiselevel=-1)
+                               if strict:
+                                       return 0
+                               dirs.remove(d)
+                               continue
                        if d.startswith(".") or d == "CVS":
                                dirs.remove(d)
                for f in files: