Even though the message is split on $'\n' in elog_base(), it's still
authorZac Medico <zmedico@gentoo.org>
Mon, 28 Jul 2008 19:48:00 +0000 (19:48 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 28 Jul 2008 19:48:00 +0000 (19:48 -0000)
not entirely safe to use it as a delimiter in the log file since
there can still be escaped newlines that will be expanded due to
the echo -e parameter.

svn path=/main/trunk/; revision=11244

bin/isolated-functions.sh
pym/portage/elog/messages.py

index e9ce37cdea7cdba32f9e97041eb2bb059a4ff8d3..56381ce8a866c3c820eeb879f51b6d71d339026c 100755 (executable)
@@ -170,10 +170,14 @@ elog_base() {
                        return 1
                        ;;
        esac
+       # Note: Even though the message is split on $'\n' here, it's still
+       # not entirely safe to use it as a delimiter in the log file since
+       # there can still be escaped newlines that will be expanded due to
+       # the echo -e parameter.
        save_IFS
        IFS=$'\n'
        for line in $* ; do
-               echo -ne "${messagetype} ${line}\n" >> \
+               echo -ne "${messagetype} ${line}\n\0" >> \
                        "${T}/logging/${EBUILD_PHASE:-other}"
        done
        restore_IFS
index 2b9f1b33794fc5b225de34df6e2dedfa32d26d18..de736664cd95ae44ae842b32d55fbe4f528e8a3c 100644 (file)
@@ -35,7 +35,7 @@ def collect_ebuild_messages(path):
                        logentries[msgfunction] = []
                lastmsgtype = None
                msgcontent = []
-               for l in open(filename, "r"):
+               for l in open(filename, "r").read().split("\0"):
                        if not l:
                                continue
                        try: