1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

dd: correct behavior when status=noxfer

Correct the behavior of `dd` with the `status=noxfer` option. Before
this commit, the status output was entirely suppressed (as happens
with `status=none`). This was incorrect behavior. After this commit,
the input/output counts are printed to stderr as expected.

For example,

    $ printf "" | dd status=noxfer
    0+0 records in
    0+0 records out

This commit also updates a unit test that was enforcing the wrong
behavior.
This commit is contained in:
Jeffrey Finkelstein 2022-01-23 17:32:36 -05:00
parent d2fe245192
commit 80ac2619e4
2 changed files with 8 additions and 3 deletions

View file

@ -398,8 +398,13 @@ where
}
match i.print_level {
Some(StatusLevel::Noxfer) | Some(StatusLevel::None) => {}
_ => print_transfer_stats(&ProgUpdate {
Some(StatusLevel::None) => {}
Some(StatusLevel::Noxfer) => print_io_lines(&ProgUpdate {
read_stat: rstat,
write_stat: wstat,
duration: start.elapsed(),
}),
Some(StatusLevel::Progress) | None => print_transfer_stats(&ProgUpdate {
read_stat: rstat,
write_stat: wstat,
duration: start.elapsed(),

View file

@ -183,7 +183,7 @@ fn test_final_stats_noxfer() {
new_ucmd!()
.args(&["status=noxfer"])
.succeeds()
.stderr_only("");
.stderr_only("0+0 records in\n0+0 records out\n");
}
#[test]