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 776139 - Alert if error saving the password in the secret manager
Alert if error saving the password in the secret manager
Status: RESOLVED FIXED
Product: geary
Classification: Other
Component: client
master
Other Linux
: Normal normal
: ---
Assigned To: Geary Maintainers
Geary Maintainers
: 743839 (view as bug list)
Depends on: 774442
Blocks:
 
 
Reported: 2016-12-15 14:36 UTC by Gautier Pelloux-Prayer
Modified: 2019-12-05 02:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch proposal v1 (1.98 KB, patch)
2016-12-29 16:11 UTC, Gautier Pelloux-Prayer
none Details | Review
patch proposal v2 (1.69 KB, patch)
2017-01-12 17:57 UTC, Gautier Pelloux-Prayer
committed Details | Review
patch2: display inapp notification (1.21 KB, patch)
2017-01-12 17:57 UTC, Gautier Pelloux-Prayer
needs-work Details | Review

Description Gautier Pelloux-Prayer 2016-12-15 14:36:46 UTC
It might be a dev-only issue, but nevertheless here is an issue I have when running geary through another user.

Basically I'm running Geary with "xhost +local && sudo su - another_user 'geary --debug'". However doing that, this custom user does not have access to various dbus objects including org.freedesktop.Secret.

I am fine with that, so each time I open Geary it asks me for the user password. However if the "remember password" box is ticked, Geary will try to save it and will fail with the following error:

> [msg] 15:28:12 2,317884 Remote error from secret service: org.freedesktop.Secret.Error.IsLocked: Cannot create an item in a locked collection
>  [deb] 15:28:12 0,000017 secret-mediator.vala:94: Unable to store password for "org.yorba.geary imap_username:account_01" in libsecret keyring

And since this exception is NOT catched in secret-mediator.vala (set_password_async), it is thrown until geary controller catch it in connect_account_async. It then ends the program with:

>  [deb] 15:34:23 0,000074 geary-controller.vala:1117: Unable to open account Gmail:account_01: Cannot create an item in a locked collection

Again, I can see various solutions:

1) Catch error in secret-mediator.vala and silently ignore it or do something else? (Error popup?) but continuing the program execution since it is a non fatal error.
2) Fix my dev setup to have dbus access. I didn't find anything so far though
3) Something else.
Comment 1 Gautier Pelloux-Prayer 2016-12-29 16:11:35 UTC
Created attachment 342576 [details] [review]
patch proposal v1

Here is a patch attempt to fix that.
Comment 2 Michael Gratton 2017-01-12 00:19:32 UTC
Review of attachment 342576 [details] [review]:

We definitely shouldn't crash, but I don't know if popping up a dialog is great either, since like you, the user may deliberately not have the keyring available.

This might be a good use case for an in-app notification (Bug 774442) in the future, but for now definitely catch the error and maybe just print debug or warning message? You could also show something on the existing status bar, but that might be a lot of work for a corner case.
Comment 3 Gautier Pelloux-Prayer 2017-01-12 17:54:01 UTC
Well I did a ErrorAlert with Bug 774442 in mind actually - I think it's important to inform the user that the password was not saved and that something is going wrong. 
But obviously as is, this popup is a bit annoying (mainly when you modify some account settings, the popup will appear twice - one for IMAP, another one for SMTP). Let's do it in 2 row then, adding a debug log for now but keeping it open until Bug 774442 is resolved?
Comment 4 Gautier Pelloux-Prayer 2017-01-12 17:57:00 UTC
Created attachment 343385 [details] [review]
patch proposal v2
Comment 5 Gautier Pelloux-Prayer 2017-01-12 17:57:54 UTC
Created attachment 343386 [details] [review]
patch2: display inapp notification

To be applied after Bug 774442 lands.
Comment 6 Gautier Pelloux-Prayer 2017-01-31 11:15:23 UTC
Bumping in case you missed in Mike :).
Comment 7 Michael Gratton 2017-02-07 03:11:28 UTC
Review of attachment 343385 [details] [review]:

This also looks good, ta! Pushed to master as 8666594.
Comment 8 Michael Gratton 2017-02-07 03:12:51 UTC
Re-titling to reflect pending patch.
Comment 9 Michael Gratton 2017-10-26 08:16:47 UTC
Review of attachment 343386 [details] [review]:

Okay, less reluctant about this but only if it is using the in-app notification (Bug 774442) framework to do so. I'll marking this as needs-work to integrate it into that and will add a dep on the bug from this one.
Comment 10 Michael Gratton 2017-10-30 21:31:38 UTC
*** Bug 743839 has been marked as a duplicate of this bug. ***
Comment 11 Michael Gratton 2018-07-09 06:15:26 UTC
See also Gitlab issue #30: https://gitlab.gnome.org/GNOME/geary/issues/30
Comment 12 Michael Gratton 2019-12-05 02:03:36 UTC
As of 3.32 the controller is catching errors and reporting them using the standard mechanism to do so, so closing this as fixed.