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

node: fs.mkdir sometimes fails to set dir permission correctly #1893

Closed
kt3k opened this issue Feb 8, 2022 · 2 comments · Fixed by #1895
Closed

node: fs.mkdir sometimes fails to set dir permission correctly #1893

kt3k opened this issue Feb 8, 2022 · 2 comments · Fixed by #1895
Assignees

Comments

@kt3k
Copy link
Member

kt3k commented Feb 8, 2022

While running yarn install (or yarn add <mod>) in compat mode, there are some little chance when fs.mkdir fails to set the directory permission correctly. This fails yarn install sometimes (the probability of failure is very high for modules with many dependencies)

スクリーンショット 2022-02-08 20 13 28

In the above screenshot, npm-debug-2.6.9-5d128515df134ff327e90a4c93f4e077a536341f-integrity and npm-mime-types-2.1.34-5a712f9ec1503511a945803640fafe09d3793c24-integrity are created with wrong dir permission (0o000).

This happens for random directories for each attempt

part of denoland/deno#13420

  • platform: macOS
@kt3k
Copy link
Member Author

kt3k commented Feb 8, 2022

Note: umask is always 22. The given mode (file permission) is always 0o755.

@kt3k
Copy link
Member Author

kt3k commented Feb 8, 2022

hmm, disabling Deno.umask() call seems fixing the issue.

You can reproduce the issue with following scripts and command:

test.js

for (const _ of Array(30)) {
  const dir = Math.random().toString(36).slice(2);
  Deno.umask();
  Deno.mkdir(`foo/${dir}`, { mode: 0o755, recursive: false });
}
sudo rm -rf foo && mkdir foo && deno run -A --unstable test.js; ls -la foo

and you'll see sometimes some directories are created with 0o000 permission

スクリーンショット 2022-02-09 2 52 18

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

Successfully merging a pull request may close this issue.

1 participant