summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/isolated-functions.sh2
-rw-r--r--pym/portage.py14
2 files changed, 12 insertions, 4 deletions
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 737c5dfb4..6bd33cb29 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -170,7 +170,7 @@ elog_base() {
return 1
;;
esac
- echo -e "${messagetype} $*" >> "${T}/logging/${EBUILD_PHASE:-other}"
+ echo -ne "${messagetype} $*\n\0" >> "${T}/logging/${EBUILD_PHASE:-other}"
return 0
}
diff --git a/pym/portage.py b/pym/portage.py
index ca3445548..8680c34df 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -535,16 +535,24 @@ def elog_process(cpv, mysettings):
mylogfiles.reverse()
all_logentries = {}
for msgfunction in mylogfiles:
+ filename = os.path.join(path, msgfunction)
if msgfunction not in portage_const.EBUILD_PHASES:
- writemsg("!!! can't process invalid log file: %s\n" % f,
+ writemsg("!!! can't process invalid log file: '%s'\n" % filename,
noiselevel=-1)
continue
if not msgfunction in all_logentries:
all_logentries[msgfunction] = []
lastmsgtype = None
msgcontent = []
- for l in open(os.path.join(path, msgfunction), "r").readlines():
- msgtype, msg = l.split(" ", 1)
+ for l in open(filename, "r").read().split("\0"):
+ if not l:
+ continue
+ try:
+ msgtype, msg = l.split(" ", 1)
+ except ValueError:
+ writemsg("!!! malformed entry in " + \
+ "log file: '%s'\n" % filename, noiselevel=-1)
+ continue
if lastmsgtype is None:
lastmsgtype = msgtype
if msgtype == lastmsgtype: