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

Is fd -L -t l supposed to work? #939

Closed
timkgh opened this issue Jan 10, 2022 · 3 comments
Closed

Is fd -L -t l supposed to work? #939

timkgh opened this issue Jan 10, 2022 · 3 comments
Labels

Comments

@timkgh
Copy link

timkgh commented Jan 10, 2022

What version of fd are you using?
fd 8.3.1

I understand that the -L and -t l are kinda at odds with each other, but I would expect that fd could follow the symlinks and also print any symlinks it runs into. Is this a bug or desired behavior?

@timkgh timkgh changed the title Is fd -L -t l supposed to work Is fd -L -t l supposed to work? Jan 10, 2022
@timkgh
Copy link
Author

timkgh commented Jan 10, 2022

It finds broken symlinks, which I suppose could be useful 😄

@tmccombs
Copy link
Collaborator

I don't know if it is "supposed to work", but the reason it doesn't work is because of the way the walkdir crate works.

Specifically, if the option to follow symlinks is enabled, then metadata() method will return the metadata for the target of the symlink rather than the symlink itself. And most of the time, that is what you want, so that for example you can know if the symlink points to a file or a directory, or the modification time of the target of the symlink etc.

Changing the behavior isn't too difficult. I almost have it working on a branch. But it seems to hang for some reason. I haven't figured it out yet.

tmccombs added a commit to tmccombs/fd that referenced this issue Jan 10, 2022
This changes it so that if you specify `--type symlink` then it will
check if each entry is a symlink even if we would otherwise follow it.

Fixes: sharkdp#939
@sharkdp
Copy link
Owner

sharkdp commented Jan 23, 2022

I would like to close this for now. @timkgh See reasoning in #940.

@sharkdp sharkdp closed this as completed Jan 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants