Skip to content

lib: mask mode_t type of arguments with 0o777

doc: document file mode caveats on Windows

  • On Windows only the write permission (read-only attribute) can be manipulated, and there is no distinction among owner, group or others (no implementation to model the ACL after UNIX permissions).
  • mkdir on Windows does not support the mode argument.

lib: mask mode_t type of arguments with 0o777

  • Introduce the validateAndMaskMode validator that validates mode_t arguments and mask them with 0o777 if they are 32-bit unsigned integer or octal string to be more consistent with POSIX APIs.
  • Use the validator in fs APIs and process.umask for consistency.
  • Add tests for 32-bit unsigned modes larger than 0o777.

Fixes: https://github.com/nodejs/node/issues/20498

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Merge request reports

Loading