-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
[release-3.9] Pass throwIfNoEntry to fs.statSync #44582
Conversation
Future versions of node will be able to return undefined, rather than allocating and throwing an exception, when a file is not found. See nodejs/node#33716
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
I read the associated Node PR for |
@fatcerberus I don't think that's the case. My understanding is that if you don't pass in the flag, exceptions will be thrown with an arbitrarily large call stack capture. @amcasey understands it way better than I do though. |
@fatcerberus, yes, the new flag is the mitigation. Prior to adding the flag, we were using a different mitigation (suggested by node) - we set the call stack depth to zero for the duration of the stat call. Node PR 35644 circumvents this mitigation by resetting the call stack depth to infinity while construction uvExceptions (like the one for non-existent files). More details: nodejs/node#35644 (comment) |
The change looks good, but strictly speaking, we need to review all the statSync calls in case 3.9 had some that were dropped by the time I made the change in 4.2 (unlikely). Edit: confirmed for 3.9, 4.0, and 4.1. |
@amcasey Thanks, I was assuming this was a mitigation for a breaking change in Node 16, then I got confused because it didn't seem like |
Ports #41604 to TypeScript 3.9
See nodejs/node#35644 for why we have to do this to avoid potential regressions when users upgrade to Node 16.