Skip to content

Commit 4eed63a

Browse files
basilclaude
andauthored
feat: Add support for Ubuntu/Debian apport .crash files (#102)
Parse apport crash files (Debian control syntax with base64-encoded gzip core dumps) as a coredump source. Text fields are mapped to COREDUMP_* fields and the CoreDump is extracted lazily via a streaming base64+gzip pipeline into a memfd. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b6f953b commit 4eed63a

8 files changed

Lines changed: 407 additions & 13 deletions

File tree

Cargo.lock

Lines changed: 49 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ categories = ["command-line-utilities", "development-tools::debugging"]
1414
uninlined_format_args = "warn"
1515

1616
[dependencies]
17+
base64 = "0.22"
1718
cpp_demangle = "0.5"
19+
flate2 = "1.1"
1820
foreign-types = "0.5"
1921
lexopt = "0.3"
2022
libc = "0.2"

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,12 @@ retrieved from the `systemd-coredump(8)` journal entry; use
307307
`coredumpctl list <name> -F COREDUMP_FILENAME` to find the path and pass it to
308308
any of these tools.
309309

310+
Ubuntu/Debian apport `.crash` files are also supported. These files use Debian
311+
control syntax with base64-encoded gzip core dumps. Text fields from the crash
312+
file are mapped to the corresponding `COREDUMP_*` fields and the core dump is
313+
extracted lazily on first access. Pass the `.crash` file path as the core
314+
operand to any of the tools listed above.
315+
310316
## Current State
311317

312318
The following table lists all Solaris/illumos ptools and their status in this

build.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ const CORE_OPERANDS: &[(&str, &str)] = &[
5454
("pid", "Process ID list."),
5555
(
5656
"core",
57-
"Process core file, as produced by systemd-coredump(8). The core file \
58-
does not need to exist on disk; if it has been removed, the \
57+
"Process core file, as produced by systemd-coredump(8), or an \
58+
Ubuntu/Debian apport .crash file. For systemd core files, the \
59+
file does not need to exist on disk; if it has been removed, the \
5960
corresponding systemd journal entry will be used instead. See \
6061
NOTES below.",
6162
),
@@ -69,7 +70,12 @@ const CORE_NOTES: &str = "When a core file has been removed by systemd-tmpfiles(
6970
longer exists on disk, and process metadata will be retrieved \
7071
from the journal entry instead. Use coredumpctl(1) to obtain \
7172
the path of a missing core file, e.g., \
72-
coredumpctl list <name> -F COREDUMP_FILENAME.";
73+
coredumpctl list <name> -F COREDUMP_FILENAME.\n\n\
74+
Ubuntu/Debian apport .crash files are also supported. These \
75+
files use Debian control syntax with base64-encoded gzip core \
76+
dumps. Text fields (such as ProcCmdline, ProcEnviron, and \
77+
ExecutablePath) are mapped to COREDUMP_* fields, and the core \
78+
dump is extracted on first access.";
7379

7480
fn build_date() -> String {
7581
let days = (SystemTime::now()
@@ -610,7 +616,10 @@ $ plgrp -a 0-2 101398
610616
"Process ID, optionally followed by a slash and a thread ID \
611617
to display a single thread.",
612618
),
613-
("core", "Process core file"),
619+
(
620+
"core",
621+
"Process core file, or an Ubuntu/Debian apport .crash file.",
622+
),
614623
],
615624
examples: &[],
616625
exit_status: DEFAULT_EXIT_STATUS,

0 commit comments

Comments
 (0)