You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
We have found that Atom is overwriting file using fs.writeFileSync() in both TextBuffer::saveAs and writing a configuration file. Note that fs.writeFileSync() opens a file with O_TRUNC flag. Imagine that there is a system crash in between, all data may be gone, leaving a blank file in the file-system. Our automated tool found this potential crash unsafety. This is particularly important when there is no backup file -- even if no backup file means less guarantee (the backup file treatment is correct).
The correct way to save a file: (1) write contents to a backup file; (2) rename the backup to the original file. The key is that (2) is ensured to be atomic by modern file-system implementations (like ext4). It is optional to add a fdatasync() between (1) and (2) in Linux, though I am not quite sure of behaviors under Windows.
This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!
Activity
lee-dohm commentedon Jan 28, 2016
This is a duplicate of #3158. See the thread there for our investigations into and the inherent problems with atomic writes.
lock commentedon Apr 16, 2018
This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!