dd: summarize in --human-readable format too

Problem reported by Linda Walsh in: http://bugs.gnu.org/17505
* NEWS: Document this.
* doc/coreutils.texi (dd invocation): Use a simpler script.
Adjust output example to match new behavior.
* src/dd.c (human_size): Remove.
All uses changed to use human_readable and ...
(human_opts): ... this new constant.
(abbreviation_lacks_prefix): New function.
(print_xfer_stats): Use it.  Output both --si and --human-readable
summaries, but only if they have prefixes.
* tests/dd/reblock.sh, tests/dd/stats.sh: Test new behavior.
This commit is contained in:
Paul Eggert
2015-12-31 11:43:09 -08:00
parent 26323928d9
commit 8f9bf30017
5 changed files with 63 additions and 43 deletions

View File

@@ -23,14 +23,14 @@ print_ver_ dd
cat <<\EOF > exp-reblock || framework_failure_
0+2 records in
1+1 records out
4 bytes (4 B) copied
4 bytes copied
EOF
# 2 short reads -> 2 partial writes
cat <<\EOF > exp-no-reblock || framework_failure_
0+2 records in
0+2 records out
4 bytes (4 B) copied
4 bytes copied
EOF

View File

@@ -60,14 +60,14 @@ for open in '' '1'; do
wait
# Ensure all data processed and at least last status written
grep '250000000 bytes .* copied' err || { cat err; fail=1; }
grep '250000000 bytes (250 MB, 238 MiB) copied' err || { cat err; fail=1; }
done
progress_output()
{
{ sleep "$1"; echo 1; } | dd bs=1 status=progress of=/dev/null 2>err
# Progress output should be for "byte ... copied", while final is "bytes ..."
grep 'byte .* copied' err
# Progress output should be for "byte copied", while final is "bytes ..."
grep 'byte copied' err
}
retry_delay_ progress_output 1 4 || { cat err; fail=1; }