From owner-freebsd-bugs@FreeBSD.ORG  Tue Nov  5 12:20:01 2013
Return-Path: <owner-freebsd-bugs@FreeBSD.ORG>
Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTP id 8F6CD106
 for <freebsd-bugs@smarthost.ysv.freebsd.org>;
 Tue,  5 Nov 2013 12:20:01 +0000 (UTC)
 (envelope-from gnats@FreeBSD.org)
Received: from freefall.freebsd.org (freefall.freebsd.org
 [IPv6:2001:1900:2254:206c::16:87])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by mx1.freebsd.org (Postfix) with ESMTPS id 6FD0822CF
 for <freebsd-bugs@smarthost.ysv.freebsd.org>;
 Tue,  5 Nov 2013 12:20:01 +0000 (UTC)
Received: from freefall.freebsd.org (localhost [127.0.0.1])
 by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id rA5CK1gJ010020
 for <freebsd-bugs@freefall.freebsd.org>; Tue, 5 Nov 2013 12:20:01 GMT
 (envelope-from gnats@freefall.freebsd.org)
Received: (from gnats@localhost)
 by freefall.freebsd.org (8.14.7/8.14.7/Submit) id rA5CK1ZS009984;
 Tue, 5 Nov 2013 12:20:01 GMT (envelope-from gnats)
Resent-Date: Tue, 5 Nov 2013 12:20:01 GMT
Resent-Message-Id: <201311051220.rA5CK1ZS009984@freefall.freebsd.org>
Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer)
Resent-To: freebsd-bugs@FreeBSD.org
Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org,
 Robin Hahling <robin.hahling@gw-computing.net>
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTP id E6E42F4A
 for <freebsd-gnats-submit@FreeBSD.org>; Tue,  5 Nov 2013 12:18:16 +0000 (UTC)
 (envelope-from nobody@FreeBSD.org)
Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121])
 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mx1.freebsd.org (Postfix) with ESMTPS id D500622B1
 for <freebsd-gnats-submit@FreeBSD.org>; Tue,  5 Nov 2013 12:18:16 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
 by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id rA5CIGeP077597
 for <freebsd-gnats-submit@FreeBSD.org>; Tue, 5 Nov 2013 12:18:16 GMT
 (envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
 by oldred.freebsd.org (8.14.5/8.14.5/Submit) id rA5CIGhO077594;
 Tue, 5 Nov 2013 12:18:16 GMT (envelope-from nobody)
Message-Id: <201311051218.rA5CIGhO077594@oldred.freebsd.org>
Date: Tue, 5 Nov 2013 12:18:16 GMT
From: Robin Hahling <robin.hahling@gw-computing.net>
To: freebsd-gnats-submit@FreeBSD.org
X-Send-Pr-Version: www-3.1
Subject: bin/183681: df(1): -h and -H option: manual page have them swapped
X-BeenThere: freebsd-bugs@freebsd.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Bug reports <freebsd-bugs.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-bugs>,
 <mailto:freebsd-bugs-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-bugs>
List-Post: <mailto:freebsd-bugs@freebsd.org>
List-Help: <mailto:freebsd-bugs-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-bugs>,
 <mailto:freebsd-bugs-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 05 Nov 2013 12:20:01 -0000


>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: