-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
fix: avoid endless loop when handling symlinks #108 #109
base: main
Are you sure you want to change the base?
Conversation
@q0rban I'm not sure that just removing code is the correct way to handle this. You should handle the case of infinite loop like keeping track of paths to be sure you don't hit the same path twice to break the loop |
The interesting thing is that the code is already keeping track of the paths. I couldn't figure out a scenario where this code wouldn't result in an infinite loop, which is why I deleted it. But then I realize it is assuming that the paths are not nested at the same level. So I believe the code will work if Furthermore, I don't believe this function will properly handle the scenario where there are multiple symlinks involved. For example, let's say module
but then, what happens if
This would result in
Does that mean this logic needs to recurse? The mind reels. |
Incidentally, do you have any tips on running tests locally? I don't see any documentation on that in the repo. |
realFile = a.realFile; | ||
} catch (error) { | ||
log.error((error as Error).message); | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this fail gracefully like this, or should we not handle the error here?
@robertsLando updated the approach and would appreciate your thoughts. The existing logic seems error prone, and thus difficult to ascertain the intent of it. |
This resolves #108 for me. I tried to run tests locally to see if this breaks anything, but I guess the tests need to run in CI as they were failing with or without this change on my environment.