runcon: report a stdout write error instead of panicking#13380
Open
leeewee wants to merge 1 commit into
Open
Conversation
|
GNU testsuite comparison: |
xtqqczze
reviewed
Jul 14, 2026
| source: io::Error, | ||
| }, | ||
|
|
||
| #[error("{}", translate!("runcon-error-write-error", "error" => .0))] |
Contributor
There was a problem hiding this comment.
Suggested change
| #[error("{}", translate!("runcon-error-write-error", "error" => .0))] | |
| #[error("{}", translate!("runcon-error-write", "error" => strip_errno(.0)))] | |
| Write(io::Error), |
`print_current_context` printed the current context with `println!`, which aborts (exit 134) when the write fails, e.g. stdout redirected to a full device. Write to a locked stdout and propagate the io::Error as a new `Error::Write`, so a write failure is reported as `write error: <reason>` with exit 1, matching GNU.
leeewee
force-pushed
the
runcon-fix-write-error
branch
from
July 15, 2026 04:38
4492832 to
77d6148
Compare
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.
Fixes #13379
runconwith no arguments prints the current SELinux context withprintln!, which aborts (exit 134) when the stdout write fails — e.g. output redirected to a full device. GNU reports the write error and exits 1.print_current_contextnow writes to a locked stdout and propagates theio::Erroras a newError::Write, so a write failure is reported aswrite error: <reason>(exit 1), matching GNU.Before:
After:
This matches GNU byte-for-byte (
/usr/bin/runcon: write error: No space left on device, exit 1) and is the same write-error class as chcon (#13061) and kill (#13297). A regression test is added (/dev/full, Linux-gated).