Summary: | hard links multiply counted in usage totals | ||
---|---|---|---|
Product: | [Applications] filelight | Reporter: | brainchild <contact> |
Component: | general | Assignee: | Martin Sandsmark <martin.sandsmark> |
Status: | REOPENED --- | ||
Severity: | minor | CC: | ai0867, jpwhiting, null, strijbol.niko |
Priority: | NOR | ||
Version First Reported In: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Mint (Ubuntu based) | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/utilities/filelight/commit/7356cc3bc8164073e161820c32321ec8bf5b52c4 | Version Fixed In: | 23.03 |
Sentry Crash Report: |
Description
brainchild
2019-03-30 03:11:06 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/filelight/-/merge_requests/71 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 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) Yep, good point. I'll update that one also. One moment. This is only actually fixed for hardlinks in the *same directory*. STEPS TO REPRODUCE 1. mkdir /tmp/filelight_test 2. cd /tmp/filelight_test 3. dd if=/dev/zero of=orig bs=4096 count=256k 4. for i in $(seq 10); do ln orig link_$i ; done 5. Open filelight, see only 1 GiB in use in /tmp/filelight_test, as expected (attributed to one file) 6. for i in $(seq 10); do mkdir dir_$i; ln orig dir_$i/link_in_dir ; done 7. Refresh filelight OBSERVED RESULT Filelight shows a total disk usage of 11 GiB, 1 GiB in each subdirectory, and 1 GiB in the root. EXPECTED RESULT Total disk usage of 1 GiB. Attribution of that disk usage is a different issue (with a proposed fix by Martin Sandsmark in #144948) SOFTWARE/OS VERSIONS Filelight: 25.04.3 Gentoo linux, as of 2025-08-01 Plasma: 6.3.6 KDE Framework: 6.13.0 Qt: 6.9.1 (build against 6.9.1) |