[njs] Test262: handling the mkdir issue with a host file system.

Dmitry Volyntsev xeioex at nginx.com
Tue Jan 30 01:17:26 UTC 2024


details:   https://hg.nginx.org/njs/rev/9e2a757cb33e
branches:  
changeset: 2276:9e2a757cb33e
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Mon Jan 29 17:16:01 2024 -0800
description:
Test262: handling the mkdir issue with a host file system.

diffstat:

 test/fs/promises_05.t.js |  13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diffs (23 lines):

diff -r a2959e490279 -r 9e2a757cb33e test/fs/promises_05.t.js
--- a/test/fs/promises_05.t.js	Mon Jan 29 08:57:49 2024 -0800
+++ b/test/fs/promises_05.t.js	Mon Jan 29 17:16:01 2024 -0800
@@ -49,7 +49,18 @@ var testSync = () => new Promise((resolv
         try {
             fs.writeFileSync(fname(dname_utf8), fname(dname_utf8));
 
-            throw new Error('fs.mkdirSync error 1');
+            const mode = fs.statSync(fname(dname_utf8)).mode & 0o777;
+
+            if (mode == 0o555) {
+                /*
+                 * Some file systems ignore the mode parameter for mkdir.
+                 * For example: a shared folder on a MacOS host mounted
+                 * to a Linux guest via Parallels Desktop.
+                 */
+                throw new Error('fs.writeFileSync did not respect mode');
+            }
+
+            fs.unlinkSync(fname(dname_utf8));
 
         } catch (e) {
             if (e.syscall != 'open' || e.code != 'EACCES') {


More information about the nginx-devel mailing list