who: report a stdout write error instead of panicking#13389
Open
leeewee wants to merge 1 commit into
Open
Conversation
|
GNU testsuite comparison: |
xtqqczze
reviewed
Jul 14, 2026
| translate!("who-long-usage", "default_file" => utmpx::DEFAULT_FILE) | ||
| } | ||
|
|
||
| fn write_error(e: std::io::Error) -> Box<dyn UError> { |
`who -q` printed the user list and count with `println!`, which aborts (exit 134) when stdout can't be written, e.g. `who -q > /dev/full`. Write through a helper that propagates the failure: on error it reports a GNU-style `write error: <reason>` to stderr and exits 1. The non-`-q` record path already propagated its write error but reported it without the `write error:` prefix; route it through the same helper so both paths match GNU. Fixes uutils#13388
leeewee
force-pushed
the
who-fix-write-error
branch
from
July 15, 2026 04:50
b758bcd to
de85c9d
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 #13388
who -q(--count) printed the user list and the trailing count withprintln!, which aborts (exit 134) when stdout can't be written — e.g. output redirected to a full device. GNU reports the write error and exits 1.Both stdout output paths now go through a helper that propagates the failure: on error it reports a GNU-style
write error: <reason>to stderr and exits 1.Before:
After:
The non-
-qrecord-listing path already propagated its write error but reported it without thewrite error:prefix (who: No space left on device); it now routes through the same helper, so both paths match GNU (who: write error: No space left on device, exit 1).Same write-error class as chcon (#13061), kill (#13297), and runcon. The existing
--heading/dev/fulltest is updated to the new message, and a-qregression test is added.