GNU bug report logs - #17546
Problem with du

Previous Next

Package: coreutils;

Reported by: worley <at> alum.mit.edu (Dale R. Worley)

Date: Thu, 22 May 2014 00:18:02 UTC

Severity: normal

Tags: notabug

Merged with 21926

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: "Dale R. Worley" <worley <at> alum.mit.edu>
Cc: 17546 <at> debbugs.gnu.org
Subject: bug#17546: Problem with du
Date: Wed, 21 May 2014 19:42:11 -0700
Dale R. Worley wrote:
> before release 8.6, the order of arguments didn't matter

No, order mattered even back then.  For example:

$ du --version | sed 1q
du (GNU coreutils) 8.4
$ ls -li d/* e/*
11765482 -rw-r--r-- 1 eggert csfac 159910666 May  1 20:42 d/j
23558745 -rw-r--r-- 2 eggert csfac 410000000 Apr 22 21:34 d/k
23558745 -rw-r--r-- 2 eggert csfac 410000000 Apr 22 21:34 e/k
$ du d e d e
557664	d
4	e
156480	d
4	e
$ du e d e d
401188	e
156480	d
4	e
156480	d

So file argument order affected link counts even back then; it's just 
that before 8.6 this was true only for files with link count greater 
than 1, which led to odd behaviors such as the behavior shown above. 
What changed in 8.6 is that the behavior was made consistent for all 
files, not just those with link count greater than 1. so that for the 
same data the current version of du generates output like this:

$ du --version | sed 1q
du (GNU coreutils) 8.22
$ du d e d e
557664	d
4	e
$ du e d e d
401188	e
156480	d

This sums to the same values independent of file order, which is a plus.

As far as I can see, POSIX doesn't allow the old behavior, but does 
allow the new one.

> This leads to startlingly odd behaviors

Any choice of behavior for 'du' will lead to odd behaviors sometimes, 
and there's no way we can make everybody happy in all cases.  There is 
an important technical advantage of du's current behavior, though; you 
can get the behavior you prefer by running "du X; du Y".  If we chaned 
du to reset itself between command-line arguments, there'd be no way to 
get the behavior I prefer, which is to count files just once.




This bug report was last modified 6 years and 214 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.