[Sugar-devel] Enable gnome-keyring to autostart in sugar-emulator

Caspar Bothmer caspar at activitycentral.com
Tue Jul 3 07:53:18 EDT 2012


Hello Daniel,

sorry, been busy...

Sascha and me have discussed this issue thoroughly. The diff itself is easy,
the reasoning behind is not.

So we decided just to tell you how we would write this commit message and
the diff to reflect the situation.  The commit message will become the
entry in git log.  It's not enough to tell in your own words, what the diff
is doing and giving the place, where this solution is outlined.
You need to extract the relevant information, what you do and why.

Caspar


Subject: Enable gnome-keyring-daemon to start inside the emulated session.

We have the following situation: there is an instance of gnome-keyring-daemon
running on the machine.  But sugar-emulator can't access this instance of
gnome-keyring-daemon, as it is outside the scope of sugar-emulator and not
registered with the D-Bus session bus started by sugar-emulator.
D-Bus tries to start a new instance of gnome-keyring-daemon, which fails due
to a set of environment variables related to gnome-keyring-daemon.  These
essentially make gnome-keyring-daemon try to initialize the existing instance
of gnome-keyring-daemon outside the scope of sugar-emulator.
By removing these environment variables, D-Bus can start a new instance of
gnome-keyring-daemon and register with the D-Bus session.

See
https://bugzilla.gnome.org/show_bug.cgi?id=628302
and
https://live.gnome.org/GnomeKeyring/RunningDaemon

for more information.

---
bin/sugar.in                |    6 ------
 src/jarabe/util/emulator.py |    7 +++++++
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/bin/sugar.in b/bin/sugar.in
index 12098db..2df0ab8 100644
--- a/bin/sugar.in
+++ b/bin/sugar.in
@@ -62,12 +62,6 @@ export LANGUAGE="${LANGUAGE:-${LANG}}"
 # Set Sugar's telepathy accounts directory
 export MC_ACCOUNT_DIR=$HOME/.sugar/$SUGAR_PROFILE/accounts
 
-# Workaround until gnome-keyring-daemon lets dbus activate it
-# https://bugzilla.gnome.org/show_bug.cgi?id=628302
-if test "$SUGAR_EMULATOR" = "yes" -a "$(type gnome-keyring-daemon)"; then
-    gnome-keyring-daemon --components=secrets &
-fi
-
 # Source language settings and debug definitions
 if [ -f ~/.i18n ]; then
         . ~/.i18n
diff --git a/src/jarabe/util/emulator.py b/src/jarabe/util/emulator.py
index fda1b59..db34190 100644
--- a/src/jarabe/util/emulator.py
+++ b/src/jarabe/util/emulator.py
@@ -120,6 +120,13 @@ def _start_window_manager():
 
 
 def _setup_env(display, scaling, emulator_pid):
+    # We need to remove the environment related to gnome-keyring-daemon,
+    # so a new instance of gnome-keyring-daemon can be started and
+    # registered properly.
+    for variable in ['GPG_AGENT_INFO', 'SSH_AUTH_SOCK',
+                     'GNOME_KEYRING_CONTROL', 'GNOME_KEYRING_PID']:
+        if variable in os.environ:
+            del os.environ[variable]
+
     os.environ['SUGAR_EMULATOR'] = 'yes'
     os.environ['GABBLE_LOGFILE'] = os.path.join(
             env.get_profile_path(), 'logs', 'telepathy-gabble.log')


More information about the Sugar-devel mailing list