-
Notifications
You must be signed in to change notification settings - Fork 30k
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: fix misplaced errors in fs.symlinkSync #18548
Conversation
498053f
to
98ab243
Compare
Should we add a regression test here? Otherwise LGTM |
@maclover7 The only way not to introduce more flakes that I can think of is monkey-patching the binding so that it returns ctx with an error...not a big fan of this way of testing but I can add that |
@joyeecheung Hmm, I may be oversimplifying / not completely understanding what's being changed here, but couldn't there be a test that checks the error stacktrace to make sure everything that's there is there? That seems like what the extra conditional provides |
@maclover7 The ctx.error is only triggered by the cases described in the OP, e.g. when malloc fails or the buffer to encode is too big. Normal syscall errors don't go there |
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.
I personally think monkey patching to test this is appropriate but I am ok with landing this without a test as well.
@joyeecheung can you please always run a CI after creating a PR? :-) |
The ctx.error is supposed to be handled in fs.readlinkSync, but was handled in fs.symlinkSync by mistake. Also fix the error number check in readlink to be consistent with SYNC_CALL.
98ab243
to
e4ccf65
Compare
Landed in b1c6ecb, thanks! |
The ctx.error is supposed to be handled in fs.readlinkSync, but was handled in fs.symlinkSync by mistake. Also fix the error number check in readlink to be consistent with SYNC_CALL. PR-URL: #18548 Refs: #18348 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Should this be backported to |
The ctx.error is supposed to be handled in fs.readlinkSync, but was handled in fs.symlinkSync by mistake. Also fix the error number check in readlink to be consistent with SYNC_CALL. PR-URL: nodejs#18548 Refs: nodejs#18348 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
The ctx.error is supposed to be handled in fs.readlinkSync,
but was handled in fs.symlinkSync by mistake.
Also fix the error number check in readlink to be consistent
with SYNC_CALL.
Refs: #18348
This is an oversight of #18348, the error handling was supposed to be in
fs.readlinkSync
instead offs.symlinkSync
. I couldn't come up with a test because these errors cannot be triggered easily:node/src/string_bytes.cc
Lines 41 to 51 in 1286923
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
fs