Subject: bug#11526: "du -s . foo bar" only outputs size of first argument -- versions 8.13, 8.16, and 8.17 (latest)

From: Chris Marusich <[email-masked]>
Date: Mon, 21 May 2012 00:24:05 -0700

On second thought, maybe this additional verbiage would be misleading
because (1) the same kind of thing can happen even when not using -s,
and (2) -c doesn't have to be used with -s to determine the total size
of the total disk usage of a given set of files or directories.

In any case, even though the varying output for -s is understandable,
behavior like the following seems counterintuitive:

$ mkdir foo foo/bar
$ du foo foo/bar
4	foo/bar
8	foo
$ du foo/bar foo
4	foo/bar
4	foo

Is this intended?  Apologies if I'm asking something obvious.

On Sun, May 20, 2012 at 10:50 PM, Chris Marusich <[email-masked]> wrote:
> After reviewing the manual more closely, it seems I would have gotten
> the behavior I expected with du -sl.  What do you think about updating
> the documentation to read as follows?
>
> ‘-s’
> ‘--summarize’
> Display only a summary of the arguments.   Unless -l is also
> specified, not all arguments will necessarily appear in the output
> (e.g., du -s foo foo/bar will not output a line for foo/bar), and not
> every size printed next to a directory in the output will necessarily
> reflect the total size of that directory including its contents (e.g.,
> du -s foo/bar foo will output the total size of foo including its
> contents minus the size of foo/bar).  This behavior is POSIX-compliant
> and allows us to use -c to get an idea of the total size of all the
> arguments taken together.
>
> The last line could perhaps be optional.  I'd just like the docs to
> have a clear explanation that helps prevent future confusion.
>
> On Sun, May 20, 2012 at 5:29 PM, Paul Eggert <[email-masked]> wrote:
>>
>> On 05/20/2012 03:18 PM, Chris Marusich wrote:
>> > the behavior contrasts with the description of -s
>> > ("display only a total for each argument" ...)
>>
>> We could change that "total" to "summary".
>>
>> The --help output (man page) currently doesn't discuss
>> this issue in detail, because it's not really set up for
>> long discussions.  There is something in the manual about
>> this, if that helps.