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 628302 - Drop --start and --foreground option when autostarted via dbus activation
Drop --start and --foreground option when autostarted via dbus activation
Status: RESOLVED INCOMPLETE
Product: gnome-keyring
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: GNOME keyring maintainer(s)
GNOME keyring maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2010-08-30 10:24 UTC by Tomeu Vizoso
Modified: 2012-03-15 09:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Drop --start and --foreground option when autostarted via dbus activation (1017 bytes, patch)
2010-08-30 10:24 UTC, Tomeu Vizoso
none Details | Review
test case (119 bytes, text/x-python-script)
2010-09-02 10:13 UTC, Tomeu Vizoso
  Details
Initialize the dbus service (even if a daemon is already running) if the --start and --foreground flags were passed (1.18 KB, patch)
2010-09-02 10:29 UTC, Tomeu Vizoso
none Details | Review

Description Tomeu Vizoso 2010-08-30 10:24:23 UTC
I guess that after https://bugzilla.gnome.org/show_bug.cgi?id=611002 was fixed,
the behavior of the combination of --start and --foreground had changed.
Comment 1 Tomeu Vizoso 2010-08-30 10:24:25 UTC
Created attachment 169043 [details] [review]
Drop --start and --foreground option when autostarted via dbus activation

Otherwise this will be a no-op as g-k-d will enter into an infinite sleep
loop after noticing that another daemon is running in another session.
Comment 2 Stef Walter 2010-08-31 22:09:36 UTC
About --foreground: Doesn't dbus activation expect the process not to exit? 

Secondly why would we drop --start. The whole concept is to start it in an already running daemon if possible.
Comment 3 Tomeu Vizoso 2010-09-02 10:05:04 UTC
Well, what dbus activation expects is that after it starts the executable specified in .service, it will start listening in the bus indicated by the environment variables.

What happens right now (AFAICS) is that a process starts and is kept in an infinite sleep loop. That process is not listening in the bus at all so activation has failed.

If those flags should be working in accordance with what dbus activation expects, then I could come with a patch in that direction.
Comment 4 Tomeu Vizoso 2010-09-02 10:13:21 UTC
Created attachment 169342 [details]
test case

To reproduce this issue, launch this script inside a new dbus session bus:

dbus-launch --exit-with-session ./activate_keyring.py

You will see how the call times out because gnome-keyring-daemon doesn't initializes itself in the bus.
Comment 5 Tomeu Vizoso 2010-09-02 10:29:48 UTC
Created attachment 169343 [details] [review]
Initialize the dbus service (even if a daemon is already running) if the --start and --foreground flags were passed
Comment 6 Tomeu Vizoso 2010-09-02 10:31:31 UTC
(In reply to comment #5)
> Created an attachment (id=169343) [details] [review]
> Initialize the dbus service (even if a daemon is already running) if the
> --start and --foreground flags were passed

This (and also the original patch) has the downside that the service will have to ask the user to unlock the keyring. Any ideas about how to start a new dbus service but with the keyring unlocked if a service is already running in another session bus?
Comment 7 Stef Walter 2010-09-05 01:10:13 UTC
What are you trying to accomplish?

It's unlikely that one gnome-keyring-daemon process can share the unlocked state of various keyrings and keys with another gnome-keyring-process.
Comment 8 Tomeu Vizoso 2010-09-09 09:59:51 UTC
(In reply to comment #7)
> What are you trying to accomplish?

In some cases there's value in having more than one session bus in the same session. The particular case I'm behind is running a Sugar session inside a GNOME one.

> It's unlikely that one gnome-keyring-daemon process can share the unlocked
> state of various keyrings and keys with another gnome-keyring-process.

I understand it, guess that asking for the password during dbus activation is correct then.
Comment 9 Stef Walter 2010-09-11 19:05:34 UTC
Are you sharing all the other environment variables between the main GNOME session and the sugar one? Obviously not the DBUS_SESSION_BUS_ADDRESS. In order for gnome-keyring to work for you you need to clear all gnome-keyring related environment variables in the child session:

 GPG_AGENT_INFO
 SSH_AUTH_SOCK
 GNOME_KEYRING_CONTROL
 GNOME_KEYRING_PID

If you share these environment variables with your sub-session (sugar) then all sorts of things won't work as expected.

The gnome-keyring startup process is rather complex, because it brings together many components in the system. You can read details about it here:

http://live.gnome.org/GnomeKeyring/RunningDaemon
Comment 10 Sascha Silbe 2010-10-27 16:02:04 UTC
Any progress on this bug? Is Tomeus patch ready to go in?
Comment 11 Stef Walter 2010-11-07 14:25:16 UTC
The patch doesn't actually fix the core issue. Running a gnome-keyring-daemon under an alternate dbus session needs more than just --start removed. It needs a new environment, in particular the above mentioned environment variables cleared.
Comment 12 Stef Walter 2012-03-15 09:38:41 UTC
No further response on this. Closing the bug.