summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-09-27 09:46:02 -0700
committerZac Medico <zmedico@gentoo.org>2011-09-27 09:46:02 -0700
commit60c7ca4030839a728a5975ee01e28c0330cf33ae (patch)
treee84a308833f0ad01fc7d3ba48f641ccb0212bbb8
parentda782a6de61a3c0d9cd079c14d920852d2a4db9b (diff)
downloadportage-60c7ca4030839a728a5975ee01e28c0330cf33ae.tar.gz
portage-60c7ca4030839a728a5975ee01e28c0330cf33ae.tar.bz2
portage-60c7ca4030839a728a5975ee01e28c0330cf33ae.zip
merge: handle \r in file names for bug #384597
-rw-r--r--pym/portage/dbapi/vartree.py7
1 files changed, 4 insertions, 3 deletions
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("")