Skip to content

report: Collect open file descriptors in crash reports#555

Closed
basil wants to merge 1 commit intocanonical:mainfrom
basil:descriptor
Closed

report: Collect open file descriptors in crash reports#555
basil wants to merge 1 commit intocanonical:mainfrom
basil:descriptor

Conversation

@basil
Copy link
Copy Markdown
Contributor

@basil basil commented Mar 3, 2026

systemd-coredump(8) provides information about open file descriptors via COREDUMP_OPEN_FDS in the following format:

fd:/path/to/file
pos: ...
flags: ...
...

fd:/path/to/file
pos: ...
flags: ...
...

The first line contains the file descriptor number fd and the path, while subsequent lines show the contents of /proc/pid/fdinfo/fd. This can be very useful during postmortem debugging.

This PR implements the same feature for Apport. We read /proc/pid/fd and /proc/pid/fdinfo to populate a new OpenFds field with each file descriptor's target path and metadata. We also map COREDUMP_OPEN_FDS from systemd-coredump(8) into the same field.

Unit and integration tests have been updated to cover the new functionality, as well as the specification in doc/data-format.tex.

Fixes 2143109

CC @bdrung

@basil basil force-pushed the descriptor branch 2 times, most recently from 546108d to 4a498c9 Compare March 3, 2026 18:28
@basil
Copy link
Copy Markdown
Contributor Author

basil commented Mar 3, 2026

CLA checks, linter, and ruff are passing, as are unit and integration tests on all platforms. System tests timed out trying to reach https://api.launchpad.net/devel/ubuntu/ but this is a transient failure not caused by my changes.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 3, 2026

Codecov Report

❌ Patch coverage is 88.67925% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.41%. Comparing base (61ee6d6) to head (dd61751).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
apport/report.py 84.21% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #555      +/-   ##
==========================================
+ Coverage   84.40%   84.41%   +0.01%     
==========================================
  Files         104      104              
  Lines       20848    20901      +53     
  Branches     3259     3265       +6     
==========================================
+ Hits        17597    17644      +47     
- Misses       2813     2818       +5     
- Partials      438      439       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread doc/data-format.tex Outdated
Read /proc/pid/fd and /proc/pid/fdinfo to populate a new OpenFds field
with each file descriptor's target path and metadata. Also map
COREDUMP_OPEN_FDS from systemd-coredump into the same field.
@bdrung
Copy link
Copy Markdown
Member

bdrung commented Mar 25, 2026

Merged (added bug reference and signed commit)

@bdrung bdrung closed this Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants