Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Jan 2014 01:02:17 -0800
From:      Julian Hsiao <madoka@nyanisore.net>
To:        freebsd-bugs@freebsd.org
Subject:   Re: bin/183681: df(1): -h and -H option: manual page have them swapped
Message-ID:  <lb876d$ffk$1@ger.gmane.org>
References:  <201311051218.rA5CIGhO077594@oldred.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

----------------4878225201678990838
Content-Type: text/plain; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

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

----------------4878225201678990838
Content-Type: application/octet-stream; name="df.1.diff"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="df.1.diff"

LS0tIGRmLjEJMjAxNC0wMS0xNiAwMDoxOTozNi4wMDAwMDAwMDAgLTA4MDAKKysrIGRmMi4x
CTIwMT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013-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@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:

----------------4878225201678990838--





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?lb876d$ffk$1>