Now that elog_base() uses 'echo -e' to expand escape codes prior to using
authorZac Medico <zmedico@gentoo.org>
Tue, 30 Sep 2008 01:06:20 +0000 (01:06 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 30 Sep 2008 01:06:20 +0000 (01:06 -0000)
'read' to split on newlines, it's safe to use newlines as delimiters in
the log file since 'read' is guaranteed to split any newlines contained
in the arguments.

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

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

index 74692c8a713ab4f3d5651d25240e33b67326cd79..be8716be61b23d6244f6f59208acd9059f9f5ab0 100755 (executable)
@@ -170,12 +170,8 @@ 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.
        echo -e "$@" | while read line ; do
-               echo -ne "${messagetype} ${line}\n\0" >> \
+               echo "${messagetype} ${line}" >> \
                        "${T}/logging/${EBUILD_PHASE:-other}"
        done
        return 0
index de736664cd95ae44ae842b32d55fbe4f528e8a3c..707003122fcd28be5f303673d23d2895086d3241 100644 (file)
@@ -35,7 +35,7 @@ def collect_ebuild_messages(path):
                        logentries[msgfunction] = []
                lastmsgtype = None
                msgcontent = []
-               for l in open(filename, "r").read().split("\0"):
+               for l in open(filename, "rb"):
                        if not l:
                                continue
                        try: