collect_ebuild_messages: handle \r, bug #390833
authorZac Medico <zmedico@gentoo.org>
Fri, 18 Nov 2011 18:20:21 +0000 (10:20 -0800)
committerZac Medico <zmedico@gentoo.org>
Fri, 18 Nov 2011 18:20:21 +0000 (10:20 -0800)
pym/portage/elog/messages.py

index ba2ed466bb38d620469b27b691b67c2c6e85e104..a4897d8d81f6111ca94e43090385c71ba7f8096b 100644 (file)
@@ -54,8 +54,9 @@ def collect_ebuild_messages(path):
                f = io.open(_unicode_encode(filename,
                        encoding=_encodings['fs'], errors='strict'),
                        mode='r', encoding=_encodings['repo.content'], errors='replace')
-               for l in f:
-                       l = l.rstrip('\n')
+               # Use split('\n') since normal line iteration or readlines() will
+               # split on \r characters as shown in bug #390833.
+               for l in f.read().split('\n'):
                        if not l:
                                continue
                        try: