Skip to content

fix(#1480): break symlink cycle on find-file, search-node #1482

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

Merged
merged 5 commits into from
Aug 8, 2022

Conversation

alex-courtis
Copy link
Member

@alex-courtis alex-courtis commented Aug 2, 2022

closes #1480

  • detect cycles on search-node S
  • search link paths, not target paths on find-file

expand-all is OK as it stops after max_folder_discovery, however it does follow cycles. We should look at that if time permits.

@alex-courtis alex-courtis requested a review from kyazdani42 August 2, 2022 05:45
@alex-courtis
Copy link
Member Author

@archiif your testing would be gratefully appreciated.

Copy link
Member

@kyazdani42 kyazdani42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this change means that nvim-tree will not find file in symlink directories ? I think we should only prevent looping indefinitely right ?

@alex-courtis
Copy link
Member Author

does this change means that nvim-tree will not find file in symlink directories ? I think we should only prevent looping indefinitely right ?

I recall that it did. I'll re-test on the weekend.

@archiif
Copy link

archiif commented Aug 2, 2022

Thanks a lot for this PR! I did a quick test and it fixed my issue.
nvim-tree doesn't seem to track the current directory, so when you C-] into a symlinked directory and go back up again, you end up in the new target directory. So I'm not sure how to test what @kyazdani42 is saying.

@alex-courtis
Copy link
Member Author

alex-courtis commented Aug 6, 2022

nvim-tree doesn't seem to track the current directory, so when you C-] into a symlinked directory and go back up again, you end up in the new target directory.

That's working as intended: nvim-tree simply finds the file, and find always picks the real directory. That could be changed in the future, but would need some thought.

C-] changes to the realpath of the directory. That could be changed in the future, but would need some thought.

@alex-courtis
Copy link
Member Author

Still testing...

@alex-courtis
Copy link
Member Author

alex-courtis commented Aug 8, 2022

does this change means that nvim-tree will not find file in symlink directories ? I think we should only prevent looping indefinitely right ?

It is not finding files in symlink directories outside cwd. Reworked as a simple cycle detector as per search-node.

@alex-courtis alex-courtis merged commit 261a5c3 into master Aug 8, 2022
Almo7aya pushed a commit to Almo7aya/nvim-tree.lua that referenced this pull request Oct 11, 2022
…vim-tree#1482)

* fix(nvim-tree#1480): break symlink cycle on find-file

* fix(nvim-tree#1480): break symlink cycle on search-node

* fix(nvim-tree#1480): break symlink cycle on search-node

* fix(nvim-tree#1480): break symlink cycle on find-file
@alex-courtis alex-courtis deleted the 1480-break-symlink-cycles branch December 16, 2022 04:38
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

Successfully merging this pull request may close these issues.

nvim gets stuck when finding a file in a directory with a looping symlink
3 participants