Bug 472376 - dd tool, human readable fix
dd tool, human readable fix
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
rawhide
All Linux
medium Severity low
: ---
: ---
Assigned To: Ondrej Vasik
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-11-20 10:35 EST by Andrey Arapov
Modified: 2008-11-20 16:39 EST (History)
4 users (show)

See Also:
Fixed In Version: 6.12
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-11-20 10:51:21 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
proposed patch (463 bytes, patch)
2008-11-20 10:35 EST, Andrey Arapov
no flags Details | Diff
proposed patch (529 bytes, patch)
2008-11-20 10:39 EST, Andrey Arapov
no flags Details | Diff
reworked patch (570 bytes, patch)
2008-11-20 11:52 EST, Andrey Arapov
no flags Details | Diff

  None (edit)
Description Andrey Arapov 2008-11-20 10:35:10 EST
Created attachment 324184 [details]
proposed patch

dd tool is showing wrong information about the size of the copied data

Example:
fedora ~ # dd if=/dev/zero of=/tmp/tmpdata bs=1M count=6
6+0 records in
6+0 records out
6291456 bytes (6.3 MB) copied, 0.0142112 s, 443 MB/s
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-!!!
It must be 6.0 MB copied
fedora ~ # echo "6291456/1024/1024"|bc -l
6.00000000000000000000
Comment 1 Andrey Arapov 2008-11-20 10:39:03 EST
Created attachment 324185 [details]
proposed patch
Comment 2 Ondrej Vasik 2008-11-20 10:51:21 EST
Thanks for report and patch, however that's NOTABUG ... 

Please read again what's written in dd --help:
"BLOCKS and BYTES may be followed by the following multiplicative suffixes:
xM M, c 1, w 2, b 512, kB 1000, K 1024, MB 1000*1000, M 1024*1024,
GB 1000*1000*1000, G 1024*1024*1024, and so on for T, P, E, Z, Y."

So generally - you have specified blocksize 1024*1024 - and output is shown in MB (1000*1000) form (and obviously rounded).
Comment 3 Ondrej Vasik 2008-11-20 11:32:36 EST
Additionally there is no  "| human_base_1024" in dd.c 's human_opts, so I wonder what was the original version of sources you have.
Comment 4 Andrey Arapov 2008-11-20 11:52:05 EST
Created attachment 324202 [details]
reworked patch
Comment 5 Ondrej Vasik 2008-11-20 16:39:25 EST
Please, read again comment #2 before making another patch... that behaviour is expected, correct and there is nothing to be patched... MB is 1000*1000 , M is 1024*1024 ... you requested size 1024*1024*6 , which is obviously displayed as 6.3*1000*1000 ... 
If you want your 6.0MB copied, try to use 6 * 1MB block and not 6* 1M block...
fedora ~ # dd if=/dev/zero of=/tmp/tmpdata bs=1MB count=6

Note: 1MB = 1 Megabyte = 10^6 bytes
      1MiB = 1 Mebibyte = 2^20 bytes

Official reference: http://physics.nist.gov/cuu/Units/binary.html

Note You need to log in before you can comment on or make changes to this bug.