Bug 561869 - "du -s *" reports confusing directory sizes
Summary: "du -s *" reports confusing directory sizes
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: 12
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: ---
Assignee: Kamil Dudka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 739574 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-02-04 15:21 UTC by Peter Eriksen
Modified: 2012-07-16 11:42 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2010-02-04 16:12:59 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Script to reproduce the output in the report (213 bytes, application/octet-stream)
2010-02-04 15:21 UTC, Peter Eriksen
no flags Details

Description Peter Eriksen 2010-02-04 15:21:30 UTC
Created attachment 388813 [details]
Script to reproduce the output in the report

Description of problem:
"/usr/bin/du -s *" reports different sizes of the sub directories depending on their position in the "*"-list.

Version-Release number of selected component (if applicable):
du (GNU coreutils) 7.6

How reproducible:
Always.

Steps to Reproduce:
1. Run attached script (clones git.git from kernel.org in a new directory called Bug/)
2.
3.
  
Actual results:
==================
43560   git
132     git.git
==================
27620   git.git
16072   hit
==================
43696   .


Expected results:
Not sure what to expect. Probably
==================
43560   git
27620   git.git
==================
27620   git.git
43560   hit
==================
43696   .

Of course the exact sizes will change as the remote repository is updated.


Additional info:

Comment 1 Kamil Dudka 2010-02-04 15:31:27 UTC
Thanks for reporting it and preparing the reproducer!

The bug is triggered by hard links - it vanishes after:

$ find Bug -type f -links 2 -delete

I haven't yet looked into sources, but it seems like FTS hashing is not cleared properly before the jump to next operand.

Comment 2 Kamil Dudka 2010-02-04 15:56:39 UTC
Additionally there is a clash with -c:

$ mkdir a b
$ dd if=/dev/zero of=a/file count=10
$ ln a/file b

$ du
12      ./b
4       ./a
20      .

$ du a
12      a

$ du b
12      b

$ du a b
12      a
4       b

$ du b a
12      b
4       a

$ du -c a b
12      a
4       b
16      total


I've added the upstream maintainer.

Jim, could you please have a look at the example?

Comment 3 Kamil Dudka 2010-02-04 16:01:03 UTC
Now looking into info documentation, it seems to be documented such:

   If two or more hard links point to the same file, only one of the
hard links is counted.  The FILE argument order affects which links are
counted, and changing the argument order may change the numbers that
`du' outputs.

Comment 4 Kamil Dudka 2010-02-04 16:12:59 UTC
I am closing the bug as NOTABUG.  The behavior is a bit counter-intuitive, nevertheless properly documented.

Comment 5 Ondrej Vasik 2012-07-16 11:42:30 UTC
*** Bug 739574 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.