Bug 501110 - Filelight does wrongly calculate because of hard links
Summary: Filelight does wrongly calculate because of hard links
Status: CONFIRMED
Alias: None
Product: filelight
Classification: Applications
Component: general (show other bugs)
Version: 24.12.2
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-05 18:21 UTC by branch8475
Modified: 2025-03-06 13:44 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description branch8475 2025-03-05 18:21:10 UTC
SUMMARY
Filelight does wrongly calculate the size of the /var/lib/flatpak/ directory.
This directory contains many hard links. Because of this Filelight includes files multiple times into the size calculation.

One gets the correct size of the directory with this bash argument:
du -sh /var/lib/flatpak/

STEPS TO REPRODUCE
1. Open Filelight
2. Let Filelight calculate the size of /var/

OBSERVED RESULT

The directory size that Filelight gives for /var/lib/flatpak/ is twice as large as the size that du returns.

EXPECTED RESULT

The directory size that Filelight gives for /var/lib/flatpak/ is the same as that which du returns.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 41
KDE Plasma Version: 6.3.1
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.2

ADDITIONAL INFORMATION
Comment 1 Harald Sitter 2025-03-06 13:44:09 UTC
The code that is meant to deduplicate hardlinks is not correctly implemented.

Currently it resides on the PosixWalker as a std::set, skipping nodes that are already in the set. The walkers are run in any number of threads though, so that set is never complete. Needs some thinking about where to best track this. A global cache across all walkers would work, but needs mutexing so maybe passing the dev-inode out of the walker is more efficient (we have a global accumulation lock anyway) but then we kinda break abstraction a bit.