[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Voelker, Bernhard
Subject: bug#10281: change in behavior of du with multiple arguments (commit efe53cc)
Date: Mon, 19 Dec 2011 10:10:33 +0100

Elliott Forney wrote:

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


The big disadvantage of counting only once for all arguments is that
the result highly depends on the order of the arguments, even in a
simple case without symlinks and hardlinks:

  $ du -s * .
  $ du -s . *

That reminds me about a real-life question you could ask your little
daughter: "how many pupils are in each class and in total at school?".
I guess you would send her to extra math courses if she said "Class A
has 20, class B and class C have 25 each, and the school has 0."

This example doesn't claim to be 100% relevant for du, but shows
how "counting" and "summarizing" is burnt into human brains.

Have a nice day,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]