egencache: encode unicode file paths safely
authorZac Medico <zmedico@gentoo.org>
Wed, 12 Sep 2012 04:52:33 +0000 (21:52 -0700)
committerZac Medico <zmedico@gentoo.org>
Wed, 12 Sep 2012 04:52:33 +0000 (21:52 -0700)
This will fix cases similar to the one fixed in commit
f01d7a8ca158ec60df76a3e8ae5b80ac3f62429e for bug #310789.

bin/egencache

index f7b447130c5e0022506d15532746acecd1992872..00356745250d0d62ce9e134e152d59eb0e554947 100755 (executable)
@@ -541,7 +541,8 @@ class GenUseLocalDesc(object):
                for cp in self._portdb.cp_all():
                        metadata_path = os.path.join(repo_path, cp, 'metadata.xml')
                        try:
-                               metadata = ElementTree.parse(metadata_path,
+                               metadata = ElementTree.parse(_unicode_encode(metadata_path,
+                                       encoding=_encodings['fs'], errors='strict'),
                                        parser=ElementTree.XMLParser(
                                        target=_MetadataTreeBuilder()))
                        except IOError: