Paul Eggert wrote:

> 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.

du.c already has an internal hash_all variable, and it so happens you
can set it by using du's --files0-from= option.  This should do the trick:

  find dir -print0 | du --files0-from=-

Obviously that's a bit of a kludge.
We shouldn't require a separate find process (and disabling
du's internal traversal code) just to turn this on, so adding
that option might make sense.



Reply via email to