Eat My Data: How Everybody Gets File IO Wrong
Too many applications don’t deal with important files in a safe way. Along with that, they don’t check error codes properly or do things like blindly rely on
fsync()
actually sending data to disk (which becomes a problem if you intend your application to be portable). Write to temp file, close, rename is not a safe operation. We’ll discuss why–along with the various behaviors of different file systems and platforms and all the different ways you can expect your important data to get mangled. More importantly, we’ll talk about how to write code using the POSIX file IO api and get it right-keeping your application portable, fast, and most importantly–respecting the data that users trust in it.
I’d love if there was a recording of this online.