Repository navigation
fix(extractinitrd): ignore broken pipe - #2750
Closed
aafeijoo-suse wants to merge 2 commits into
Closed
aafeijoo-suse wants to merge 2 commits into
aafeijoo-suse wants to merge 2 commits into
Conversation
When the consumer of the output ends before the write operation is complete, extractinitrd complains on stderr and exits with a non-zero code. Reproduced directly using the code from git main: ``` $ sudo dracutbasedir=. ./lsinitrd.sh | grep -q image dracut-extractinitrd: zstd failed ``` Here grep exits on its first match, which is the "Early CPIO image" line. lsinitrd then runs `dracut-extractinitrd --parts 2- --to-stdout` on the already closed stdout, cpio dies of SIGPIPE, the decompressor gets EPIPE, and `waitpid()` reports a child that did not exit normally. This issue was reintroduced after replacing skipcpio with extractinitrd; it was already fixed in aa0369a (Fedora's kdump.service has the default "IgnoreSIGPIPE=yes" and executes a bash script which calls `lsinitrd ... | ...` in several places).
aafeijoo-suse
force-pushed
the
extractinitrd-pipe-fix
branch
from
September 10, 2026 08:02
a3cc253 to
c312903
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Internal cpio failures can be misclassified as downstream broken pipes and incorrectly return success.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Updates extractinitrd to quietly handle downstream consumers closing output pipes.
Changes:
- Handles
EPIPEand childSIGPIPEconditions. - Adds broken-pipe tests across compression formats and signal dispositions.
File summaries
| File | Description |
|---|---|
src/extractinitrd/extractinitrd.c |
Adds broken-pipe handling for parent and child processes. |
test/TEST-83-EXTRACTINITRD/test.sh |
Tests early consumer termination without errors. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| ok = false; | ||
|
|
||
| return !ok; | ||
| return !ok && !broken_pipe; |
Contributor
Author
There was a problem hiding this comment.
Ok, the bot is right:
$ sudo ./dracut-extractinitrd /boot/initrd -- --fake-option
cpio: unrecognized option '--fake-option'
Try 'cpio --help' or 'cpio --usage' for more information.
$ echo $?
0
I guess this needs at least 2 flags to handle the exit status.
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.
When the consumer of the output ends before the write operation is complete, extractinitrd complains on stderr and exits with a non-zero code. Reproduced directly using the code from git main:
Here grep exits on its first match, which is the "Early CPIO image" line. lsinitrd then runs
extractinitrd --parts 2- --to-stdouton the already closed stdout, cpio dies of SIGPIPE, the decompressor gets EPIPE, andwaitpid()reports a child that did not exit normally.This issue was reintroduced after replacing skipcpio with extractinitrd; it was already fixed in aa0369a (Fedora's kdump.service has the default "IgnoreSIGPIPE=yes" and executes a bash script which calls
lsinitrd ... | ...in several places).Checklist