Bug 67939 - directory properties ignores (=double counts) hard links
Summary: directory properties ignores (=double counts) hard links
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
: 143088 250875 283522 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-11-11 23:30 UTC by Jens
Modified: 2011-10-16 10:02 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.7.3
Sentry Crash Report:


Attachments
screenshot showing 'du -sb' vs. Konqueror (35.90 KB, image/png)
2003-11-11 23:32 UTC, Jens
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jens 2003-11-11 23:30:38 UTC
Version:           4.0 (using KDE 3.1.93 (CVS >= 20031028),  (testing/unstable))
Compiler:          gcc version 3.3.2 (Debian)
OS:          Linux (i686) release 2.4.22-jb-w4l+bs

Create a directory with lots of hard links.

Show Konq's properties with that directory, with the "size" of the directory.

Konq will count each hard link, instead of counting the actual disk useage, which (IMHO) is wrong.

See screenshot (attached)
Comment 1 Jens 2003-11-11 23:32:03 UTC
Created attachment 3165 [details]
screenshot showing 'du -sb' vs. Konqueror

Actually this shows "du -Lsb", but "du -sb" gives the same results. There
aren't any soft links in this directory (pointing out of the dir, anyway).
Comment 2 Thomas Otto 2004-03-06 14:57:09 UTC
Indeed, same here with the 3.2.1 Debian Build from unstable:

$ du -sch ~/tmp
11M     tmp
11M     total
$ ls -lh ~/tmp | tail
-rw-r--r--  1671 thomas  thomas  10M Feb  9 01:28 part995.img
-rw-r--r--  1671 thomas  thomas  10M Feb  9 01:28 part996.img
-rw-r--r--  1671 thomas  thomas  10M Feb  9 01:28 part997.img
-rw-r--r--  1671 thomas  thomas  10M Feb  9 01:28 part998.img
-rw-r--r--  1671 thomas  thomas  10M Feb  9 01:28 part999.img

(1671 == hardlink count for this file)

A rightclick->properties on the directory then falsely claims the size to be 16.3 GB.

Note that kdirstat also has this bug, seems to be somewhat deep in KDE.
Comment 3 Jens 2004-11-02 14:42:06 UTC
Hello,

this bug still exists (KDE 3.3.1, SuSE 9.1 build). Can anybody please have a look at it?

Thank you!
Comment 4 Jens 2005-01-11 13:27:31 UTC
Hello,

has anybody had a look at this bug? Konqueror still ignores hard links when calculating directory sizes (i.e. counts the space used by hardlinks multiple times).

Thank you!
Comment 5 Vincent Ramos 2005-04-21 10:51:33 UTC
Hello, 

Same bug with KDE 3.3.2, Debian testing).
Comment 6 Tommi Tervo 2005-10-31 12:28:27 UTC
Confirmed, 3.5-svn r475k
Comment 7 axel 2007-07-30 15:56:31 UTC
it's the same bug as 143088

Comment 8 mario tuling 2008-05-04 19:54:18 UTC
i confirm this for 4.0.3, easy to reproduce
Comment 9 mario tuling 2008-05-04 19:59:03 UTC
*** Bug 143088 has been marked as a duplicate of this bug. ***
Comment 10 Jaime Torres 2008-07-12 11:27:09 UTC
I confirm this for konqueror 4 and dolphin svn trunk r828814.
This is a kdelibs problem. To retrieve the space it goes file by file adding it space, but does not know if the file is a hardlink or not and if it has been added before.
Comment 11 FiNeX 2009-09-14 00:55:02 UTC
moved to kdelibs which should be a more appropriate product.
Comment 12 Christoph Feck 2011-10-07 10:34:12 UTC
*** Bug 283522 has been marked as a duplicate of this bug. ***
Comment 13 Christoph Feck 2011-10-07 10:34:33 UTC
*** Bug 250875 has been marked as a duplicate of this bug. ***
Comment 14 David Faure 2011-10-16 10:02:48 UTC
Git commit 674ebb6964fa48afb45d8e401e4699bbaa87e6be by David Faure.
Committed on 16/10/2011 at 12:01.
Pushed by dfaure into branch 'KDE/4.7'.

Fix DirectorySizeJob counting hardlinks multiple times.

This required to pass the device number and inode number from kio_file
to the job, which is only enabled when the details level is set to 3,
so as to not impact performance in other cases.

It's never too late to fix a bug from 2003.
BUG: 67939
FIXED-IN: 4.7.3

M  +12   -0    kio/kio/directorysizejob.cpp
M  +7    -0    kio/kio/udsentry.h
M  +4    -0    kioslave/file/file.cpp

http://commits.kde.org/kdelibs/674ebb6964fa48afb45d8e401e4699bbaa87e6be