* [gentoo-commits] portage r14054 - main/trunk/pym/portage
@ 2009-08-14 23:25 Zac Medico (zmedico)
0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2009-08-14 23:25 UTC (permalink / raw
To: gentoo-commits
Author: zmedico
Date: 2009-08-14 23:25:33 +0000 (Fri, 14 Aug 2009)
New Revision: 14054
Modified:
main/trunk/pym/portage/__init__.py
Log:
Handle UnicodeDecodeError for os.walk() inside digestcheck().
Modified: main/trunk/pym/portage/__init__.py
===================================================================
--- main/trunk/pym/portage/__init__.py 2009-08-14 23:04:05 UTC (rev 14053)
+++ main/trunk/pym/portage/__init__.py 2009-08-14 23:25:33 UTC (rev 14054)
@@ -5293,12 +5293,37 @@
filesdir = os.path.join(pkgdir, "files")
for parent, dirs, files in os.walk(filesdir):
- parent = _unicode_decode(parent)
+ try:
+ parent = _unicode_decode(parent,
+ encoding=_fs_encoding, errors='strict')
+ except UnicodeDecodeError:
+ parent = _unicode_decode(parent,
+ encoding=_fs_encoding, errors='replace')
+ writemsg("!!! Path contains invalid " + \
+ "character(s) for encoding '%s': '%s'" \
+ % (_fs_encoding, parent), noiselevel=-1)
+ if strict:
+ return 0
+ continue
for d in dirs:
if d.startswith(".") or d == "CVS":
dirs.remove(d)
for f in files:
- f = _unicode_decode(f)
+ try:
+ f = _unicode_decode(f,
+ encoding=_fs_encoding, errors='strict')
+ except UnicodeDecodeError:
+ f = _unicode_decode(f,
+ encoding=_fs_encoding, errors='replace')
+ if f.startswith("."):
+ continue
+ f = os.path.join(parent, f)[len(filesdir) + 1:]
+ writemsg("!!! File name contains invalid " + \
+ "character(s) for encoding '%s': '%s'" \
+ % (_fs_encoding, f), noiselevel=-1)
+ if strict:
+ return 0
+ continue
if f.startswith("."):
continue
f = os.path.join(parent, f)[len(filesdir) + 1:]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-08-14 23:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-14 23:25 [gentoo-commits] portage r14054 - main/trunk/pym/portage Zac Medico (zmedico)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox