Bug 5288

Summary: du not reporting hard links as same
Product: Busybox Reporter: Adrian <adrianh.bsc>
Component: Standard ComplianceAssignee: unassigned
Status: RESOLVED FIXED    
Severity: minor CC: busybox-cvs
Priority: P5    
Version: 1.19.x   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Host: Target:
Build:

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).