mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
Merge pull request #3154 from jfinkels/dd-truncated-records
dd: correct order and phrasing of truncated record
This commit is contained in:
commit
1a7e5c4cc5
2 changed files with 21 additions and 3 deletions
|
@ -779,13 +779,15 @@ fn print_io_lines(update: &ProgUpdate) {
|
||||||
"{}+{} records in",
|
"{}+{} records in",
|
||||||
update.read_stat.reads_complete, update.read_stat.reads_partial
|
update.read_stat.reads_complete, update.read_stat.reads_partial
|
||||||
);
|
);
|
||||||
if update.read_stat.records_truncated > 0 {
|
|
||||||
eprintln!("{} truncated records", update.read_stat.records_truncated);
|
|
||||||
}
|
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"{}+{} records out",
|
"{}+{} records out",
|
||||||
update.write_stat.writes_complete, update.write_stat.writes_partial
|
update.write_stat.writes_complete, update.write_stat.writes_partial
|
||||||
);
|
);
|
||||||
|
match update.read_stat.records_truncated {
|
||||||
|
0 => {}
|
||||||
|
1 => eprintln!("1 truncated record"),
|
||||||
|
n => eprintln!("{} truncated records", n),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Print the progress line of a status update:
|
// Print the progress line of a status update:
|
||||||
// <byte-count> bytes (<base-1000-size>, <base-2-size>) copied, <time> s, <base-2-rate>/s
|
// <byte-count> bytes (<base-1000-size>, <base-2-size>) copied, <time> s, <base-2-rate>/s
|
||||||
|
|
|
@ -1079,3 +1079,19 @@ fn test_skip_zero() {
|
||||||
.no_stdout()
|
.no_stdout()
|
||||||
.stderr_is("0+0 records in\n0+0 records out\n");
|
.stderr_is("0+0 records in\n0+0 records out\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_truncated_record() {
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["cbs=1", "conv=block", "status=noxfer"])
|
||||||
|
.pipe_in("ab")
|
||||||
|
.succeeds()
|
||||||
|
.stdout_is("a")
|
||||||
|
.stderr_is("0+1 records in\n0+1 records out\n1 truncated record\n");
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["cbs=1", "conv=block", "status=noxfer"])
|
||||||
|
.pipe_in("ab\ncd\n")
|
||||||
|
.succeeds()
|
||||||
|
.stdout_is("ac")
|
||||||
|
.stderr_is("0+1 records in\n0+1 records out\n2 truncated records\n");
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue