tags 642343 + patch tags 642343 + pending thanks Dear maintainer,
I've prepared an NMU for bootchart2 (versioned as 0.14.4-1.1) and uploaded it to DELAYED/2. Please feel free to tell me if I should delay it longer. The uploaded package includes these patches: * 0001-pybootchartgui-fix-parsing-of-non-ascii-bytes-in-log.patch * 0002-pybootchartgui-skip-malformed-taskstats-lines.patch * 0003-pybootchartgui-ensure-a-MemSample-is-valid-before-st.patch * 0004-pybootchartgui-be-more-tolerant-when-parsing-proc_me.patch Regards. Ulrich
diff -Nru bootchart2-0.14.4/debian/changelog bootchart2-0.14.4/debian/changelog --- bootchart2-0.14.4/debian/changelog 2012-06-07 22:25:14.000000000 +0100 +++ bootchart2-0.14.4/debian/changelog 2012-09-08 13:54:28.000000000 +0100 @@ -1,3 +1,14 @@ +bootchart2 (0.14.4-1.1) unstable; urgency=low + + * Non-maintainer upload. + * Apply patches supplied by upstream to fix RC bug (Closes: #642343) + - 0001-pybootchartgui-fix-parsing-of-non-ascii-bytes-in-log.patch + - 0002-pybootchartgui-skip-malformed-taskstats-lines.patch + - 0003-pybootchartgui-ensure-a-MemSample-is-valid-before-st.patch + - 0004-pybootchartgui-be-more-tolerant-when-parsing-proc_me.patch + + -- Jonathan McCrohan <[email protected]> Sat, 08 Sep 2012 13:54:28 +0100 + bootchart2 (0.14.4-1) unstable; urgency=low * New upstream version diff -Nru bootchart2-0.14.4/debian/patches/0001-pybootchartgui-fix-parsing-of-non-ascii-bytes-in-log.patch bootchart2-0.14.4/debian/patches/0001-pybootchartgui-fix-parsing-of-non-ascii-bytes-in-log.patch --- bootchart2-0.14.4/debian/patches/0001-pybootchartgui-fix-parsing-of-non-ascii-bytes-in-log.patch 1970-01-01 01:00:00.000000000 +0100 +++ bootchart2-0.14.4/debian/patches/0001-pybootchartgui-fix-parsing-of-non-ascii-bytes-in-log.patch 2012-09-08 13:49:47.000000000 +0100 @@ -0,0 +1,60 @@ +From 9a7ff9823ae8562e11094a5a7155af067733ae95 Mon Sep 17 00:00:00 2001 +From: Riccardo Magliocchetti <[email protected]> +Date: Sun, 17 Jun 2012 12:53:42 +0200 +Subject: [PATCH] pybootchartgui: fix parsing of non-ascii bytes in logs + +It looks like the days of ascii logs is gone so decode all the +files we read as utf-8. Fix #38. +--- + pybootchartgui/parsing.py | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +Index: bootchart2-0.14.4/pybootchartgui/parsing.py +=================================================================== +--- bootchart2-0.14.4.orig/pybootchartgui/parsing.py 2012-09-08 13:13:36.000000000 +0100 ++++ bootchart2-0.14.4/pybootchartgui/parsing.py 2012-09-08 13:13:36.000000000 +0100 +@@ -228,7 +228,7 @@ + value = line.strip() + headers[last] += value + return headers, last +- return reduce(parse, file.read().decode().split('\n'), (defaultdict(str),''))[0] ++ return reduce(parse, file.read().decode('utf-8').split('\n'), (defaultdict(str),''))[0] + + def _parse_timed_blocks(file): + """Parses (ie., splits) a file into so-called timed-blocks. A +@@ -242,7 +242,7 @@ + return (int(lines[0]), lines[1:]) + except ValueError: + raise ParseError("expected a timed-block, but timestamp '%s' is not an integer" % lines[0]) +- blocks = file.read().decode().split('\n\n') ++ blocks = file.read().decode('utf-8').split('\n\n') + return [parse(block) for block in blocks if block.strip() and not block.endswith(' not running\n')] + + def _parse_proc_ps_log(writer, file): +@@ -491,7 +491,7 @@ + processMap['k-boot'] = kernel + base_ts = False + max_ts = 0 +- for line in file.read().decode().split('\n'): ++ for line in file.read().decode('utf-8').split('\n'): + t = timestamp_re.match (line) + if t is None: + # print "duff timestamp " + line +@@ -579,7 +579,7 @@ + def _parse_paternity_log(writer, file): + parent_map = {} + parent_map[0] = 0 +- for line in file.read().decode().split('\n'): ++ for line in file.read().decode('utf-8').split('\n'): + elems = line.split(' ') # <Child> <Parent> + if len (elems) >= 2: + # print "paternity of %d is %d" % (int(elems[0]), int(elems[1])) +@@ -590,7 +590,7 @@ + + def _parse_cmdline_log(writer, file): + cmdLines = {} +- for block in file.read().decode().split('\n\n'): ++ for block in file.read().decode('utf-8').split('\n\n'): + lines = block.split('\n') + if len (lines) >= 3: + # print "Lines '%s'" % (lines[0]) diff -Nru bootchart2-0.14.4/debian/patches/0002-pybootchartgui-skip-malformed-taskstats-lines.patch bootchart2-0.14.4/debian/patches/0002-pybootchartgui-skip-malformed-taskstats-lines.patch --- bootchart2-0.14.4/debian/patches/0002-pybootchartgui-skip-malformed-taskstats-lines.patch 1970-01-01 01:00:00.000000000 +0100 +++ bootchart2-0.14.4/debian/patches/0002-pybootchartgui-skip-malformed-taskstats-lines.patch 2012-09-08 13:49:47.000000000 +0100 @@ -0,0 +1,21 @@ +From 77d7c35c9c03b21fdc8a1136e1d935965336ffa7 Mon Sep 17 00:00:00 2001 +From: Riccardo Magliocchetti <[email protected]> +Date: Sun, 17 Jun 2012 14:34:30 +0200 +Subject: [PATCH] pybootchartgui: skip malformed taskstats lines + +Partially fix #39 +--- + pybootchartgui/parsing.py | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/pybootchartgui/parsing.py ++++ b/pybootchartgui/parsing.py +@@ -315,6 +315,8 @@ + for line in lines: + if line is '': continue + tokens = line.split(' ') ++ if len(tokens) != 6: ++ continue + + opid, ppid, cmd = int(tokens[0]), int(tokens[1]), tokens[2] + try: diff -Nru bootchart2-0.14.4/debian/patches/0003-pybootchartgui-ensure-a-MemSample-is-valid-before-st.patch bootchart2-0.14.4/debian/patches/0003-pybootchartgui-ensure-a-MemSample-is-valid-before-st.patch --- bootchart2-0.14.4/debian/patches/0003-pybootchartgui-ensure-a-MemSample-is-valid-before-st.patch 1970-01-01 01:00:00.000000000 +0100 +++ bootchart2-0.14.4/debian/patches/0003-pybootchartgui-ensure-a-MemSample-is-valid-before-st.patch 2012-09-08 13:49:47.000000000 +0100 @@ -0,0 +1,59 @@ +From d39566348784eb80672f0d0bd78f0a839424281c Mon Sep 17 00:00:00 2001 +From: Riccardo Magliocchetti <[email protected]> +Date: Sun, 17 Jun 2012 14:50:05 +0200 +Subject: [PATCH] pybootchartgui: ensure a MemSample is valid before storing + it + +Fix #39 +--- + pybootchartgui/parsing.py | 6 +++--- + pybootchartgui/samples.py | 10 +++++++++- + 2 files changed, 12 insertions(+), 4 deletions(-) + +diff --git a/pybootchartgui/parsing.py b/pybootchartgui/parsing.py +index 778149b..18eb17c 100644 +--- a/pybootchartgui/parsing.py ++++ b/pybootchartgui/parsing.py +@@ -465,10 +465,10 @@ def _parse_proc_meminfo_log(file): + match = meminfo_re.match(line) + if not match: + raise ParseError("Invalid meminfo line \"%s\"" % match.groups(0)) +- if match.group(1) in used_values: +- sample.add_value(match.group(1), int(match.group(2))) ++ sample.add_value(match.group(1), int(match.group(2))) + +- mem_stats.append(sample) ++ if sample.valid(): ++ mem_stats.append(sample) + + return mem_stats + +diff --git a/pybootchartgui/samples.py b/pybootchartgui/samples.py +index ce703b8..a7da2ea 100644 +--- a/pybootchartgui/samples.py ++++ b/pybootchartgui/samples.py +@@ -38,12 +38,20 @@ class CPUSample: + str(self.sys) + "\t" + str(self.io) + "\t" + str (self.swap) + + class MemSample: ++ used_values = ('MemTotal', 'MemFree', 'Buffers', 'Cached', 'SwapTotal', 'SwapFree',) ++ + def __init__(self, time): + self.time = time + self.records = {} + + def add_value(self, name, value): +- self.records[name] = value ++ if name in MemSample.used_values: ++ self.records[name] = value ++ ++ def valid(self): ++ keys = self.records.keys() ++ # discard incomplete samples ++ return [v for v in MemSample.used_values if v not in keys] == [] + + class ProcessSample: + def __init__(self, time, state, cpu_sample): +-- +1.7.10.4 + diff -Nru bootchart2-0.14.4/debian/patches/0004-pybootchartgui-be-more-tolerant-when-parsing-proc_me.patch bootchart2-0.14.4/debian/patches/0004-pybootchartgui-be-more-tolerant-when-parsing-proc_me.patch --- bootchart2-0.14.4/debian/patches/0004-pybootchartgui-be-more-tolerant-when-parsing-proc_me.patch 1970-01-01 01:00:00.000000000 +0100 +++ bootchart2-0.14.4/debian/patches/0004-pybootchartgui-be-more-tolerant-when-parsing-proc_me.patch 2012-09-08 13:49:47.000000000 +0100 @@ -0,0 +1,53 @@ +From 62a80e0848bf3f5119a32bb82c7e141bd49d5e11 Mon Sep 17 00:00:00 2001 +From: Riccardo Magliocchetti <[email protected]> +Date: Fri, 17 Aug 2012 18:02:12 +0200 +Subject: [PATCH] pybootchartgui: be more tolerant when parsing + proc_meminfo.log + +waasdorp reports in bug #40 that we are raising an exception if +a line in proc_meminfo.log is not well formed. +He is right because we were trying to access matches of a regexp +that did not match. + +That is obviously silly but it is also silly to stop processing +all the data if a line is wrong, even a line that we are not +interested in it. Instead ignore the line and skip the sample +if it is not valid. + +Example of broken line: + +Shmem: + +While at it remove an unused variable +--- + pybootchartgui/parsing.py | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +diff --git a/pybootchartgui/parsing.py b/pybootchartgui/parsing.py +index 0c54884..845b3ae 100644 +--- a/pybootchartgui/parsing.py ++++ b/pybootchartgui/parsing.py +@@ -453,8 +453,6 @@ def _parse_proc_meminfo_log(file): + Parse file for global memory statistics. + The format of relevant lines should be: ^key: value( unit)? + """ +- used_values = ('MemTotal', 'MemFree', 'Buffers', 'Cached', 'SwapTotal', 'SwapFree',) +- + mem_stats = [] + meminfo_re = re.compile(r'([^ \t:]+):\s*(\d+).*') + +@@ -463,9 +461,8 @@ def _parse_proc_meminfo_log(file): + + for line in lines: + match = meminfo_re.match(line) +- if not match: +- raise ParseError("Invalid meminfo line \"%s\"" % match.groups(0)) +- sample.add_value(match.group(1), int(match.group(2))) ++ if match: ++ sample.add_value(match.group(1), int(match.group(2))) + + if sample.valid(): + mem_stats.append(sample) +-- +1.7.10.4 + diff -Nru bootchart2-0.14.4/debian/patches/series bootchart2-0.14.4/debian/patches/series --- bootchart2-0.14.4/debian/patches/series 2012-06-07 22:25:14.000000000 +0100 +++ bootchart2-0.14.4/debian/patches/series 2012-09-08 13:50:13.000000000 +0100 @@ -1 +1,5 @@ 00-fix_python_sitedir.patch +0001-pybootchartgui-fix-parsing-of-non-ascii-bytes-in-log.patch +0002-pybootchartgui-skip-malformed-taskstats-lines.patch +0003-pybootchartgui-ensure-a-MemSample-is-valid-before-st.patch +0004-pybootchartgui-be-more-tolerant-when-parsing-proc_me.patch

