Skip to content

cat: Changes to ENOSPC Handling#9933

Open
mattsu2020 wants to merge 8 commits intouutils:mainfrom
mattsu2020:cat_9920
Open

cat: Changes to ENOSPC Handling#9933
mattsu2020 wants to merge 8 commits intouutils:mainfrom
mattsu2020:cat_9920

Conversation

@mattsu2020
Copy link
Contributor

To align with GNU coreutils behavior
Changes to ENOSPC handling

related
#9920

@oech3

This comment was marked as off-topic.

@github-actions
Copy link

GNU testsuite comparison:

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

@sylvestre
Copy link
Contributor

@mattsu2020 FYI, the "merge branch" just makes review slower ;)

@mattsu2020
Copy link
Contributor Author

FYI, the "merge branch" just makes review slower ;)

sorry

@github-actions
Copy link

github-actions bot commented Jan 1, 2026

GNU testsuite comparison:

GNU test failed: tests/shuf/shuf-reservoir. tests/shuf/shuf-reservoir is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/sort/sort-stale-thread-mem. tests/sort/sort-stale-thread-mem is passing on 'main'. Maybe you have to rebase?
Congrats! The gnu test tests/tail/retry is no longer failing!

- 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.
@github-actions
Copy link

github-actions bot commented Jan 6, 2026

GNU testsuite comparison:

Congrats! The gnu test tests/shuf/shuf-reservoir is no longer failing!
Congrats! The gnu test tests/sort/sort-stale-thread-mem is no longer failing!

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 15, 2026

Merging this PR will not alter performance

✅ 288 untouched benchmarks
⏩ 38 skipped benchmarks1


Comparing mattsu2020:cat_9920 (7a7a6ce) with main (289d701)

Open in CodSpeed

Footnotes

  1. 38 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Remove the unused import of `uucore::libc` that was only included on non-Windows platforms, simplifying the code and reducing unnecessary dependencies.
@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/tail/wait. tests/tail/wait is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/tail/symlink (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/cut/bounded-memory is no longer failing!
Note: The gnu test tests/tail/pipe-f is now being skipped but was previously passing.
Note: The gnu test tests/tail/tail-n0f is now being skipped but was previously passing.

Adds a test case for the `cat` utility when using line numbering (`-n` option) and piping to `/dev/full`. This test verifies that the expected error message is displayed when the output device is full, ensuring consistent error handling behavior across different cat invocation patterns.
@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/date/date-locale-hour. tests/date/date-locale-hour is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/cut/bounded-memory is no longer failing!
Note: The gnu test tests/basenc/bounded-memory is now being skipped but was previously passing.
Note: The gnu test tests/expand/bounded-memory is now being skipped but was previously passing.

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.

3 participants

Comments