GNU bug report logs - #10281
du: hard-links counting with multiple arguments (commit

Previous Next

Package: coreutils;

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


Message #102 received at 10281 <at> debbugs.gnu.org (full text, mbox):

From: Linda Walsh <coreutils <at> tlinx.org>
To: Elliott Forney <idfah <at> cs.colostate.edu>
Cc: 10281 <at> debbugs.gnu.org
Subject: Re: bug#10281: change in behavior of du with multiple arguments
	(commit	efe53cc)
Date: Wed, 20 Feb 2013 02:15:25 -0800
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...








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.