Sublime Forum

Sublime can lose data on power loss due to missing directory fsync

#1

On Linux, Sublime already tries reasonably well to write files to disk safely (against power loss) by using the fsync() syscall that POSIX provides for this purpose.

However, it doesn’t do this enough: It uses it only on the target file, but to ensure the file really exists, it should use it on the containing directory as well.

Because it doesn’t do this, it’s possible that Sublime loses substantial amount of data during power loss, and the magic “everything reappears when I restart sublime after an accidental force reboot” doesn’t work reliably.

I have written down the details of this in:

The fix should be very simple; I have written it into the issue.

Dear developers, please fix it so that we don’t lose data. Thanks!

3 Likes

#2

As a random user, I felt the urge to tell you that your issue is very informative and descriptive, and it tought me some really interesting stuff. Thank you for that! :wink:

I wish all of the issues were written this nice.

4 Likes

#3

Hey, thanks! That is very encouraging.

Being a programmer as well, I’m convinced that my best bet to get an issue fixed is to explain it as well as possible and to reduce the effort on the maintainer’s side as much as I can. I hope it works out here too!

5 Likes