Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option for cross-filesystem-recursion #4

Open
Pingger opened this issue May 5, 2023 · 1 comment
Open

Option for cross-filesystem-recursion #4

Pingger opened this issue May 5, 2023 · 1 comment

Comments

@Pingger
Copy link

Pingger commented May 5, 2023

Hi,

I'm using btrfs and btrfs-subvolumes are classified as cross-filesystem, while they aren't really. This causes a dirstat / to return a tiny 37KiB html and 1.1KiB json.

dirstat doesn't even recurse into /etc, /opt and /usr which aren't even a subvolume, but just regular folders.

I DO get the message Skipping "/bin" (not a directory nor a regular file), which true, it is a symlink to /usr/bin which is normal for ubuntu. But I only get the message for /bin

In addition: btrfs supports extent-sharing, so with btrfs fi du <file> I can check the total size of a file, the amount that is shared with other files and the space used exclusively by this file. It would be nice if we got support for that aswell, but I fully understand if that is too complex

@GaelGirodon
Copy link
Owner

GaelGirodon commented May 10, 2023

DirStat uses Go stdlib's filepath.Walk function to scan the directory (https://github.com/GaelGirodon/dirstat/blob/0.11.0/internal/scan/scan.go#L20-L56), but this function sometimes seems to behave strangely. I recently ran into a similar issue on an NTFS drive from Windows: entries that look like regular directories from the Explorer are totally ignored by the scan. I'll take a look at it, that may solve your issue as well.

Symbolic links are not followed by filepath.Walk to avoid loops, I'll try to fix that too as it's a pretty common use case. Maybe filepath.Walk wasn't the right choice, I can try to use os.ReadDir instead with recursive calls, and add an option to follow symlinks and another one to limit the scan depth to prevent infinite loops, or implement a mechanism to detect this automatically (but it might not be as simple as it seems).

For the last issue, yes, it seems to be too complex and specific to implement in this tool. For now, I'll focus on the two other issues that may even impact users not using btrfs filesystems 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants