From 60c7ca4030839a728a5975ee01e28c0330cf33ae Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 27 Sep 2011 09:46:02 -0700 Subject: merge: handle \r in file names for bug #384597 --- pym/portage/dbapi/vartree.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'pym') diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index f146adecd..a4c54bd87 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -3279,6 +3279,7 @@ class dblink(object): # the check must be repeated here for binary packages (it's # inexpensive since we call os.walk() here anyway). unicode_errors = [] + line_ending_re = re.compile('[\n\r]') while True: @@ -3330,7 +3331,7 @@ class dblink(object): relative_path = fpath[srcroot_len:] - if "\n" in relative_path: + if line_ending_re.search(relative_path) is not None: paths_with_newlines.append(relative_path) file_mode = os.lstat(fpath).st_mode @@ -3353,11 +3354,11 @@ class dblink(object): if paths_with_newlines: msg = [] - msg.append(_("This package installs one or more files containing a newline (\\n) character:")) + msg.append(_("This package installs one or more files containing line ending characters:")) msg.append("") paths_with_newlines.sort() for f in paths_with_newlines: - msg.append("\t/%s" % (f.replace("\n", "\\n"))) + msg.append("\t/%s" % (f.replace("\n", "\\n").replace("\r", "\\r"))) msg.append("") msg.append(_("package %s NOT merged") % self.mycpv) msg.append("") -- cgit v1.2.3-1-g7c22