guilty of #2. I'll spend part of this afternoon putting in fsyncs(). Pseudo related: I wish I could have anonymous temporary files and associate them with a name later. Temporary name handling is just bugs waiting to happen. Even if you do it securely, how many programmers have a way of cleaning up spurious debris that might be left after an inelegant termination?
The first application I went to fix is in PHP, there does not seem to be an fsync() call in PHP. I may not succeed this afternoon.
How to rewrite files in Linux
21–22 of 22 posts
Re: How to rewrite files in Linux
#22The whole bug thread is good information, but: if application developers actually follow approach #3 en masse, won't that massively slow down the system? I see some cargo-cult potential in fsync-after-every-write here. The emacs example may be correct, but it has a couple steps that require extra thought depending on the context of the rewrite. Where data consistency and security are less necessary, example #2 seems…
Well, we currently effectively have cargo-cult no-fsync, in that application writers who don't consider the matter get the fast-but-risky behaviour.
I think I'd be happy for naive application writers to get safe-and-slow as a default, learning that they can get fast-but-risky over time (as they, hopefully, become aware of when to use the two approaches).
That said, what that would really achieve is an overall impression that "writing files under Linux is slow", so perhaps the current situation is 'best'.