GNOME Bugzilla – Bug 660130
Possible loss of user data when updating mimeapps.list
Last modified: 2011-09-30 03:43:28 UTC
gdesktopfile.c:update_mimeapps_list() Does: key_file = g_key_file_new (); load_succeeded = g_key_file_load_from_file (key_file, filename, G_KEY_FILE_NONE, NULL); if (!load_succeeded || !g_key_file_has_group (key_file, ADDED_ASSOCIATIONS_GROUP)) { g_key_file_free (key_file); key_file = g_key_file_new (); } This will lose all the data in the file if it has no added associations group, which is quite possible. We should only fail if it doesn't have any of the three standard groups.
In theory, we should actually be trying to lock the file as well.
The following fix has been pushed: 5156d1b Prevent data loss in gdesktopappinfo.c
Created attachment 197841 [details] [review] Prevent data loss in gdesktopappinfo.c Don't loose the content of mimeapps.list when it doesn't contain a [Added Associations] group. Pointed out by Alexander Larsson.