bug-coreutils
[Top][All Lists]
Advanced

[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: Linda Walsh
Subject: bug#10281: change in behavior of du with multiple arguments (commit efe53cc)
Date: Wed, 20 Feb 2013 02:15:25 -0800
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666

Elliott Forney wrote:
$ du -ks tmp tmp/bash
1033864 tmp

$ du -ks tmp/bash tmp
182684  tmp/bash
851180  tmp

The size of tmp is underrepresented even though there are no links.
----
   Is it?  I mean is it showing less space that the sum of the
files in the tmp dir exclusive of the directory you singled out
for a separate totally?

I.e. by singling out tmp/bash, it could easily be taken that you
want it be be tallied separately from tmp and not have it's space
included -- vs.  the way you seem to want it -- which would be to
provide a total.

In the specific example you show, du -cks shows what you want,
but easily might not depending on your args.

The only way to do what you want would be to have a running tree
mode, where another column displays. a running total for the dirs
you specified that has 1 column being a total of everything under
it, and a 2nd column that shows that total with any dirs specified
on the command line removed from the tally:

Ex: supposed we have dirs w/sizes of files in the dirs
a:100
 a/b:100, a/c:100, a/d:100,
   a/b/e:100
a2:100
---
If I specified:

du [some-trigger-arg] a/b/e a/b a a2
100   100   a/b/e
200   100   a/b
500 300 a #** 100 100 a2 ** 2nd number includes dirs 'c' and 'd' as they were not mentioned separately.

I'm not sure what the cost/benefit ratio is on this, at this
time... might rise.

Though you'd also have to be specific -- what would happen
if the files in a/b/e were hard links to 'a'... output
could still be different than what you wanted.  Maybe a perl
script to munge the output? then an alias and/or function to
call your extension when you wanted?

alias would be easy, but if you wanted to get fancy,
you could make a:

function du_special
}

function du {
.. if flag1=myflag, run du_special else
'du' "$@"      ## run real du...
}

I asked for the -h on sort about 5-6 years ago, but
no one wanted it then... now it's just there.  Unfortunately
I find that I'm often some number of years ahead of where
critical mass to have something happen is...;-/

Just some random suggesting...









reply via email to

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