-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
fs: validate file mode from cpp #52050
fs: validate file mode from cpp #52050
Conversation
9e327e7
to
f88f1f1
Compare
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.
Good to have you back! Just leave some non-blocking comments.
Honestly, I have a feeling this should be considered a This, however, should impact only tests (error conditions). So, if everybody agrees, it shouldn't be that bad to land as a non-semver-major PR (mainly on non-LTS lines). Also, I suspect we are only changing it for performance purposes, right? Would you be able to share benchmarks (preferably in a dedicated machine)? |
@RafaelGSS I'm -0.5 on making this a semver-major change, because of the past pull-requests. For example, similar PR was landed (#51027) without semver-major. Also, it's extremely easy to make this change since by just moving the order of any validate operation, you can easily break the order. If we follow this path, calling this major change, we should document this before landing this pull-request. But I believe we shouldn't make a claim to preserve the order of errors since it will stall a lot of optimization opportunities by max 1 year (release of major).
@RafaelGSS The original PR has some benchmark results. I don't have access to a dedicated machine to back this claim, but the results from original PR stands: #49970 |
f88f1f1
to
211ad4d
Compare
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.
lgtm
Landed in 3ec20f2 |
PR-URL: nodejs#52050 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Daniel Lemire <daniel@lemire.me> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
PR-URL: #52050 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Daniel Lemire <daniel@lemire.me> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
PR-URL: #52050 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Daniel Lemire <daniel@lemire.me> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
PR-URL: nodejs#52050 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Daniel Lemire <daniel@lemire.me> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This is somewhat similar to #49970, with major modifications to input validation to avoid making this a breaking change due to the input validation on
Infinity
andNaN
on the original PR. Credit to @andremralves for the initial push.The original PR was blocked due to @tniessen's following comment:
This does not apply because we throw the error synchronously from the C++ side. A similar work was done on
getValidatedFd
couple of months ago. (Ref: #51027)In promisified calls the error was thrown inside an
async function
, and it is thrown the similar way. For non promisified calls, right now the error is thrown still synchronously but inside the C++ file before any callback execution is done.The only difference is the order of errors. For example, previously for a callback version of
access
we were checking the validity ofmode
and later the validity ofcallback
, right nowmode
is checked later. According to the documentation, and if I'm not mistaken, this is not a breaking change.cc @nodejs/fs @tniessen @nodejs/performance @nodejs/cpp-reviewers
And most importantly, I'm back.