Following symlinks is a questionable default
cuviper opened this issue · comments
I tried kondo
in my home directory, and it ended up scanning everything due to a symlink:
'Steam/steamapps/common/Proton 7.0/dist/share/default_pfx/dosdevices/z:' -> /
It was taking a really long time, so I ran strace
and found that it was lost somewhere in .../z:/proc
. I know there are symlink loops in procfs
, and I think walkdir
is supposed to detect loops, so maybe it would have figured that out eventually. Still, I don't think it's a good default to follow links, and other tools I know like fd-find
and dua-cli
do not.
Semi-related, you might also want an option for same_file_system
, but that's less clear as a default.
Oh, nasty. Thank you for raising this.
I'm of the mind to change symlinks to default nofollow, and expose the option with a flag.
I don't have much experience with multiple filesystems, I don't see an immediate issue with allowing crossing filesystem boundaries if they're within the directories you've specified. This could be a flag too!
I've been planning out a refactor, so these will get some attention.
Thanks for a quick reply!
For precedent, -L
is a common option flag for following links. I'm not sure what situation you'd really want that for this tool, but I see no problem with making it possible for a user who does.
The filesystem thing is more niche, to be sure, especially if you're not following links.
I agree that kondo dhouldn't follow symlinks by default or at least have an option to disable such behavior, or have an option to exclude certain directories from searching. Same situation as issue opener, scanned my proton prefixes.
Thanks for raising this issue! I've disabled symlink following by default, you'll now be able to opt-in via a CLI flag.