"Steve Ward" <[EMAIL PROTECTED]> writes:

> The following commands give different results:
>    du --bytes --human-readable foo.txt
>    du --human-readable --bytes foo.txt

--bytes is equivalent to --apparent-size --block-size=1; this is --documented.
--human-readable is equivalent to --block-size=human-readable; this is
--not documented, which is a documentation bug.  The later implicit
----block-size option wins, which explains the behavior you observe.

I also dislike it when option order affects behavior.  Perhaps "du"
should complain about inconsistent options like that?

But if we leave the behavior alone, at least it should be documented
correctly.  Here's a proposed patch to document the current behavior
more accurately, which is a minimal fix for now.

2007-06-04  Paul Eggert  <[EMAIL PROTECTED]>

        * doc/coreutils.texi (Common options): Mention that -h and
        --human-readable are equivalent to --block-size=human-readable.
        Documentation problem reported by Steve Ward in
        <http://lists.gnu.org/archive/html/bug-coreutils/2007-06/msg00007.html>.
        (du invocation): Use optSi rather than duplicating the macro's
        contents (incorrectly, since we claimed a "B" was output).

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index e3a7ec1..f89db18 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -573,6 +573,7 @@ you prefer powers of 1024.
 @cindex human-readable output
 Append a size letter to each size, such as @samp{M} for mebibytes.
 Powers of 1024 are used, not 1000; @samp{M} stands for 1,048,576 bytes.
+This option is equivalent to @option{--block-size=human-readable}.
 Use the @option{--si} option if you prefer powers of 1000.
 @end macro

@@ -9765,13 +9766,7 @@ Output a null byte at the end of each line, rather than 
a newline.
 This option enables other programs to parse the output of @command{du}
 even when that output would contain file names with embedded newlines.

[EMAIL PROTECTED] --si
[EMAIL PROTECTED] --si
[EMAIL PROTECTED] SI output
-Append an SI-style abbreviation to each size, such as @samp{MB} for
-megabytes.  Powers of 1000 are used, not 1024; @samp{MB} stands for
-1,000,000 bytes.  Use the @option{-h} or @option{--human-readable} option if
-you prefer powers of 1024.
[EMAIL PROTECTED]

 @item -s
 @itemx --summarize
M doc/ChangeLog
M doc/coreutils.texi
Committed as 2d62d8d2d31e3a3d85066f3990ce2bcd10be3f85


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to