Bug 501110

Summary: Filelight does wrongly calculate because of hard links
Product: [Applications] filelight Reporter: branch8475 <branch8475>
Component: generalAssignee: Unassigned bugs <unassigned-bugs-null>
Status: CONFIRMED ---    
Severity: normal CC: kyle.devir, martin.sandsmark, sitter
Priority: NOR    
Version First Reported In: 24.12.2   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

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.
Comment 2 Harald Sitter 2025-07-27 11:15:07 UTC
*** Bug 507502 has been marked as a duplicate of this bug. ***