Applications launched from dbus missing SESSION_MANAGER env. var.



  I have a problem with a program that behaves badly when launched from
dbus[1], as opposed from starting manually from terminal, run dialog, or
deskbar applet.  To see what was going on, I extracted the environment
of the process in both situations.  The attached diff shows how the
environments differ (env2.good = launched from deskbar, env2.bad =
launched by dbus).  Besides the difference in DISPLAY (from "1.0" to
"1"), the missing SESSION_MANAGER variable jumped to my attention, as
well as missing GNOME_KEYRING_SOCKET.

I think I can explain what happens:
     1. 1- dbus-session is executed first, which sets
        DBUS_SESSION_BUS_ADDRESS for children;
     2. 2- gnome-session is executed next, as a child of dbus-session,
        and it sets SESSION_MANAGER for children.

  So, it's easy to see that processes launched by gnome-session inherit
both DBUS_SESSION_BUS_ADDRESS and SESSION_MANAGER.  However, processes
launched by dbus only receive DBUS_SESSION_BUS_ADDRESS, because dbus
doesn't notice the SESSION_MANAGER variable set inside gnome-session and
its children.

  So I reckon we may have a potencial problem in the future, with
increasingly more applications using D-BUS for automation.  I don't know
the solution, but it seems like a cross-product interaction problem and
so I write here in hope to raise awareness for the issue, at least...


[1] dbus.SessionBus().start_service_by_name(...)


-- 
Gustavo J. A. M. Carneiro
<gjc inescporto pt> <gustavo users sourceforge net>
The universe is always one step beyond logic
--- env2.good	2006-03-12 19:02:35.000000000 +0000
+++ env2.bad	2006-03-12 19:02:41.000000000 +0000
@@ -1,12 +1,12 @@
 DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-HCEB013jC1,guid=0bfe134459053cb4f3867b0277d10f00
+DBUS_STARTER_ADDRESS=unix:abstract=/tmp/dbus-HCEB013jC1,guid=0bfe134459053cb4f3867b0277d10f00
+DBUS_STARTER_BUS_TYPE=session
 DESKTOP_SESSION=gnome
-DISPLAY=:1.0
+DISPLAY=:1
 GDM_LANG=en_US.UTF-8
 GDMSESSION=gnome
 GDM_XSERVER_LOCATION=local
-GNOME_KEYRING_SOCKET=/tmp/keyring-6ub554/socket
 GPG_AGENT_INFO=/tmp/gpg-iLCOc7/S.gpg-agent:5027:1
-GTK_RC_FILES=/etc/gtk/gtkrc:/home/gjc/.gtkrc-1.2-gnome2
 HOME=/home/gjc
 LANG=en_US.UTF-8
 LANGUAGE=en_US.UTF-8
@@ -16,7 +16,6 @@
 LOGNAME=gjc
 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games
 PWD=/home/gjc
-SESSION_MANAGER=local/emperor.homelinux.net:/tmp/.ICE-unix/4940
 SHELL=/bin/bash
 SHLVL=0
 SSH_AGENT_PID=5036


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]