GNU bug report logs -
#10281
du: hard-links counting with multiple arguments (commit
Previous Next
Reported by: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Mon, 12 Dec 2011 18:02:02 UTC
Severity: wishlist
Tags: wontfix
Merged with 10282,
11526
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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.
+1
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 * .
vs.
$ 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,
Berny
This bug report was last modified 6 years and 303 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.