Bug 5288 - du not reporting hard links as same
Summary: du not reporting hard links as same
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: 1.19.x
Hardware: PC Windows
: P5 minor
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-06 17:35 UTC by Adrian
Modified: 2019-02-19 16:10 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian 2012-06-06 17:35:01 UTC
When using Tiny Core Linux I found that du was counting hard linked files as different.  Getting coreutils.tcz fixed the problem but the base is still incorrect.

Test:

printf "% $((12*1024))s" '' > file1
cp -l file1 file2
cp file2 file3
ls -li file*
du -sc file*


Expected that du either doesn't show file2 or reports that it is smaller in size.  ls shows that the inodes of file1 and file2 are the same.

Expected result:
 818936 -rw-r--r--    2 backup   backup       12288 Jun  6 08:52 file1
 818936 -rw-r--r--    2 backup   backup       12288 Jun  6 08:52 file2
 818945 -rw-r--r--    1 backup   backup       12288 Jun  6 08:52 file3
12      file1
12      file3
24      total

Received result:
 818936 -rw-r--r--    2 backup   backup       12288 Jun  6 08:55 file1
 818936 -rw-r--r--    2 backup   backup       12288 Jun  6 08:55 file2
 857130 -rw-r--r--    1 backup   backup       12288 Jun  6 08:55 file3
12      file1
12      file2
12      file3
36      total
Comment 1 panahs 2015-11-26 09:03:01 UTC
Hello all.

Is there any progress with issue?
Comment 2 Denys Vlasenko 2019-02-19 16:10:15 UTC
Fixed in git:

commit e563f9e851c78f5c13cb9828ddb11ca981fd6331
Author: Ron Yorston <rmy@pobox.com>
Date:   Sat Feb 16 10:22:31 2019 +0000

    du: don't count duplicate arguments. Closes 5288

    Since coreutils 8.6 (2010-10-15) du no longer counts duplicate arguments.

    Revert the relevant part of commit 618a3027ed (du: fix "du /dir /dir"
    case).