bin/183681: df(1): -h and -H option: manual page have them swapped

Julian Hsiao madoka at nyanisore.net
Thu Jan 16 09:15:07 UTC 2014


Noticed this bug a few days ago while accessing a network mount with OS 
X, and got really confused because it switched from powers-of-two to SI 
units some time ago.

The bug was introduced 11/2012 and filed 11/2013; I hope don't have to 
wait until 11/2014 for it to be fixed!  I think the fix should be 
fairly trivial, but I'm unfamiliar with FreeBSD's development cycle.  
Here's a patch to the man page, which I hope will help to get the 
process going.

--- df.1	2014-01-16 00:19:36.000000000 -0800
+++ df2.1	2014-01-16 00:23:35.000000000 -0800
@@ -86,14 +86,14 @@
 .It Fl H
 .Dq Human-readable
 output.
-Use unit suffixes: Byte, Kibibyte, Mebibyte, Gibibyte, Tebibyte and
-Pebibyte (based on powers of 1024) in order to reduce the number of
+Use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and
+Petabyte (based on powers of 1000) in order to reduce the number of
 digits to four or fewer.
 .It Fl h
 .Dq Human-readable
 output.
-Use unit suffixes: Byte, Kilobyte, Megabyte,
-Gigabyte, Terabyte and Petabyte (based on powers of 1000) in order to
+Use unit suffixes: Byte, Kibibyte, Mebibyte,
+Gibibyte, Tebibyte and Pebibyte (based on powers of 1024) in order to
 reduce the number of
 digits to four or fewer.
 .It Fl i
-------------- next part --------------
A non-text attachment was scrubbed...
Name: df.1.diff
Type: application/octet-stream
Size: 783 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-bugs/attachments/20140116/33ba8fff/attachment.obj>
-------------- next part --------------


On 2013-11-05 12:18:16 +0000, Robin Hahling said:

>> 
>> Number:         183681
>> Category:       bin
>> Synopsis:       df(1): -h and -H option: manual page have them swapped
>> Confidential:   no
>> Severity:       non-critical
>> Priority:       low
>> Responsible:    freebsd-bugs
>> State:          open
>> Quarter:
>> Keywords:
>> Date-Required:
>> Class:          doc-bug
>> Submitter-Id:   current-users
>> Arrival-Date:   Tue Nov 05 12:20:00 UTC 2013
>> Closed-Date:
>> Last-Modified:
>> Originator:     Robin Hahling
>> Release:        10.0-BETA1
>> Organization:
> EPFL
>> Environment:
> FreeBSD odin-fbsd-current 10.0-BETA1 FreeBSD 10.0-BETA1 #0 r256420: Sun 
> Oct 13 01:43:07 UTC 2013     
> root at snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
>> Description:
> The manual page of df(1) has the -h and -H options swapped.
> The bug exists since 2012-11-16 and has been introduced by this commit 
> (r243129):
> http://lists.freebsd.org/pipermail/svn-src-all/2012-November/061588.html
> 
> -h option has historically been based on powers of 1024 whereas -H 
> options on powers of 1000.
> 
> If you run the following:
> % df -h; df -H
> Filesystem     Size    Used   Avail Capacity  Mounted on
> /dev/ada0p2    112G    2.1G    101G     2%    /
> devfs          1.0K    1.0K      0B   100%    /dev
> Filesystem     Size    Used   Avail Capacity  Mounted on
> /dev/ada0p2    121G    2.3G    109G     2%    /
> devfs          1.0k    1.0k      0B   100%    /dev
> 
> You can notice that sizes with -H are actually larger, hence based on 
> powers of 1000.
> 
> Thus, the manual page have them wrong (swapped), since the 
> aforementioned commit:
>      -H      ``Human-readable'' output.  Use unit suffixes: Byte, Kibibyte,
>              Mebibyte, Gibibyte, Tebibyte and Pebibyte (based on powers of
>              1024) in order to reduce the number of digits to four or fewer.
> 
>      -h      ``Human-readable'' output.  Use unit suffixes: Byte, Kilobyte,
>              Megabyte, Gigabyte, Terabyte and Petabyte (based on powers of
>              1000) in order to reduce the number of digits to four or fewer.
>> How-To-Repeat:
> Have a look at the manual page and compare it with the output of df -h; 
> df -H (or have a look at bin/df.c).
>> Fix:
> 
> 
>> Release-Note:
>> Audit-Trail:
>> Unformatted:


More information about the freebsd-bugs mailing list