GNOME Bugzilla – Bug 702785
[PATCH] Unlink ~/.config/dconf/user if it appears corrupted
Last modified: 2013-11-25 02:47:40 UTC
If we're not able to read the file, presently we go into a rather catastropic loop of continually attempting to reopen it. Corruption happens much more recently now from: See https://bugzilla.gnome.org/show_bug.cgi?id=701560 There are various ways we could address this, but if the file is missing the gvdb header, it's likely not recoverable. So this patch changes the user engine lookup to unlink() it, and we'll create a new one. A future refinement might be to detect other forms of corruption and attempt to preserve settings from the file (fsck-like), but really all we're solving in this first pass is cleaning up from clearly broken gvdb databases caused by lack of fsync(). Tested in latest gnome-ostree buildmaster, and doing: as root from a VT. --- engine/dconf-engine-source-user.c | 5 ++++- gvdb/gvdb-reader.c | 32 ++++++++++++++++++++++++++++++++ gvdb/gvdb-reader.h | 4 ++++ tests/dconf-mock-gvdb.c | 8 ++++++++ 4 files changed, 48 insertions(+), 1 deletions(-)
Created attachment 247396 [details] [review] 0001-Unlink-.config-dconf-user-if-it-appears-corrupted.patch
From a very quick search through the patch, it doesn't look like anything is logged when this happens. As the user experience would be something like 'all user settings suddenly and mysteriously reset to default without any obvious indication of why', would it be a good idea to at least emit a log message of some kind when this happens?
Created attachment 247441 [details] [review] updated patch, cleaner, with syslog
Created attachment 247442 [details] [review] Don't leak gerror if it wasn't an INVAL Minor issue noted in self-code-review: we were leaking the gerror if the error was something other than INVAL.
I think the number of users impacted by the ext4 issue was quite small in the end, and aside from that we've never had reports of corrupt dconf database. I'd prefer to keep the failure case as explicit as possible, so let's not do this.