Repository navigation
Conversation
Author
|
The first CI runs were cancelled because they shared this commit with #16887. Reopening so the workflows run again. |
Author
|
Reopened on d1c1404 so the workflows are not the ones cancelled with #16887. |
This comment was marked as resolved.
This comment was marked as resolved.
adityawrk
force-pushed
the
sort-tmp-file-enospc
branch
from
November 26, 2026 17:51
d147c74 to
8e57d39
Compare
Author
|
Squashed onto one commit. |
Collaborator
|
failure on windows: thread 'tests::tmp_file_enospc_names_the_file_and_exits_2' panicked at src\uu\sort\src\sort.rs:3496:9:
unexpected message: close failed: t/chunk: The printer is out of paper. |
Author
|
Errno 28 is ENOSPC on Unix and ERROR_OUT_OF_PAPER on Windows, which is why that test printed "The printer is out of paper." The same assertion failed on WASI. 76e6166 checks the |
xtqqczze
reviewed
Nov 26, 2026
| uucore::locale::setup_localization("sort").unwrap(); | ||
| // 28 is ENOSPC on Linux and macOS. | ||
| let error = std::io::Error::from_raw_os_error(28); | ||
| // A raw errno is not portable: 28 is ENOSPC on Unix and |
Collaborator
There was a problem hiding this comment.
how about using libc::ENOSPC
should also work on Windows, see:
A write or close error on a temporary file printed only the errno and
exited 1. GNU sort names that file and exits 2:
sort: close failed: t/<tempfile>: No space left on device
Flush and close the temporary file explicitly, and report the failure
with its path. On Linux, close can return EINTR after the descriptor
is already closed, so do not retry it.
Fixes uutils#16851
Errno 28 is ENOSPC on Unix and ERROR_OUT_OF_PAPER on Windows, so the unit test expected "No space left on device" and observed "The printer is out of paper." Check the close-failed format with a disk-full error instead of a raw errno.
sylvestre
force-pushed
the
sort-tmp-file-enospc
branch
from
November 29, 2026 20:55
76e6166 to
09d7bd5
Compare
This branch has not been deployed
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 #16851.
A full temporary directory used to print only the errno and exit 1:
The temporary file is now named and the exit status is 2, including when the failing operation is the write that filled the buffer, the flush of that buffer, or the close:
BufWriterandFileboth drop those errors.sortnow flushes and closes the temporary file itself and maps the error toSortError::TmpFileCloseFailed. Writes to standard output are unchanged, so a full stdout still exits 1.Testing
cargo test -p uu_sort --lib— 21 passed, including the new close-failure tests andtmp_file_enospc_names_the_file_and_exits_2.tests/by-util/test_sort.rstest_spill_write_error_does_not_panicnow expects exit 2,close failed:, the temporary directory, and no panic. That test mounts a tmpfs, so it was not run on this machine.Also, on this commit:
cargo test --test tests --no-default-features --features sort -- test_sort::— 240 passed, 0 failed.cargo clippy -p uu_sort --all-targets -- -D warnings— clean.-S 100kagainst a volume with 80 KiB free:stdout was empty.
seq 20 | ./target/debug/sort -S 1k -T /tmpexited 0 and printed the sorted lines.