Skip to content

osx filesystem writes are not always guaranteed to match requested casing #25469

Closed
@cdaringe

Description

@cdaringe

Version: 10.12.0
Platform: Darwin m-c02x6042jgh7 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64

problem

  • fs.writeFile isn't guaranteed to match the requested filename casing.

example:

  • fs.writeFile('/path/to/Thing.js', ...) may generate /path/to/Thing.js, but, a subsequent process that runs
  • fs.writeFile('/path/to/thing.js', ...) may generate /path/to/Thing.js, instead of /path/to/thing.js

this occurs when writing a file that does not exist, but previously existed in different casing.

reproduction

it's tricky. i've tried--but i cannot generate a set of reliable conditions that induces the failure.

i've observed this twice in the wild now, on two different OSX machines.

  1. 1st was back in 2017, where i thought the fault was with nyc, as seen in Old removed files seem to stay cached in reports istanbuljs/nyc#644
  2. 2nd was today, in typescript, as shown in this live demonstration: https://www.youtube.com/watch?v=bS50DmFZCJw&feature=youtu.be

i'm not 100% convinced it's even a node bug--it could very well be an OSX issue. i found that restarting my system resolved one occurrence of the failure, but not all.

sorry that i cannot reproduce reliably. however, it's the repeatability of which is in fact the problem that i am reporting! :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    fsIssues and PRs related to the fs subsystem / file system.macosIssues and PRs related to the macOS platform / OSX.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions