From: "Zac Medico (zmedico)" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] portage r14054 - main/trunk/pym/portage
Date: Fri, 14 Aug 2009 23:25:34 +0000 [thread overview]
Message-ID: <E1Mc69O-0004Uj-7e@stork.gentoo.org> (raw)
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:]
reply other threads:[~2009-08-14 23:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1Mc69O-0004Uj-7e@stork.gentoo.org \
--to=zmedico@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox