Merge lp:~bdrung/apport/lp-1684535 into lp:apport

Proposed by Benjamin Drung
Status: Needs review
Proposed branch: lp:~bdrung/apport/lp-1684535
Merge into: lp:apport
Diff against target: 38 lines (+17/-0)
2 files modified
apport/report.py (+8/-0)
problem_report.py (+9/-0)
To merge this branch: bzr merge lp:~bdrung/apport/lp-1684535
Reviewer Review Type Date Requested Status
Apport upstream developers Pending
Review via email: mp+389620@code.launchpad.net

Description of the change

Support specifying a CoreDumpFile in the .crash file instead of requiring it to be included in the file.

Motivation: We transfer the core dump via network with lz4 compression. See Debian bug #857300 [1] for the collecting script.

[1] https://bugs.debian.org/857300

To post a comment you must log in.

Unmerged revisions

3283. By Benjamin Drung on 2020-08-20

Support lz4 compressed core dump files

LP: #1684535

3282. By Benjamin Drung on 2020-08-20

Support CoreDumpFile

Support specifying a core dump file instead of attaching it to the
.crash file.

LP: #1684535

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'apport/report.py'
2--- apport/report.py 2020-06-09 21:41:57 +0000
3+++ apport/report.py 2020-08-20 16:56:23 +0000
4@@ -1623,6 +1623,14 @@
5 else:
6 # value is a file path
7 core = self['CoreDump'][0]
8+ if core.endswith(".lz4"):
9+ compressed_core = core
10+ (fd, core) = tempfile.mkstemp(prefix="apport_core_")
11+ atexit.register(os.unlink, core)
12+ subprocess.check_call(
13+ ["lz4", "--decompress", "--to-stdout", compressed_core], stdout=fd
14+ )
15+ os.close(fd)
16
17 command += ['--ex', 'core-file ' + core]
18
19
20=== modified file 'problem_report.py'
21--- problem_report.py 2019-05-20 18:54:29 +0000
22+++ problem_report.py 2020-08-20 16:56:23 +0000
23@@ -204,6 +204,15 @@
24 if key is not None:
25 self.data[key] = self._try_unicode(value)
26
27+ if "CoreDumpFile" in self.data:
28+ coredumpfile = self.data.pop("CoreDumpFile")
29+ if not coredumpfile.startswith("/"):
30+ # Sanitize path (assumed it to be relative to the .crash file)
31+ coredumpfile = os.path.join(
32+ os.path.dirname(os.path.abspath(file.name)), coredumpfile
33+ )
34+ self.data["CoreDump"] = (coredumpfile,)
35+
36 self.old_keys = set(self.data.keys())
37
38 def extract_keys(self, file, bin_keys, dir):

Subscribers

People subscribed via source and target branches