Bug 406030 - hard links multiply counted in usage totals
Summary: hard links multiply counted in usage totals
Status: RESOLVED FIXED
Alias: None
Product: filelight
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Mint (Ubuntu based) Linux
: NOR minor
Target Milestone: ---
Assignee: Martin Sandsmark
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-30 03:11 UTC by brainchild
Modified: 2023-09-27 14:04 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description brainchild 2019-03-30 03:11:06 UTC
SUMMARY

Each hard link contributes to disk usage total even when duplicating same inode.


STEPS TO REPRODUCE

1. Create a directory.
2. Copy a large file into the new directory.
3. Create several hard links to the file, within the same directory.
4. Scan directory in Filelight.


OBSERVED RESULT

Disk usage total is file size times number of links.


EXPECTED RESULT

Disk usage total is file size.


SOFTWARE/OS VERSIONS

Filelight: 17.12.3
Linux/KDE Plasma: Mint 19.1 Cinnamon
KDE Frameworks Version: 5.44.0
Qt Version: 5.9.5 (built against 5.9.5)
Comment 1 Bug Janitor Service 2023-01-13 18:51:35 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/filelight/-/merge_requests/71
Comment 2 Jeremy Whiting 2023-01-17 17:50:38 UTC
Git commit 7356cc3bc8164073e161820c32321ec8bf5b52c4 by Jeremy Whiting.
Committed on 17/01/2023 at 17:50.
Pushed by whiting into branch 'master'.

Don't double count hard link files.
On posix file systems, if the number of links for a file is >1
add it to a set the first time we count it and never count it again.
Fixes double counting files that aren't taking twice as much space.

M  +4    -0    autotests/directoryIteratorTest.cpp
M  +2    -2    autotests/localListerTest.cpp
M  +1    -0    src/directoryEntry.h
M  +1    -1    src/localLister.cpp
M  +13   -0    src/posixWalker.cpp
M  +4    -0    src/posixWalker.h

https://invent.kde.org/utilities/filelight/commit/7356cc3bc8164073e161820c32321ec8bf5b52c4
Comment 3 Niko Strijbol 2023-09-27 13:31:43 UTC
Would this also fix https://bugs.kde.org/show_bug.cgi?id=144948 ? (I ask because I was googling this issue and stumbled on that one first)
Comment 4 Jeremy Whiting 2023-09-27 14:04:06 UTC
Yep, good point. I'll update that one also. One moment.