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.accessSync not working properly on Windows #2949

Closed
adnan-kamili opened this issue Sep 18, 2015 · 4 comments
Closed

fs.accessSync not working properly on Windows #2949

adnan-kamili opened this issue Sep 18, 2015 · 4 comments
Labels
fs Issues and PRs related to the fs subsystem / file system. libuv Issues and PRs related to the libuv dependency or the uv binding. windows Issues and PRs related to the Windows platform.

Comments

@adnan-kamili
Copy link

On Windows I have a shared folder with only Read permissions and the following code fails to detect that folder doesn't have write permissions:

fs.accessSync("\\\\machine1\\shared",fs.W_OK);

I expect it to throw exception as per the docs.

@targos targos added the fs Issues and PRs related to the fs subsystem / file system. label Sep 18, 2015
@adnan-kamili adnan-kamili changed the title Node.js fs.accessSync not working properly on Windows fs.accessSync not working properly on Windows Sep 18, 2015
@bnoordhuis
Copy link
Member

What does fs.statSync() print for that folder?

@bnoordhuis bnoordhuis added the windows Issues and PRs related to the Windows platform. label Sep 18, 2015
@adnan-kamili
Copy link
Author

Following is the output of fs.statSync()

{ 
  dev: -1710066481,
  mode: 16822,
  nlink: 1,
  uid: 0,
  gid: 0,
  rdev: 0,
  blksize: undefined,
  ino: 562949953426603,
  size: 0,
  blocks: undefined,
  atime: Fri Sep 18 2015 16:13:15 GMT+0530 (India Standard Time),
  mtime: Fri Sep 18 2015 16:13:15 GMT+0530 (India Standard Time),
  ctime: Fri Sep 18 2015 16:13:15 GMT+0530 (India Standard Time),
  birthtime: Fri Sep 18 2015 15:46:37 GMT+0530 (India Standard Time) 
}

@bnoordhuis
Copy link
Member

Thanks, I think I understand what the issue is. See #1397 for background, it's the expected behavior insofar that it's not really possible to determine whether a folder is writable (without actually opening it) because that's controlled by the ACL, not the folder's metadata.

/cc @nodejs/platform-windows - Maybe it's a libuv issue, see also this comment.

@bnoordhuis
Copy link
Member

Per #2949 (comment), I don't think a reliable fix is possible so I'll close this out. Trying to open the folder in write-only mode isn't reliable either, it misreports when the folder is locked.

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. libuv Issues and PRs related to the libuv dependency or the uv binding. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

4 participants