Fd: Follow symlinks by default

Created on 27 Nov 2017  Â·  3Comments  Â·  Source: sharkdp/fd

Not following symlinks by default introduces the pitfall that we may fail to consider about symlinks, which are not often used. I have actually fallen into this pitfall several days earlier. I understand that the traditional alternative find also does not follow symlinks by default, but IMO we should provide a saner default nonetheless.

question

Most helpful comment

I think we should stay consistent with not only find but also ripgrep and other tools.

All 3 comments

Following symlinks by default naively might be not a great idea.
If a symlink points to a parent (or ... grand parent) directory, you might end up with endless recursion.
So if symlinks were followed by default, it probably should be restricted to symlinks that point directly to files only.

you might end up with endless recursion

This is actually not possible. The ignore crate detects cycles:

> tree
.
├── a
│   └── link_to_parent -> ..
└── hello.txt

2 directories, 1 file

> fd -L hello a
a/link_to_parent/hello.txt

I think we should stay consistent with not only find but also ripgrep and other tools.

Was this page helpful?
0 / 5 - 0 ratings