Skip to content
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

Stop using process.umask() #22

Closed
bnoordhuis opened this issue Apr 3, 2020 · 1 comment
Closed

Stop using process.umask() #22

bnoordhuis opened this issue Apr 3, 2020 · 1 comment

Comments

@bnoordhuis
Copy link

Refs: nodejs/node#32321

Summary: process.umask() (no args) will be deprecated and removed.

Reviewing this module, it uses process.umask() in roughly this pattern:

const mode = 0o777 & ~process.umask();
fs.mkdirSync(dir, mode);

Computing the file mode that way is superfluous because the operating system applies the umask anyway. It can be replaced with just this:

fs.mkdirSync(dir, 0o777);
@isaacs
Copy link
Owner

isaacs commented Apr 3, 2020

Oh yeah, that is indeed silly. Copied from previous implementation dating back to the dark ages, but I'm not sure it was ever needed.

@isaacs isaacs closed this as completed in 2d42170 Apr 3, 2020
isaacs added a commit that referenced this issue Apr 3, 2020
zertosh pushed a commit to zertosh/v8-compile-cache that referenced this issue May 30, 2020
It's deprecated in the latest Node.js due to being insecure and
it's not necessary to use it in the first place because the umask
is automatically applied when creating the directory.

Refs: nodejs/node#32321
Refs: isaacs/node-mkdirp#22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants