Sitelet https://github.com/nodejs/node/issues/16731
Skip to content

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

Description

@rjerue

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.

Activity

  1. added
    feature requestIssues requesting new Node.js features.
    fsIssues and PRs related to file-system APIs and the fs module.
    on Nov 3, 2017
  2. mscdex commented on Nov 3, 2017

    @mscdex
    Contributor

    -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.

  3. rjerue commented on Nov 4, 2017

    @rjerue
    Author

    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.

  4. bnoordhuis commented on Nov 6, 2017

    @bnoordhuis
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues requesting new Node.js features.fsIssues and PRs related to file-system APIs and the fs module.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions