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.open differences on windows vs *nix #3643

Closed
evanlucas opened this issue Nov 3, 2015 · 3 comments
Closed

fs.open differences on windows vs *nix #3643

evanlucas opened this issue Nov 3, 2015 · 3 comments
Labels
doc Issues and PRs related to the documentations. fs Issues and PRs related to the fs subsystem / file system. libuv Issues and PRs related to the libuv dependency or the uv binding.

Comments

@evanlucas
Copy link
Contributor

If you create a directory, and then try to use fs.open to open it, you get differing behavior on windows and *nix if the flags are a+.

Example:

// OS X
fs.open('<directory>', 'a+', console.log)
// => [Error: EISDIR: illegal operation on a directory, open <directory>]

// Windows
fs.open('<directory>', 'a+', console.log)
// => null <fd>

After looking through the libuv code, it looks like https://github.com/libuv/libuv/blob/v1.x/src/win/fs.c#L479-L480 is responsible for this. Is this intended or should this operation show the same behavior on all platforms?

@mscdex mscdex added fs Issues and PRs related to the fs subsystem / file system. windows Issues and PRs related to the Windows platform. and removed windows Issues and PRs related to the Windows platform. labels Nov 3, 2015
@Fishrock123 Fishrock123 added the libuv Issues and PRs related to the libuv dependency or the uv binding. label Nov 3, 2015
@bnoordhuis
Copy link
Member

Libuv lets you do that on freebsd as well, FWIW, so it's not entirely without precedent.

@jasnell
Copy link
Member

jasnell commented Apr 9, 2016

I believe this is working as expected but additional documentation may be worthwhile.
@nodejs/documentation

@eljefedelrodeodeljefe
Copy link
Contributor

Added a PR for this.

joelostrowski pushed a commit to joelostrowski/node that referenced this issue Apr 25, 2016
Note describing platform specific differences in fs.open

E.g. fs.open('<directory>', 'a+', console.log)

Fixes: nodejs#3643
PR-URL: nodejs#6136
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
jasnell pushed a commit that referenced this issue Apr 26, 2016
Note describing platform specific differences in fs.open

E.g. fs.open('<directory>', 'a+', console.log)

Fixes: #3643
PR-URL: #6136
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@sam-github sam-github added doc Issues and PRs related to the documentations. and removed doc Issues and PRs related to the documentations. labels Dec 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. fs Issues and PRs related to the fs subsystem / file system. libuv Issues and PRs related to the libuv dependency or the uv binding.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants