Repository navigation
Conversation
| #[cfg(unix)] | ||
| pub(crate) fn install_progress_signal_handler() -> std::io::Result<()> { | ||
| // BSD systems (including macOS) use SIGINFO; other Unix systems use SIGUSR1. | ||
| let signal = uucore::signals::signal_by_name_or_value("INFO") |
There was a problem hiding this comment.
why look it up by name at runtime? libc::SIGINFO behind a #[cfg(any(target_vendor = "apple", bsd...))] would be simpler, no?
| ProgUpdateType::Signal => { | ||
| update.print_transfer_stats(progress_printed); | ||
| // Reset the progress printed, since print_transfer_stats always prints a newline. | ||
| update.print_final_stats(print_level, progress_printed); |
There was a problem hiding this comment.
this changes the SIGUSR1 output on linux for status=none/noxfer too, please mention it in the commit message
| let signal = Signal::SIGUSR1; | ||
| #[cfg(not(target_os = "linux"))] | ||
| let signal = Signal::SIGINFO; | ||
|
|
There was a problem hiding this comment.
could you please make this test shorter? 70 lines with two polling loops is hard to follow
maybe one small test per status
c818481 to
f3e21f4
Compare
| ProgUpdateType::Signal => { | ||
| update.print_transfer_stats(progress_printed); | ||
| // Reset the progress printed, since print_transfer_stats always prints a newline. | ||
| update.print_final_stats(print_level, progress_printed); |
There was a problem hiding this comment.
this changes SIGUSR1 output on linux, could you please run the GNU test?
git clone https://github.com/coreutils/coreutils.git ../gnu
bash util/build-gnu.sh && bash util/run-gnu-test.sh tests/dd/stats.sh
| target_os = "dragonfly" | ||
| ))] | ||
| let signal = libc::SIGINFO; | ||
| #[cfg(not(any( |
There was a problem hiding this comment.
the same os list twice, could be a single cfg_if! or a const, no?
| target_vendor = "apple", | ||
| target_os = "freebsd", | ||
| target_os = "netbsd", | ||
| target_os = "openbsd" |
There was a problem hiding this comment.
dragonfly is handled in progress.rs but missing here, on purpose?
d4d8be1 to
ede88e9
Compare
Handle SIGINFO on Apple and BSD targets and use SIGUSR1 on other Unix targets. On Linux, SIGUSR1 now honors status=none by suppressing the report and status=noxfer by printing only record counts. Exercise all three output modes while copying and check that copying continues after the signal. Enable the test on DragonFly BSD too. Existing platform gates in uucore block the DragonFly cross-check. GNU coreutils 9.12 tests/dd/stats.sh passes on Linux with the updated dd, as do 154 integration tests and 94 unit tests for dd. Closes uutils#10776
ede88e9 to
ad49eb3
Compare
Handle SIGINFO on macOS and BSD, retaining SIGUSR1 on other Unix systems. Share progress update handling and honor status=none and status=noxfer for signal reports. Add a regression test that requests statistics while copying, then checks that copying and the final report still complete.
Validation: 152 integration tests and 94 unit tests pass on Linux; macOS and FreeBSD test compilation, formatting, and Clippy pass.
Closes #10776