Subject: bug#7399: du may count one file multiple times if it visible through multiple mounts

From: Paul Eggert <[email-masked]>
Date: Sun, 14 Nov 2010 23:16:42 -0800

On 11/14/2010 05:16 AM, Evgeny Kapun wrote:
> Some kernels, such as Linux, permit mounting one filesystem multiple
> times. This can make multiple paths refer to the same file, although
> neither hard nor symbolic links are involved.

GNU du (as well as a lot of other programs I expect) doesn't work well
in such environments, which do not conform to POSIX requirements for
file system link counts.  GNU du could easily be fixed to handle these
environments, but at a substantial runtime cost in the normal case,
because it'd have to hash every file it runs across, not just files
with link counts > 1 or that result from multiple arguments.

One possible workaround is to add an option, --hash-all-files say, which causes
du to hash every file it runs across, and thus not double-count files
in such cases.

(Another possible workaround is to tell users "don't do that".  :-)