Bug 143088

Summary: File Size View reports incorrect usages for directories which contain multiple hardlinks to the same file
Product: [Applications] konqueror Reporter: Shriramana Sharma <samjnaa>
Component: generalAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Shriramana Sharma 2007-03-17 04:14:08 UTC
Version:            (using KDE KDE 3.5.5)
Installed from:    Ubuntu Packages
OS:                Linux

To reproduce this bug, follow this procedure. At a terminal type:

$ cd /tmp
$ mkdir bug
$ cd bug
$ dd if=/dev/zero of=file1 bs=1048576 count=1
$ du . -h
1.1M    .

Now open this folder in Konqueror and use File Size View. You will correctly get 1 MB as the size of the /tmp/bug folder and also 1 MB of the file file1. This is correct. Now do this:

$ ln file1 file2
$ du . -h
1.1M    .

So du still says that the usage of the current folder is 1 MB which is right. But open this folder in Konqueror and use File Size View (or just refresh the window you already opened.) You will see that Konqueror says the size of the folder is 2 MB and there are 2 files of 1 MB each. 

While it is true that there are now two file inodes in that directory, 
1. it is not true that there are two files and
2. the total disk usage of the folder is not 2 MB

When we do du * -h, du lists only the first inode pointing to a file, however many hardlinks there may be. This is the behaviour that Konqueror should emulate too. 

The File Size View is used to find out the disk usage, just just the file sizes, since the file sizes are shown in other views too. Therefore Konqueror should only show the first link to a file and ignore all the others. Then it will automatically show the directory size correctly.
Comment 1 Shriramana Sharma 2007-03-18 01:51:01 UTC
I now find that the bug summary itself needs to be corrected, since not only in File Size View, even if I right-click on the bug folder and go to properties, the size is shown as 2 MB. This means that while descending folders to find sizes, Konqueror should *in general* ignore duplicate hardlinks (not just in File Size View).
Comment 2 mario tuling 2008-05-04 19:59:01 UTC

*** This bug has been marked as a duplicate of 67939 ***