Repository navigation
sort: report read errors from the --check and --merge reader threads - #15616
Conversation
Merging this PR will not alter performance1 warning, 1 note
Comparing Footnotes
|
| separator: u8, | ||
| ) -> UResult<()> { | ||
| // Error messages are built on this thread, and localization is per thread. | ||
| let _ = uucore::locale::setup_localization("sort"); |
There was a problem hiding this comment.
could chunks.rs return a SortError variant instead? its Display is translated lazily on the main thread, so we wouldn't need the setup in every reader thread
| #[case(&["-c", "dir"])] | ||
| #[case(&["-C", "dir"])] | ||
| #[case(&["-m", "input", "dir"])] | ||
| #[cfg(target_os = "linux")] |
There was a problem hiding this comment.
did you run the GNU sort tests with this change?
bash util/build-gnu.sh && bash util/run-gnu-test.sh tests/sort/sort-merge.pl tests/sort/sort.pl
| #[case(&["-m", "input", "dir"])] | ||
| #[cfg(target_os = "linux")] | ||
| fn test_read_error_on_reader_thread(#[case] args: &[&str]) { | ||
| // `--check` used to exit 0 without a message when its input could not be |
There was a problem hiding this comment.
this history comment isn't really needed, the test name says enough
|
a bunch of jobs are failing |
|
Thanks for the review! Addressed in b73553f:
|
|
@codspeedbot fix this regression |
The latest commit, b73553f, should already fix this regression, so I didn't push any changes. Cause: On 3784e86, the memory flamegraph for Fix (b73553f): That commit removes
So the merge benchmarks run the same code as on I couldn't run the memory benchmarks myself in this session. CodSpeed's CI run for b73553f was still processing when I finished, so its report on this PR will be the confirmation. If either benchmark still shows a regression there, comment Summary
Was this response helpful? React with 👍 or 👎 to help us improve CodSpeedBot. |
|
Binary size comparison: |
|
Thanks for your PR |
Fixes #15615
check.rs: keep the reader thread'sJoinHandleand return its error after draining, sosort -c/-Con an unreadable input exits 2 withread failed: ...instead of reporting the partial input as sorted. A disorder found before the error still takes precedence.check.rsandmerge.rs: callsetup_localization("sort")at the start of the reader threads, since localization is per thread and the read error message is built there (sort -m input dirprintedsort: sort-read-failed). Same as whatdddoes in its progress thread.Added
test_read_error_on_reader_threadwith-c dir,-C dirand-m input dir; all three fail on main and pass with this change. It only checks forread failed:andIs a directory, so it won't clash with #15191 adding the file name.test_sort::passes locally excepttest_merge_batch_size_with_limitandtest_temporary_files_with_few_file_descriptors, which fail on main too on my machine (fd limit). Clippy is clean.Found with behave.