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

Stale process.umask() value #18

Closed
RyanZim opened this issue Feb 1, 2020 · 1 comment · Fixed by #19
Closed

Stale process.umask() value #18

RyanZim opened this issue Feb 1, 2020 · 1 comment · Fixed by #19

Comments

@RyanZim
Copy link
Contributor

RyanZim commented Feb 1, 2020

I'm working on jprichardson/node-fs-extra#619; and experimenting with switching our current implementation (an internal fork of mkdirp@0.x) to an internal fork of make-dir. In testing against our existing test suite, I discovered what seems to be a bug, and thought I'd report it upstream here.

The default mode is based on process.umask(), which is set here:

mode: 0o777 & (~process.umask()),

However, this is one static value, based on the process.umask() value at require-time. If the user sets the umask with process.umask(value) after requiring make-dir, the new umask will not be respected.

Fix for this would be to fetch defaults in a function, called at runtime, to get a fresh process.umask() call for every method call. Happy to submit a PR if this is confirmed as a bug.

@sindresorhus
Copy link
Owner

Yup. That looks like a bug. A PR would be awesome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants