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

File i/o, case sensitivity and cross-platform behavior #16731

Closed
rjerue opened this issue Nov 3, 2017 · 3 comments
Closed

File i/o, case sensitivity and cross-platform behavior #16731

rjerue opened this issue Nov 3, 2017 · 3 comments
Labels
feature request Issues that request new features to be added to Node.js. fs Issues and PRs related to the fs subsystem / file system.

Comments

@rjerue
Copy link

rjerue commented Nov 3, 2017

So, when using fs commands across platforms, I've noticed some interesting behavior with case sensitivity. On OSes where case sensitivity is not a concern like Windows and OSX, node's file i/o calls work the same with not caring about case sensitivity. Whereas on Linux it does.

For example,

util.promisify(fs.readdir)('./foo/bar.txt').then( files => console.log(file))

and

util.promisify(fs.readdir)('./Foo/bar.txt').then( files => console.log(file))

Will do the same thing on OSX and Windows, however on Ubuntu (which I am using in a production environment), will only see what is actually on the file system. As node aims to be cross-platform it may be beneficial to have the stricter behavior be constant.

@mscdex mscdex added feature request Issues that request new features to be added to Node.js. fs Issues and PRs related to the fs subsystem / file system. labels Nov 3, 2017
@mscdex
Copy link
Contributor

mscdex commented Nov 3, 2017

-1 I would not expect node to perform case-insensitive path lookups on case-sensitive file systems. Not only would it be unexpected, but it could lead to breakage in userland and would probably lead to reduced performance for little benefit.

I do not see this as a cross-platform issue, it is more of a difference in file system behavior. Even on Windows, you can enable case sensitivity for NTFS file systems. Also, the file system used by WSL is case sensitive. What would you do in that case (and WSL is more popular than an explicitly case-sensitive NTFS file system)? Because of this, I do not think it's as simple as saying node should enforce sensitivity one way or the other and/or node should try to smooth over differences in file systems on any given platform, which is way outside the scope of this project.

@rjerue
Copy link
Author

rjerue commented Nov 4, 2017

Yeah, it's not so much a problem, just a quirk in the behavior that I noticed. Often cross-platform things run the same across platforms; this did not. This did not. Sure it is I assume because it actually does calls to the system OS and the OS actually acknowledges if the file or directory is there / what the file or directory is.

Breakage in current codebases is a very significant problem that I see though.

I just didn't know if it was intended behavior or what.

@bnoordhuis
Copy link
Member

I'll close this out. Issues around case (in)sensitivity have been discussed before and the consensus is that we won't (or even reasonably can) paper over them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

No branches or pull requests

3 participants