Fix partial writes for coredumps larger than 2 GiB - #647
Open
bdrung wants to merge 1 commit into
Open
Conversation
Python's `os.write()` is a low-level POSIX call that directly maps to the `write(2)` system call. The `write(2)` man page says: > On Linux, write() (and similar system calls) will transfer at most > 0x7ffff000 (2,147,479,552) bytes, returning the number of bytes > actually transferred. Because `os.write()` does not handle looping, writing raw `bytes` coredumps larger than 2 GiB results in truncated files of exactly 0x7ffff000 bytes, which are then reported as corrupted by gdb. In `data/apport` loop over `os.write` until the whole coredump is written since that scripts operate on low level. In `apport.report` use `os.fdopen` to operate on a high-level file object to safely write all bytes. Bug: https://launchpad.net/bugs/2109979
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #647 +/- ##
==========================================
+ Coverage 84.48% 84.50% +0.01%
==========================================
Files 106 106
Lines 21044 21047 +3
Branches 3192 3194 +2
==========================================
+ Hits 17780 17786 +6
+ Misses 2790 2788 -2
+ Partials 474 473 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Python's
os.write()is a low-level POSIX call that directly maps to thewrite(2)system call. Thewrite(2)man page says:Because
os.write()does not handle looping, writing rawbytescoredumps larger than 2 GiB results in truncated files of exactly 0x7ffff000 bytes, which are then reported as corrupted by gdb.In
data/apportloop overos.writeuntil the whole coredump is written since that scripts operate on low level. Inapport.reportuseos.fdopento operate on a high-level file object to safely write all bytes.Bug: https://launchpad.net/bugs/2109979