diff --git a/src/library_fs.js b/src/library_fs.js index f14e01e5e0b3..3b9a29b31d86 100644 --- a/src/library_fs.js +++ b/src/library_fs.js @@ -231,7 +231,7 @@ FS.staticInit();` + lookupNode(parent, name) { var errCode = FS.mayLookup(parent); if (errCode) { - throw new FS.ErrnoError(errCode, parent); + throw new FS.ErrnoError(errCode); } var hash = FS.hashName(parent.id, name); #if CASE_INSENSITIVE_FS @@ -316,6 +316,7 @@ FS.staticInit();` + return 0; }, mayLookup(dir) { + if (!FS.isDir(dir.mode)) return {{{ cDefs.ENOTDIR }}}; var errCode = FS.nodePermissions(dir, 'x'); if (errCode) return errCode; if (!dir.node_ops.lookup) return {{{ cDefs.EACCES }}}; @@ -1408,7 +1409,7 @@ FS.staticInit();` + }, ensureErrnoError() { if (FS.ErrnoError) return; - FS.ErrnoError = /** @this{Object} */ function ErrnoError(errno, node) { + FS.ErrnoError = /** @this{Object} */ function ErrnoError(errno) { // We set the `name` property to be able to identify `FS.ErrnoError` // - the `name` is a standard ECMA-262 property of error objects. Kind of good to have it anyway. // - when using PROXYFS, an error can come from an underlying FS @@ -1416,7 +1417,6 @@ FS.staticInit();` + // the test `err instanceof FS.ErrnoError` won't detect an error coming from another filesystem, causing bugs. // we'll use the reliable test `err.name == "ErrnoError"` instead this.name = 'ErrnoError'; - this.node = node; this.setErrno = /** @this{Object} */ function(errno) { this.errno = errno; #if ASSERTIONS diff --git a/src/library_syscall.js b/src/library_syscall.js index a147f642fe0e..318f30caf3f0 100644 --- a/src/library_syscall.js +++ b/src/library_syscall.js @@ -42,15 +42,7 @@ var SyscallsLibrary = { }, doStat(func, path, buf) { - try { - var stat = func(path); - } catch (e) { - if (e && e.node && PATH.normalize(path) !== PATH.normalize(FS.getPath(e.node))) { - // an error occurred while trying to look up the path; we should just report ENOTDIR - return -{{{ cDefs.ENOTDIR }}}; - } - throw e; - } + var stat = func(path); {{{ makeSetValue('buf', C_STRUCTS.stat.st_dev, 'stat.dev', 'i32') }}}; {{{ makeSetValue('buf', C_STRUCTS.stat.st_mode, 'stat.mode', 'i32') }}}; {{{ makeSetValue('buf', C_STRUCTS.stat.st_nlink, 'stat.nlink', SIZE_TYPE) }}}; diff --git a/test/other/metadce/test_metadce_cxx_ctors1.gzsize b/test/other/metadce/test_metadce_cxx_ctors1.gzsize index c946ea20daca..87e1a92de80b 100644 --- a/test/other/metadce/test_metadce_cxx_ctors1.gzsize +++ b/test/other/metadce/test_metadce_cxx_ctors1.gzsize @@ -1 +1 @@ -9936 +9932 diff --git a/test/other/metadce/test_metadce_cxx_ctors1.jssize b/test/other/metadce/test_metadce_cxx_ctors1.jssize index 51e8a3898644..ef8d02c7b4c5 100644 --- a/test/other/metadce/test_metadce_cxx_ctors1.jssize +++ b/test/other/metadce/test_metadce_cxx_ctors1.jssize @@ -1 +1 @@ -24683 +24693 diff --git a/test/other/metadce/test_metadce_cxx_ctors2.gzsize b/test/other/metadce/test_metadce_cxx_ctors2.gzsize index d89ecd30cd70..e075aaa54a98 100644 --- a/test/other/metadce/test_metadce_cxx_ctors2.gzsize +++ b/test/other/metadce/test_metadce_cxx_ctors2.gzsize @@ -1 +1 @@ -9921 +9915 diff --git a/test/other/metadce/test_metadce_cxx_ctors2.jssize b/test/other/metadce/test_metadce_cxx_ctors2.jssize index e9737da1ce9c..b32c1ee20e95 100644 --- a/test/other/metadce/test_metadce_cxx_ctors2.jssize +++ b/test/other/metadce/test_metadce_cxx_ctors2.jssize @@ -1 +1 @@ -24651 +24661 diff --git a/test/other/metadce/test_metadce_cxx_except.gzsize b/test/other/metadce/test_metadce_cxx_except.gzsize index 1d5865756906..deca973733ba 100644 --- a/test/other/metadce/test_metadce_cxx_except.gzsize +++ b/test/other/metadce/test_metadce_cxx_except.gzsize @@ -1 +1 @@ -11015 +11010 diff --git a/test/other/metadce/test_metadce_cxx_except.jssize b/test/other/metadce/test_metadce_cxx_except.jssize index 6a6dc7c715c9..d7bf552030bb 100644 --- a/test/other/metadce/test_metadce_cxx_except.jssize +++ b/test/other/metadce/test_metadce_cxx_except.jssize @@ -1 +1 @@ -28573 +28583 diff --git a/test/other/metadce/test_metadce_cxx_except_wasm.gzsize b/test/other/metadce/test_metadce_cxx_except_wasm.gzsize index 3a31f4b39a85..55223f1554dc 100644 --- a/test/other/metadce/test_metadce_cxx_except_wasm.gzsize +++ b/test/other/metadce/test_metadce_cxx_except_wasm.gzsize @@ -1 +1 @@ -9903 +9899 diff --git a/test/other/metadce/test_metadce_cxx_except_wasm.jssize b/test/other/metadce/test_metadce_cxx_except_wasm.jssize index 7ad84412db24..b85dcbb09ed5 100644 --- a/test/other/metadce/test_metadce_cxx_except_wasm.jssize +++ b/test/other/metadce/test_metadce_cxx_except_wasm.jssize @@ -1 +1 @@ -24576 +24586 diff --git a/test/other/metadce/test_metadce_cxx_mangle.gzsize b/test/other/metadce/test_metadce_cxx_mangle.gzsize index 853337070d62..d817e31f8830 100644 --- a/test/other/metadce/test_metadce_cxx_mangle.gzsize +++ b/test/other/metadce/test_metadce_cxx_mangle.gzsize @@ -1 +1 @@ -11021 +11016 diff --git a/test/other/metadce/test_metadce_cxx_mangle.jssize b/test/other/metadce/test_metadce_cxx_mangle.jssize index 6a6dc7c715c9..d7bf552030bb 100644 --- a/test/other/metadce/test_metadce_cxx_mangle.jssize +++ b/test/other/metadce/test_metadce_cxx_mangle.jssize @@ -1 +1 @@ -28573 +28583 diff --git a/test/other/metadce/test_metadce_cxx_noexcept.gzsize b/test/other/metadce/test_metadce_cxx_noexcept.gzsize index c946ea20daca..87e1a92de80b 100644 --- a/test/other/metadce/test_metadce_cxx_noexcept.gzsize +++ b/test/other/metadce/test_metadce_cxx_noexcept.gzsize @@ -1 +1 @@ -9936 +9932 diff --git a/test/other/metadce/test_metadce_cxx_noexcept.jssize b/test/other/metadce/test_metadce_cxx_noexcept.jssize index 51e8a3898644..ef8d02c7b4c5 100644 --- a/test/other/metadce/test_metadce_cxx_noexcept.jssize +++ b/test/other/metadce/test_metadce_cxx_noexcept.jssize @@ -1 +1 @@ -24683 +24693 diff --git a/test/other/metadce/test_metadce_files_js_fs.gzsize b/test/other/metadce/test_metadce_files_js_fs.gzsize index 3e457d777294..fc1347e76e0d 100644 --- a/test/other/metadce/test_metadce_files_js_fs.gzsize +++ b/test/other/metadce/test_metadce_files_js_fs.gzsize @@ -1 +1 @@ -7874 +7871 diff --git a/test/other/metadce/test_metadce_files_js_fs.jssize b/test/other/metadce/test_metadce_files_js_fs.jssize index 0677ec7a1898..b3945f1ded56 100644 --- a/test/other/metadce/test_metadce_files_js_fs.jssize +++ b/test/other/metadce/test_metadce_files_js_fs.jssize @@ -1 +1 @@ -19705 +19715