coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

dd: correct rendering of SI and IEC byte counts

Open jfinkels opened this issue 3 years ago • 5 comments

Adjust the rendering of the concise byte counts in both SI and IEC units to better match the behavior of GNU dd.

Before this commit,

$ head -c 1024 /dev/zero | dd > /dev/null
2+0 records in
2+0 records out
1024 bytes (1 KB, 1024 B) copied, 0.0 s, 1.0 MB/s

After this commit,

$ head -c 1024 /dev/zero | dd > /dev/null
2+0 records in
2+0 records out
1024 bytes (1.0 kB, 1.0 KiB) copied, 0.0 s, 1.0 MB/s

For comparison, GNU dd produces the following:

$ head -c 1024 /dev/zero | dd > /dev/null
2+0 records in
2+0 records out
1024 bytes (1.0 kB, 1.0 KiB) copied, 0.000332864 s, 3.1 MB/s

jfinkels avatar Jun 19 '22 18:06 jfinkels

I am a bit sad that we cannot use a crate for this :)

sylvestre avatar Jun 20 '22 06:06 sylvestre

ping?

sylvestre avatar Jun 24 '22 13:06 sylvestre

I am a bit sad that we cannot use a crate for this :)

There seems to be some similar but slightly different code in df and numfmt as well, perhaps we can at least extract them into some common code in uucore at some point.

jfinkels avatar Jun 28 '22 22:06 jfinkels

Could you please fix the job failures? thanks

sylvestre avatar Aug 04 '22 21:08 sylvestre

Yes, I'll take a look this weekend. Sorry for the delay.

jfinkels avatar Aug 06 '22 23:08 jfinkels

GNU testsuite comparison:

GNU test failed: tests/misc/tee. tests/misc/tee is passing on 'main'. Maybe you have to rebase?

github-actions[bot] avatar Oct 22 '22 14:10 github-actions[bot]

GNU testsuite comparison:

GNU test failed: tests/tail-2/retry. tests/tail-2/retry is passing on 'main'. Maybe you have to rebase?

github-actions[bot] avatar Nov 11 '22 03:11 github-actions[bot]

GNU testsuite comparison:

GNU test failed: tests/misc/timeout. tests/misc/timeout is passing on 'main'. Maybe you have to rebase?

github-actions[bot] avatar Nov 19 '22 15:11 github-actions[bot]

I'm going to merge this because it keeps falling out of date with changes to Cargo.lock.

jfinkels avatar Dec 03 '22 16:12 jfinkels