Merge ~sylvain-pineau/checkbox-ng:allow-gzip-trailing-garbage into checkbox-ng:master

Proposed by Sylvain Pineau
Status: Merged
Approved by: Sylvain Pineau
Approved revision: b18e56c26d3680365e6597a57051d54d27d9365c
Merged at revision: 71c8403c88cc6f42c2880cb39317b6825887c937
Proposed branch: ~sylvain-pineau/checkbox-ng:allow-gzip-trailing-garbage
Merge into: checkbox-ng:master
Diff against target: 16 lines (+4/-1)
1 file modified
plainbox/impl/result.py (+4/-1)
Reviewer Review Type Date Requested Status
Jonathan Cave (community) Approve
Review via email: mp+376989@code.launchpad.net

Description of the change

For unknown reasons, the record.gz files used to store job DiskResults can contain trailing garbage:

Betty encountered such issue and was unable to generate reports:

https://pastebin.ubuntu.com/p/HQ9TR2ZWPy/

The gzip archive was not actually corrupted since zcat was able to show the base64 content but it displayed a warning:

gzip: com.canonical.certification__stress_stress-ng-test-for-class-scheduler.record.gz: decompression OK, trailing garbage ignored

Actually there's a lot of issues reported against the gzip python module and currently there's no option to mimic a less strict mode as other gzip tools do (like gzip or zcat).

In such cases, our best option to continue processing results and finally create reports is simply to ignore such trailing garbage. This patch fixes our result.py module to allow this.

To post a comment you must log in.
Revision history for this message
Jonathan Cave (jocave) wrote :

Looks fine

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/plainbox/impl/result.py b/plainbox/impl/result.py
2index 3e0dea4..74fc1c0 100644
3--- a/plainbox/impl/result.py
4+++ b/plainbox/impl/result.py
5@@ -564,7 +564,10 @@ class IOLogRecordReader:
6 :returns: None if the stream is empty
7 :returns: next :class:`IOLogRecord` as found in the stream.
8 """
9- text = self.stream.readline()
10+ try:
11+ text = self.stream.readline()
12+ except OSError:
13+ return
14 if len(text) == 0:
15 return
16 data = json.loads(text)

Subscribers

People subscribed via source and target branches