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 765994 - org.gnome.OnlineAccounts.Account:IsTemporary is not being set
org.gnome.OnlineAccounts.Account:IsTemporary is not being set
Status: RESOLVED FIXED
Product: gnome-online-accounts
Classification: Core
Component: general
3.18.x
Other All
: Normal normal
: ---
Assigned To: GNOME Online Accounts maintainer(s)
GNOME Online Accounts maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2016-05-04 16:06 UTC by Debarshi Ray
Modified: 2016-06-07 14:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
daemon: Set GoaAccount:is-temporary (1.71 KB, patch)
2016-05-04 16:07 UTC, Debarshi Ray
committed Details | Review
utils: Avoid spurious key file updates (3.38 KB, patch)
2016-06-02 18:54 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2016-05-04 16:06:55 UTC
Turns out that we totally forgot to set the org.gnome.OnlineAccounts.Account:IsTemporary D-Bus property. We should set it.
Comment 1 Debarshi Ray 2016-05-04 16:07:40 UTC
Created attachment 327307 [details] [review]
daemon: Set GoaAccount:is-temporary
Comment 2 Debarshi Ray 2016-05-06 10:28:58 UTC
Comment on attachment 327307 [details] [review]
daemon: Set GoaAccount:is-temporary

Seems to work as expected. Pushed to master, gnome-3-20 and gnome-3-18.
Comment 3 Debarshi Ray 2016-06-02 18:42:45 UTC
(In reply to Debarshi Ray from comment #2)
> Seems to work as expected. Pushed to master, gnome-3-20 and gnome-3-18.

Unfortunately, it doesn't work so well.

The problem here is that gdbus-codegen-ed code emits a property change notification even if the value hasn't actually changed. This is because it doesn't use G_PARAM_EXPLICIT_NOTIFY when creating the property, even though the generated code to set the property tries to avoid needless updates.

When we call goa_account_set_is_temporary to update the GoaObject, after a modification to the key file, it causes the Kerberos provider (notify_is_temporary_cb) to again update the key file. That triggers another update of the GoaObject and this goes on indefinitely.

The correct fix would be to teach gdbus-codegen about G_PARAM_EXPLICIT_NOTIFY. Meanwhile, we can fix our goa_utils_keyfile_* functions to avoid spurious updates.

This hasn't been a problem so far because:

(a) Notifications from the {mail, chat, etc.}-disabled properties are only emitted through the GtkSwitch (which leads to the key file being updated). We never update those properties when the key file is modified. (Maybe we should?) Hence we don't form an endless loop.

(b) We were only setting org.gnome.OnlineAccounts.Account:IsTemporary when creating a permanent account, or when someone flipped the GtkSwitch. We were not  updating it when the key file is modified.
Comment 4 Debarshi Ray 2016-06-02 18:47:36 UTC
(In reply to Debarshi Ray from comment #3)
> (b) We were only setting org.gnome.OnlineAccounts.Account:IsTemporary when
> creating a permanent account, or when someone flipped the GtkSwitch. We were
> not  updating it when the key file is modified.

We need to update the property when the key file is modified to ensure that temporary accounts are marked as such by the D-Bus property.

Creating a temporary account involves goa-identity-service calling org.gnome.OnlineAccounts.Manager:AddAccount, which leads to IsTemporary=true being written to the key file. So, unless we react to the modification, the D-Bus property won't reflect what is in the key file.
Comment 5 Debarshi Ray 2016-06-02 18:54:45 UTC
Created attachment 328994 [details] [review]
utils: Avoid spurious key file updates
Comment 6 Debarshi Ray 2016-06-07 14:55:15 UTC
Comment on attachment 328994 [details] [review]
utils: Avoid spurious key file updates

I tested this for a few days and it appears to work as intended. I am pushing this now (once again without a review). Let me know if something breaks or if you don't like something.