Subject: Re: bug#10281: change in behavior of du with multiple arguments (commit

From: Paul Eggert <[email-masked]>
Date: Wed, 14 Dec 2011 17:46:29 -0800

On 12/14/11 13:54, Alan Curry wrote:
> Why not let the -c total be correct *and* the -s individual numbers also be
> correct for the names they are next to?

Well, for starters, because the individual numbers
*are* correct for the names they are next to, for a
reasonable definition of "correct".  If the working
directory has two subdirectories A and B in that order,
it's counterintuitive that "du ." should output different
numbers for B than "du A B" does.  It's more intuitive
if the two invocations of du output numbers that agree.
But the Solaris du semantics require that the
numbers must disagree if A and B share space.

The use case you gave works with two arguments, but
it loses useful information with three or more arguments.
For example, suppose I have a bunch of hard links
that all reside in three directories A, B, and C,
and I want to find out how much disk space
I'll reclaim by removing C.  (This is a common situation
with git clones, for example.)  With GNU du, I can run
"du -s A B C" and the output line labeled "C" will tell
me how much disk space I'll reclaim.  There's no easy way
to do this with Solaris du.

In contrast, GNU du can easily support the use case you
mentioned, even with more than two arguments:

  du -s A
  du -s B
  du -s C
  du -cs A B C | tail -1

so in this sense its semantics are more powerful than
those of Solaris du.