Skip to content

fix(checksum): handle stdout write errors gracefully instead of panic…#10978

Open
naoNao89 wants to merge 3 commits intouutils:mainfrom
naoNao89:fix-cksum-stdout-panic
Open

fix(checksum): handle stdout write errors gracefully instead of panic…#10978
naoNao89 wants to merge 3 commits intouutils:mainfrom
naoNao89:fix-cksum-stdout-panic

Conversation

@naoNao89
Copy link
Contributor

I re-implement from existing src/uu/tty stdout error handling

just replace panicking print!() with write!() returning io::Result, propagate errors and exit gracefully with code 1 on write failure

Fixes #10947.

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/misc/io-errors is no longer failing!
Note: The gnu test tests/pr/bounded-memory is now being skipped but was previously passing.

@xtqqczze
Copy link
Contributor

As per #10536, any functions that now take impl Write should be renamed.

…king

When redirecting output to /dev/full or encountering other write errors,
the checksum utilities now exit with code 1 instead of panicking.

Changes:
- Modified print_legacy_checksum, print_tagged_checksum, and
  print_untagged_checksum to use stdout.write_all with error propagation
- Added graceful exit with code 1 on write failure (matches GNU behavior)

Fixes uutils#10947
@naoNao89 naoNao89 force-pushed the fix-cksum-stdout-panic branch from 49f72b6 to 8624081 Compare February 16, 2026 16:17
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/symlink (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/misc/io-errors is no longer failing!
Note: The gnu test tests/tail/tail-n0f is now being skipped but was previously passing.
Note: The gnu test tests/unexpand/bounded-memory is now being skipped but was previously passing.

@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/cut/bounded-memory. tests/cut/bounded-memory is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/seq/seq-epipe. tests/seq/seq-epipe is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/pr/bounded-memory (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/misc/io-errors is no longer failing!

Copy link
Contributor

@xtqqczze xtqqczze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: update comments like "Print the filename" to "Write the filename"

@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/cut/bounded-memory. tests/cut/bounded-memory is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/date/resolution. tests/date/resolution is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/pr/bounded-memory (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/tail/retry is no longer failing!

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.

cksum /dev/null > /dev/full panics

2 participants