df -h and df -H units reversed?

The man page for df(1) says that with -H, it'll "se unit suffixes...based on powers of 1024" while with -h it'll "se unit suffixes based on powers of 1000", but it seems like it's the other way around:

Code:
# zfs create -o refquota=64000 storage/test # 64 KB = 64 * 1000
# df -b storage/test # 512 * 125 = 64000
Filesystem   512-blocks Used Avail Capacity  Mounted on
storage/test        125   71    54    57%    /storage/test
# df -H storage/test # should be 1 KB = 1024 ??
Filesystem      Size    Used   Avail Capacity  Mounted on
storage/test     64k     36k     27k    57%    /storage/test
# df -h storage/test # should be 1 KB = 1000 ??
Filesystem      Size    Used   Avail Capacity  Mounted on
storage/test     62k     35k     27k    57%    /storage/test
# df -k storage/test
Filesystem   1024-blocks Used Avail Capacity  Mounted on
storage/test          62   35    27    57%    /storage/test
Am I missing something?
 
It appears there's a discrepancy between the man page and the code, although I'm not sure which one is doing it the right way round (I don't know if there's an existing convention for -[hH] options).

The man page says -h should use powers of 1000. The code however sets a 'UNITS_2' flag if the -h option is used, causing it to use base 2 numbers. It only uses powers of 1000 if set to use 'SI' units, which is does if you pass -H.
 
Thanks. I submitted a patch to freebsd-bugs yesterday but for some reason it didn't get posted, but I'm glad to hear that it's been resolved.
 
Back
Top