Skip to content

Conversation

@mattsu2020
Copy link
Contributor

To align with GNU coreutils behavior
Changes to ENOSPC handling

related
#9920

- Introduce WriteError variant in CatError enum to specifically handle stdout write failures
- Add map_write_err helper to wrap io::Result into CatResult with WriteError
- Update cat_files to catch WriteError early and report using localized message
- Wrap write_all and flush calls in write_fast and write_lines with map_write_err
- Add localized error messages for "write error" in en-US and fr-FR locales

This improves error reporting for I/O issues like broken pipes during output.
…ite_nonprint_to_end

Removed a trailing semicolon following the match arms in the `write_nonprint_to_end` function, which was likely causing a compiler warning or style issue in Rust. This ensures cleaner code without altering functionality.
- Adds a new test case to verify that `cat /dev/stdin` properly handles writing to a full device (/dev/full) and outputs the correct error message "No space left on device" without the raw errno code. This improves test coverage for error handling on Unix-like systems.
- Prevents spell-checker from flagging ENOSPC as a misspelling, as it's a valid errno constant (e.g., "No space left on device") used in the test code.
@oech3
Copy link
Contributor

oech3 commented Dec 31, 2025

I did not know that we have our own error messages instead of extracting from OS.

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

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.

2 participants