From 5614fa2d7cef0b509136fd00c52a8436d41a3647 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 11 Sep 2012 21:56:39 -0700 Subject: [PATCH] make_herd_base: encode unicode file paths safely This will fix cases similar to the one fixed in commit f01d7a8ca158ec60df76a3e8ae5b80ac3f62429e for bug #310789. --- pym/repoman/herdbase.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pym/repoman/herdbase.py b/pym/repoman/herdbase.py index fcf58b36c..4c420d0ec 100644 --- a/pym/repoman/herdbase.py +++ b/pym/repoman/herdbase.py @@ -17,6 +17,8 @@ except (ImportError, SystemError, RuntimeError, Exception): # modules, so that ImportModulesTestCase can succeed (or # possibly alert us about unexpected import failures). pass + +from portage import _encodings, _unicode_encode from portage.exception import FileNotFound, ParseError, PermissionDenied __all__ = [ @@ -56,7 +58,8 @@ def make_herd_base(filename): all_emails = set() try: - xml_tree = xml.etree.ElementTree.parse(filename, + xml_tree = xml.etree.ElementTree.parse(_unicode_encode(filename, + encoding=_encodings['fs'], errors='strict'), parser=xml.etree.ElementTree.XMLParser( target=_HerdsTreeBuilder())) except ExpatError as e: -- 2.26.2