After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 637956 - GKeyfileSettingsBackend should ignore file deletions
GKeyfileSettingsBackend should ignore file deletions
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gsettings
2.27.x
Other Linux
: Normal normal
: ---
Assigned To: Allison Karlitskaya (desrt)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-12-24 14:31 UTC by Matthew Barnes
Modified: 2013-10-28 00:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (540 bytes, patch)
2010-12-24 14:32 UTC, Matthew Barnes
committed Details | Review

Description Matthew Barnes 2010-12-24 14:31:35 UTC
It's probably debatable what should happen when a GKeyfileSettingsBackend sees its keyfile suddenly disappear, but the current behavior isn't working for me, and I can't think of any other use cases nor workarounds for my use case.

The problem:

GKeyfileSettingsBackend places a file monitor on its keyfile and reloads the file any time the file monitor trips, regardless of the event.  In the event of a file deletion, all the keys suddenly reset back to their default values.  If any of those keys have been bound to GObject properties, that's most likely going to trigger "notify" signal emissions.  The signal emissions will make the backend think there's changes to be written, and it will immediately recreate the deleted key file with default values.

Why that's a problem:

In my account management redesign for Evolution, data sources (that is, calendars, address books, mail accounts, etc.) are represented by key files in a special directory which is monitored for file deletions and creations.  Deleting a data source is implemented by simply deleting the corresponding keyfile.  Evolution and the D-Bus services will each see the file deletion and take appropriate cleanup actions.  So when I delete a keyfile I want it to stay gone, at least long enough for the application to react first.

Proposed solution:

GKeyfileSettingsBackend should ignore the file deletion event so its GKeyFile remains in tact.  The file will be recreated from the GKeyFile if further changes are applied.  This will give applications a chance to react to the file deletion before the backend recreates it.
Comment 1 Matthew Barnes 2010-12-24 14:32:51 UTC
Created attachment 177017 [details] [review]
Proposed patch

One-line change.
Comment 2 Allison Karlitskaya (desrt) 2013-10-24 18:12:05 UTC
Review of attachment 177017 [details] [review]:

This seems sane, thanks.