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

From: Elliott Forney <[email-masked]>
Date: Fri, 16 Dec 2011 13:46:47 -0700

> The intent of the POSIX spec is that files should be counted only once,
> regardless of whether they are arrived at via hard links, or by following
> symbolic links with -L, or by any other means.

I agree that symlinks and hard links and maybe even bind mounts or
whatever else should not be counted twice.  I do think, however, that
multiple command line arguments should be counted individually since
they were explicitly specified by the user.  At least by default.

My proposed solution would be the following:

By default, files with the same inode should only be counted once for
each command line argument.  This can already be overridden with
--count-links.  However, everything should be reset between command
line arguments so that multiple command line arguments are counted
individually.  As pointed out by Alan Curry, -c should be used to get
a correct total.

In addition to this, it would be nice if there were a command line
switch that allowed for files to only be counted once across all
command line arguments, i.e. a switch to enable the current behavior.

In this scheme, the GNU du retains compatibility with Solaris, AIX,
OSX, et cetra, but the user has the option to count multiple command
line arguments only once.  I do agree that this functionality can be
useful in some circumstances I just think it is a confusing default.

> No, I don't think they conform to POSIX in the above example.
> Perhaps this is a bug in POSIX

Of course, maybe the first thing to do is to get clarification on the
POSIX spec.