-
Notifications
You must be signed in to change notification settings - Fork 58
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
Resolving symlinks can result in an infinite loop #125
Comments
Hm. I don't think this should happen at all. Setting an upper limit could work as a hotfix but we should add a proper fix that checks against this. |
I think I found a solution. Putting up a PR soon for testing. |
@SuperchupuDev What would be the ideal behavior if we crawl mock({
"/some/dir": {
file: "somefile",
fileSymlink: mock.symlink({
path: "/some/dir",
}),
another: mock.symlink({ path: "/some/dir/fileSymlink" }),
another2: mock.symlink({ path: "./fileSymlink" }),
},
}); Should we crawl |
I tested
Interesting:
If there's a symlink somewhere deep inside that points to a parent of the directory you are crawling, it gets crawled and you get 2 sets of files. However, if there are 2 symlinks that point to the same parent directory, it bails out:
The general policy being that if there are more than one symlinks pointing at the same directory, it will bail out:
|
i mean the former sounds better for performance, but both sound like they would do the same in terms of what the user gets returned so i guess both work 🤷♀️ whatever you find better to implement |
hi @thecodrr, any news on this? do you need help in implementing a fix? |
If there's a directory symlink somewhere and it points into a parent directory
fdir
will enter an infinite loop. Other libraries such asfast-glob
seem to have an upper limit to avoid this, but I haven't looked at its handling yetThe text was updated successfully, but these errors were encountered: