Rename atomicity is not enough

Open
#64 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript

Research direction

No source file or test is named. Start by tracing the library's rename path and read the linked POSIX durability discussion, focusing on opening the containing directory and syncing its file descriptor after rename. Done means the library's durability behavior matches the stated reboot-safety requirement, with verification for the affected path.

Written by the indexing model from the issue text.

Description

http://stackoverflow.com/questions/3764822/how-to-durably-rename-a-file-in-posix

So, you need to open directory where file exists (O_DIRECOTRY), and fsync() it's FD after rename. If not, application may think that rename is durable, but on accidental reboot, old file may appear.

Dominant language
JavaScript
Stars
256
Forks
51
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from npm/write-file-atomic

All issues in npm/write-file-atomic

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.