-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: prevent infinite recursion when looking up real paths #7757
base: latest
Are you sure you want to change the base?
Conversation
The |
My npm just updated and undid my local patch. this is literally a one line change, can we get this PR merged? |
@wraithgar Does the subject of this pr just need to be changed to pass the lint test? |
It's a little concerning that this change passes all test coverage without the need for a new test. This means one of two things:
Either situation means we've fixed this bug by accident, and not on purpose. At the very least we'll need a new test showing explicitly the issue this fix is addressing, and hopefully also be able to explain how the new code path in this PR is being hit in tests now w/o making the tests fail. It's also telling that the error experienced is a maximum call stack error. There is already a guard in this file that's supposed to kick in before we get to that point. It's possible answering the question(s) above will help solve that mystery too. This fix is a good start, but we need to be able to show in tests and/or comments why it works. |
when i was debugging, I was also puzzled by the fact that it never threw the eloop exception after 2k iterations as you should exceed that long before the maximum call stack is exceeded. I can add the context that I would agree that a test is missing or an existing test is flawed, which should currently be failing. Given what i've just tested, I'm guessing it is lacking test(s) related to folder redirection. Let me know if i can help further. Perhaps, point me to where the unit tests are stored in this repo and I'll try to review them in my free time and see if there's anything that can be added or improved. |
There are no unit tests for this util in isolation, we find that unit tests often invite dead code paths and don't usually test the code as it is used. The two libraries that consume this helper are Unfortunately the tests in arborist are not the easiest to jump into without quite a bit of context. You're welcome to dive in but don't feel bad if you can't make a lot of headway. If you can use isolated examples, including what values realpath.js is seeing in that loop, that may be enough for us to figure out what's going on and either add a good comment to that loop, or add a test. |
check the initial issue. #7309 i logged: console.log(depth, dir, path, dir == path, base); result:
happy to log something else |
This fixes #7309 which causes a "RangeError: Maximum call stack size exceeded" on line 38 on Windows 11 without this change.
References
@danFbach found the fix.