by nathan_phoenix on 1/23/25, 4:28 PM with 119 comments
by continuational on 1/23/25, 5:43 PM
> When they did this, they found that every single piece of software they tested except for SQLite in one particular mode had at least one bug. This isn't a knock on the developers of this software or the software -- the programmers who work on things like Leveldb, LBDM, etc., know more about filesystems than the vast majority programmers and the software has more rigorous tests than most software. But they still can't use files safely every time! A natural follow-up to this is the question: why the file API so hard to use that even experts make mistakes?
by praptak on 1/23/25, 5:57 PM
"If auto_da_alloc is enabled, ext4 will detect the replace-via-rename and replace-via-truncate patterns and [basically save your ass]"[0]
by Retr0id on 1/23/25, 5:46 PM
This is why whenever I need to persist any kind of state to disk, SQLite is the first tool I reach for. Filesystem APIs are scary, but SQLite is well-behaved.
Of course, it doesn't always make sense to do that, like the dropbox use case.
by edgarvaldes on 1/24/25, 2:53 AM
I wonder what is easy.
by gavinhoward on 1/23/25, 6:47 PM
I kinda think, and I could be wrong, that SQLite rollback would not have any vulnerabilities with `synchronous=EXTRA` (and `fullfsync=F_FULLFSYNC` on macOS [2]).
by wruza on 1/23/25, 5:41 PM
by ryao on 1/23/25, 9:56 PM
ZFS fsync will not fail, although it could end up waiting forever when a pool faults due to hardware failures:
https://papers.freebsd.org/2024/asiabsdcon/norris_openzfs-fs...
by einpoklum on 1/23/25, 11:17 PM
> In conclusion, computers don't work (but I guess you already know this...
by 1vuio0pswjnm7 on 1/24/25, 12:10 AM
https://archive.wikiwix.com/cache/index2.php?rev_t=&url=http...
by AutistiCoder on 1/24/25, 3:49 PM
closest I come to working with files is localStorage, but that's thread safe.
by jheriko on 1/24/25, 12:23 PM
its not a real problem for most modern developers.
pwrite? wtf?
not one mention of fopen.
granted some of the fine detail discussion is interesting, but it doesn't make practical sense since about 1990.
by userbinator on 1/23/25, 9:26 PM
Meanwhile you can read plenty of stories of others having the exact opposite experience.
If you keep losing data to power losses or crashes, perhaps fix the cause of that? It doesn't make sense to try to work around it.