I want to draw attention to this bug again. We are now running into this problem on Maemo 5, which is using ubifs as its root filesystem. Not syncing 'properly' on ubifs leads to zero-length files, etc, very much like on ext4.
While the discussions rage about how fsync is not what applications want (I agree, we just want a write barrier), and while filesystems are being changed (hopefully in a way that doesn't need changes in almost all applications anyway to make them robust again), we need to get back robustness for dpkg. Basically, I think we need to put a write barrier into the code so that all filesystem operations done by dpkg are guaranteed to be committed before the update to the status db is committed. This includes all file writes done by maintainer scripts, so it will not be enough to just put fsyncs into dpkg itself. I propose to just put a big "sync" into modstatdb_note_core: diff --git a/lib/dbmodify.c b/lib/dbmodify.c index 87400f1..f4fc586 100644 --- a/lib/dbmodify.c +++ b/lib/dbmodify.c @@ -247,6 +247,8 @@ modstatdb_note_core(struct pkginfo *pkg) { assert(cstatus >= msdbrw_write); + sync(); + varbufreset(&uvb); varbufrecord(&uvb, pkg, &pkg->installed); I hope this is enough and not much too much. We will apply this patch for Maemo 5. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org