From: Zac Medico <zmedico@gentoo.org>
Date: Sun, 2 Oct 2011 19:52:57 +0000 (-0700)
Subject: dblink._elog_process: handle newlines in messages
X-Git-Tag: v2.2.0_alpha61~20
X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=37e01fd5095a40b6a57b1365add1c64f29671211;p=portage.git

dblink._elog_process: handle newlines in messages

This will fix bug #385341.
---

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index a4c54bd87..50fa6f5ac 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -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)))