dblink._elog_process: handle newlines in messages
authorZac Medico <zmedico@gentoo.org>
Sun, 2 Oct 2011 19:52:57 +0000 (12:52 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 2 Oct 2011 19:52:57 +0000 (12:52 -0700)
This will fix bug #385341.

pym/portage/dbapi/vartree.py

index a4c54bd87472f436c3c18f4d78f3c1423052cbc0..50fa6f5ac45810ef8bd70dd6981798fba0b50d8a 100644 (file)
@@ -3125,9 +3125,12 @@ class dblink(object):
                                        if isinstance(lines, basestring):
                                                lines = [lines]
                                        for line in lines:
-                                               fields = (funcname, phase, cpv, line.rstrip('\n'))
-                                               str_buffer.append(' '.join(fields))
-                                               str_buffer.append('\n')
+                                               for line in line.split('\n'):
+                                                       if not line:
+                                                               continue
+                                                       fields = (funcname, phase, cpv, line)
+                                                       str_buffer.append(' '.join(fields))
+                                                       str_buffer.append('\n')
                        if str_buffer:
                                os.write(self._pipe, _unicode_encode(''.join(str_buffer)))