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
We have traced down that when saving a file, the library finally invokes a sequence like the following (we believe that is called by brackets/src/file/FileUtils.js:110):
When the system crashes in between, there may be only partial data persisted in the file system (remaining is lost). The recommended way is to save a file is first write to a temporary file, and then rename it to replace the original file, to ensure that every user-data is manipulated atomically.
This problem is discovered by an automated tool, and this generally affects almost any Linux distribution. I did not find the exact reference material for Node, but here are some arguments for POSIXly correct ways to overwrite a file: http://stackoverflow.com/questions/1812115/how-to-safely-write-to-a-file.
The text was updated successfully, but these errors were encountered:
Comment by petetnt Wednesday Jan 20, 2016 at 07:06 GMT
I was thinking about this when debugging adobe/brackets#11826 yesterday. It wasn't the cause for that particular issue, but what@jiangyy states good to me.
Wednesday Jan 20, 2016 at 05:25 GMT
Originally opened as adobe/brackets#12103
We have traced down that when saving a file, the library finally invokes a sequence like the following (we believe that is called by brackets/src/file/FileUtils.js:110):
(1) fd = open(somefile, O_TRUNC)
(2) write(fd, something)
(3) ...
(4) close(fd)
When the system crashes in between, there may be only partial data persisted in the file system (remaining is lost). The recommended way is to save a file is first write to a temporary file, and then rename it to replace the original file, to ensure that every user-data is manipulated atomically.
This problem is discovered by an automated tool, and this generally affects almost any Linux distribution. I did not find the exact reference material for Node, but here are some arguments for POSIXly correct ways to overwrite a file: http://stackoverflow.com/questions/1812115/how-to-safely-write-to-a-file.
The text was updated successfully, but these errors were encountered: