-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[FS] lookupPath should throw an error on an empty string #23366
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] lookupPath should throw an error on an empty string #23366
Conversation
It's inconsistent that lookupPath returns `node:null` when the path is an empty string. Normally it either raises `ENOENT` or `node` is truthy. This makes empty string into an edge case that every caller has to handle. `stat` has special handling for the empty string case and correctly returns ENOENT on empty string, but chmod, truncate, and mknod all crash. utime and some other functions mishandle the empty string in an unrelated way.
e37dc5a
to
d1a3953
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 % comment
This is an automatic change generated by tools/maint/rebaseline_tests.py. The following (18) test expectation files were updated by running the tests with `--rebaseline`: ``` other/codesize/test_codesize_cxx_ctors1.gzsize: 8350 => 8343 [-7 bytes / -0.08%] other/codesize/test_codesize_cxx_ctors1.jssize: 20283 => 20273 [-10 bytes / -0.05%] other/codesize/test_codesize_cxx_ctors2.gzsize: 8332 => 8327 [-5 bytes / -0.06%] other/codesize/test_codesize_cxx_ctors2.jssize: 20251 => 20241 [-10 bytes / -0.05%] other/codesize/test_codesize_cxx_except.gzsize: 9349 => 9343 [-6 bytes / -0.06%] other/codesize/test_codesize_cxx_except.jssize: 24051 => 24041 [-10 bytes / -0.04%] other/codesize/test_codesize_cxx_except_wasm.gzsize: 8298 => 8294 [-4 bytes / -0.05%] other/codesize/test_codesize_cxx_except_wasm.jssize: 20176 => 20166 [-10 bytes / -0.05%] other/codesize/test_codesize_cxx_except_wasm_exnref.gzsize: 8298 => 8294 [-4 bytes / -0.05%] other/codesize/test_codesize_cxx_except_wasm_exnref.jssize: 20176 => 20166 [-10 bytes / -0.05%] other/codesize/test_codesize_cxx_lto.gzsize: 8362 => 8357 [-5 bytes / -0.06%] other/codesize/test_codesize_cxx_lto.jssize: 20358 => 20348 [-10 bytes / -0.05%] other/codesize/test_codesize_cxx_mangle.gzsize: 9355 => 9349 [-6 bytes / -0.06%] other/codesize/test_codesize_cxx_mangle.jssize: 24051 => 24041 [-10 bytes / -0.04%] other/codesize/test_codesize_cxx_noexcept.gzsize: 8350 => 8343 [-7 bytes / -0.08%] other/codesize/test_codesize_cxx_noexcept.jssize: 20283 => 20273 [-10 bytes / -0.05%] other/codesize/test_codesize_files_js_fs.gzsize: 7653 => 7647 [-6 bytes / -0.08%] other/codesize/test_codesize_files_js_fs.jssize: 18830 => 18820 [-10 bytes / -0.05%] Average change: -0.06% (-0.08% - -0.04%) ```
Well this change makes |
Opened #23381 to fix the problems in fstatfs turned up by this PR. |
It's inconsistent that lookupPath returns
node:null
when the path is an empty string. Normally it either raisesENOENT
ornode
is truthy. This makes empty string into an edge case that every caller has to handle.stat
has special handling for the empty string case and correctly returns ENOENT on empty string, but chmod, truncate, and mknod all crash. utime and some other functions mishandle the empty string in an unrelated way.