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

fs.mkdir recursive edge case potential issues #25110

Closed
coreyfarrell opened this issue Dec 18, 2018 · 1 comment
Closed

fs.mkdir recursive edge case potential issues #25110

coreyfarrell opened this issue Dec 18, 2018 · 1 comment
Assignees
Labels
fs Issues and PRs related to the fs subsystem / file system. windows Issues and PRs related to the Windows platform.

Comments

@coreyfarrell
Copy link
Member

  • Version: v10.14.2
  • Platform: Linux lt2 4.19.8-200.fc28.x86_64 deps: update openssl to 1.0.1j #1 SMP Mon Dec 10 15:43:40 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem: fs

Example Code:

const fs = require('fs');
fs.mkdirSync('/', {recursive: true, mode: 0o777});
  • In Windows this results in an EPERM exception.
  • On my Linux system this does not attempt to chmod the existing path, it reports success as the path already exists even though the mode is wrong.

The same occurs with fs.mkdir, I used fs.mkdirSync in the example as the code is simpler.

I've uncovered these edge cases via sindresorhus/make-dir#7 where I'm working on making that module use the native recursive mkdir when possible. The plan is for make-dir@2 to emulate the native fs.mkdir recursive for older versions of node, so I'm hoping for clarification on these two potential issues.

CC @bcoe

@Fishrock123 Fishrock123 added the fs Issues and PRs related to the fs subsystem / file system. label Dec 19, 2018
@bcoe
Copy link
Contributor

bcoe commented Dec 21, 2018

@coreyfarrell thanks for finding this, feel free to ping me in slack and we can see if we can't fix this.

@bcoe bcoe self-assigned this Dec 21, 2018
@Trott Trott added the windows Issues and PRs related to the Windows platform. label Jan 4, 2019
@bcoe bcoe closed this as completed in e7c6f4f Jan 6, 2019
addaleax pushed a commit that referenced this issue Jan 9, 2019
Fixes: #25110

PR-URL: #25340
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ben Coe <bencoe@gmail.com>
refack pushed a commit to refack/node that referenced this issue Jan 14, 2019
Fixes: nodejs#25110

PR-URL: nodejs#25340
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ben Coe <bencoe@gmail.com>
BridgeAR pushed a commit to BridgeAR/node that referenced this issue Jan 16, 2019
Fixes: nodejs#25110

PR-URL: nodejs#25340
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ben Coe <bencoe@gmail.com>
BethGriggs pushed a commit that referenced this issue Apr 28, 2019
Fixes: #25110

PR-URL: #25340
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ben Coe <bencoe@gmail.com>
BethGriggs pushed a commit that referenced this issue May 10, 2019
Fixes: #25110

PR-URL: #25340
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ben Coe <bencoe@gmail.com>
MylesBorins pushed a commit that referenced this issue May 16, 2019
Fixes: #25110

PR-URL: #25340
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ben Coe <bencoe@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

4 participants