fd icon indicating copy to clipboard operation
fd copied to clipboard

[BUG] Too many levels of symbolic links (os error 62)

Open anacrolix opened this issue 11 months ago • 6 comments

Checks

  • [X] I have read the troubleshooting section and still think this is a bug.

Describe the bug you encountered:

/ % fd wireguard /opt/homebrew --show-errors -L [fd error]: /opt/homebrew/Library/Homebrew/vendor/gems/mechanize-2.9.1/mechanize-2.9.1: Too many levels of symbolic links (os error 62) [fd error]: /opt/homebrew/Library/Homebrew/vendor/gems/mechanize/mechanize-2.9.1: Too many levels of symbolic links (os error 62)

Describe what you expected to happen:

/ % find /opt/homebrew -name wireguard /opt/homebrew/etc/wireguard

What version of fd are you using?

fd 8.7.0

Which operating system / distribution are you on?

% uname -srm
Darwin 22.6.0 arm64

anacrolix avatar Aug 07 '23 22:08 anacrolix

What is the output of

/ % ls -l /opt/homebrew/Library/Homebrew/vendor/gems/mechanize-2.9.1/mechanize-2.9.1

? I suspect it really is a symbolic link loop.

tavianator avatar Aug 08 '23 00:08 tavianator

You are quite right.

/opt/homebrew/Library/Homebrew/vendor/gems/mechanize % ls -l /opt/homebrew/Library/Homebrew/vendor/gems/mechanize-2.9.1/mechanize-2.9.1
lrwxr-xr-x@ 1 anacrolix  admin  16 22 May 14:40 /opt/homebrew/Library/Homebrew/vendor/gems/mechanize-2.9.1/mechanize-2.9.1@ -> mechanize-2.9.1/
/opt/homebrew/Library/Homebrew/vendor/gems/mechanize % cd mechanize-2.9.1
cd: too many levels of symbolic links: mechanize-2.9.1

I think this error is also recoverable: If we receive that error, drop following that symlink and just continue on to the next item. With this behaviour, --show-errors can retain its existing behaviour too: If enabled, the above error message can be displayed, otherwise it is not.

anacrolix avatar Aug 08 '23 09:08 anacrolix

Ohh I didn't notice the missing /opt/homebrew/etc/wireguard. I'm not sure that has to do with the loop error. Do any of these work?

/ % fd wireguard /opt/homebrew
/ % fd -L wireguard /opt/homebrew
/ % fd -u wireguard /opt/homebrew

tavianator avatar Aug 08 '23 16:08 tavianator

@tavianator I thought you had found the issue with the symlink loop, but then I got this:

~ % fd wireguard /opt/homebrew
~ % fd -L wireguard /opt/homebrew
~ % fd -u wireguard /opt/homebrew
/opt/homebrew/opt/wireguard-tools
/opt/homebrew/opt/wireguard-go
/opt/homebrew/Cellar/wireguard-tools/
/opt/homebrew/Cellar/wireguard-tools/1.0.20210914_1/.brew/wireguard-tools.rb
/opt/homebrew/Cellar/wireguard-go/
/opt/homebrew/Cellar/wireguard-go/0.0.20230223/.brew/wireguard-go.rb
/opt/homebrew/Cellar/wireguard-go/0.0.20230223/bin/wireguard-go
/opt/homebrew/Cellar/zig/0.10.1/lib/zig/libc/include/any-linux-any/linux/wireguard.h
/opt/homebrew/Caskroom/android-ndk/25c/AndroidNDK9519653.app/Contents/NDK/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/linux/wireguard.h
/opt/homebrew/etc/wireguard/
/opt/homebrew/var/homebrew/linked/wireguard-tools
/opt/homebrew/var/homebrew/linked/wireguard-go
/opt/homebrew/bin/wireguard-go

I did not expect that with -u. So I ran

~ % fd ignore /opt/homebrew
/opt/homebrew/.dockerignore
/opt/homebrew/.gitignore

~ % fd wireguard /opt/homebrew --no-ignore
/opt/homebrew/opt/wireguard-go
/opt/homebrew/opt/wireguard-tools
/opt/homebrew/Cellar/wireguard-tools/
/opt/homebrew/Cellar/wireguard-go/
/opt/homebrew/Cellar/wireguard-go/0.0.20230223/bin/wireguard-go
/opt/homebrew/Cellar/zig/0.10.1/lib/zig/libc/include/any-linux-any/linux/wireguard.h
/opt/homebrew/Caskroom/android-ndk/25c/AndroidNDK9519653.app/Contents/NDK/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/linux/wireguard.h
/opt/homebrew/etc/wireguard/
/opt/homebrew/var/homebrew/linked/wireguard-go
/opt/homebrew/var/homebrew/linked/wireguard-tools
/opt/homebrew/bin/wireguard-go

I see the desired dir in the list /opt/homebrew/etc/wireguard/. What a ride. This seems like unintended behaviour here, clearly .gitignore in the homebrew dir is not intended to suppress searches in that directory.

anacrolix avatar Aug 08 '23 23:08 anacrolix

That depends on the content of .gitignore

tmccombs avatar Aug 09 '23 01:08 tmccombs

8yzkfsoxput

Mroczek1992 avatar Aug 11 '23 20:08 Mroczek1992