On Tue, Jun 4, 2013 at 10:31 AM, Lennart Poettering <lenn...@poettering.net> wrote: > On Wed, 29.05.13 08:59, Yang Chengwei (chengwei.y...@intel.com) wrote: > >> > > diff --git a/src/core/manager.c b/src/core/manager.c >> > > index 0508628..467b5ba 100644 >> > > --- a/src/core/manager.c >> > > +++ b/src/core/manager.c >> > > @@ -503,7 +503,7 @@ int manager_new(SystemdRunningAs running_as, Manager >> > > **_m) { >> > > goto fail; >> > > >> > > /* Try to connect to the busses, if possible. */ >> > > - r = bus_init(m, running_as != SYSTEMD_SYSTEM); >> > > + r = bus_init(m, running_as != SYSTEMD_SYSTEM && running_as != >> > > SYSTEMD_USER); >> > > if (r < 0) >> > > goto fail; >> > >> > So, I've looked at this code again as I've spotted this problem over a >> > year ago, and I'm wondering if this entire section should just be >> > removed, since running_as only has 2 values (_SYSTEM and _USER) >> > anyway... >> > >> > Would there be any objection to just dropping these 4 lines entirely? >> > Lennart, Kay? I don't see how we'd have a 3rd manager type here. >> >> Yes, just in that case. If all of you agreed, I'd like submit a V2 to >> drop these lines. > > Hmm, this would break my usual testing routine, where i run user systemd > against a bus daemon that is already running... I have no doubt that > dropping the check entirely is the right way to go eventually, but maybe > we can find a better way so that this continues to work for me until > GNOME has switched over to systemd as service manager.
I'm kinda dumb for not thinking this over, but, if you already have a dbus-daemon running, you have DBUS_SESSION_BUS_ADDRESS set. So, the whole idea of connection to a session bus if DBUS_SESSION_BUS_ADDRESS is unset makes no sense whatsoever. Lennart, would you agree that we could just do something like: if (getenv("DBUS_SESSION_BUS_ADDRESS")) // attempt to init dbus early else // debug message printing out that an attempt to connect to an existing session bus was not done I think that solves your use case, and will remove the whole dbus init attempt for folks running under a user session where this is not needed. Thanks, Auke _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel