[FS] lookupPath should throw an error on an empty string#23366
[FS] lookupPath should throw an error on an empty string#23366hoodmane merged 6 commits intoemscripten-core:mainfrom
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
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:nullwhen the path is an empty string. Normally it either raisesENOENTornodeis truthy. This makes empty string into an edge case that every caller has to handle.stathas 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.