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

Recursive symlinks can cause project discovery to fail #1185

Open
thecrypticace opened this issue Feb 10, 2025 · 0 comments
Open

Recursive symlinks can cause project discovery to fail #1185

thecrypticace opened this issue Feb 10, 2025 · 0 comments
Assignees

Comments

@thecrypticace
Copy link
Contributor

Projects that contain symlinks back to a parent directory can cause project discovery to briefly freeze or even error.

I think the source of this behavior is fast-glob. It just doesn't handle this case at all when you still need to resolve symlinks. It walks the symlink and stops after some level of recursion / depth. There's no concept of an "filter entry" callback that we could use to prevent traversal by realpath. A possible solution to this would be to run two traversals one that doesn't follow symlinks and one that does with an expanded ignore list but that would be quite wasteful for the general case.

The problem with the repeated symlink recursion is that there's a chance that you'll can hit the path length limit before you hit the recursion limit and project discovery throw an error because of the length of the path passed to a filesystem API causes it to throw.

  • Windows (normal): 260 characters
  • Windows (long paths enabled registry and app binary): ~32,767 characters
  • Linux: 4,096 characters
  • macOS: 1,024 characters

This information can be discovered about an environment like so:

# Windows (registry check only)
# 0 = 260, 1 = 32,767
Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled'

# Linux and macOS
getconf PATH_MAX /
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

No branches or pull requests

1 participant