Skip to content

Conversation

@saghul
Copy link
Member

@saghul saghul commented Apr 12, 2015

For posterity, these are the rules for access on Windows (taken from
CPython's implementation), Access is possible if:

  • Write access wasn't requested
  • The file isn't read-only
  • It's a directory (directories cannot be read-only on Windows)

R=@piscisaureus
/cc @cjihrig

Should fix: nodejs/node#1397

@saghul
Copy link
Member Author

saghul commented Apr 12, 2015

@piscisaureus
Copy link
Contributor

Definitely an improvement - LGTM.

My general beef with the current API is that it doesn't "check" whether the file is actually writable (which is controlled by the ACL and not the arcane readonly flag). A strategy may also be to just try and open the file for writing - although that would also incorrectly locked files as unaccessible.

For posterity, these are the rules for access on Windows (taken from
CPython's implementation), Access is possible if:

* Write access wasn't requested
* The file isn't read-only
* It's a directory (directories cannot be read-only on Windows)

PR-URL: libuv#316
Reviewed-By: Bert Belder <[email protected]>
@saghul saghul merged commit 7dcc3e0 into libuv:v1.x Apr 13, 2015
@saghul
Copy link
Member Author

saghul commented Apr 13, 2015

Thanks Bert, landed. I'm all in for improving it further, can you point me to those ACL related APIs? Do we already use them similarly anywhere in the code? FWIW, I wouldn't want to try and open the file, the user could just use uv_fs_open in that case, I see uv_fs_access as a LBYL style API, which of course could fail between the user checking, and the user acting.

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 this pull request may close these issues.

fs.accessSync() with W_OK throws EPERM for directories in Windows

2 participants