Re: [systemd-devel] [PATCH] Delay dbus connection for user session

2013-06-20 Thread Lennart Poettering
On Wed, 19.06.13 20:58, Kok, Auke-jan H (auke-jan.h@intel.com) wrote:

  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.

Indeed. Happy to take such a patch!

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] Delay dbus connection for user session

2013-06-19 Thread Kok, Auke-jan H
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


Re: [systemd-devel] [PATCH] Delay dbus connection for user session

2013-06-04 Thread Lennart Poettering
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.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] Delay dbus connection for user session

2013-05-28 Thread Kok, Auke-jan H
On Tue, May 28, 2013 at 3:00 AM, Chengwei Yang chengwei.y...@intel.com wrote:
 Currently, if we have a user session, when systemd user session start,
 just like the situation for it as PID 1, dbus-daemon isn't ready at that
 moment, so it always failed with below error.

 Feb 06 16:50:10 localhost.localdomain systemd[417]: Failed to open
 private bus connection: Failed to connect to socket
 /run/user/app/dbus/user_bus_socket: No such file or directory

 Signed-off-by: Chengwei Yang chengwei.y...@intel.com
 ---
  src/core/manager.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 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.


Auke
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] Delay dbus connection for user session

2013-05-28 Thread Yang Chengwei
On Tue, May 28, 2013 at 01:53:16PM -0700, Kok, Auke-jan H wrote:
 On Tue, May 28, 2013 at 3:00 AM, Chengwei Yang chengwei.y...@intel.com 
 wrote:
  Currently, if we have a user session, when systemd user session start,
  just like the situation for it as PID 1, dbus-daemon isn't ready at that
  moment, so it always failed with below error.
 
  Feb 06 16:50:10 localhost.localdomain systemd[417]: Failed to open
  private bus connection: Failed to connect to socket
  /run/user/app/dbus/user_bus_socket: No such file or directory
 
  Signed-off-by: Chengwei Yang chengwei.y...@intel.com
  ---
   src/core/manager.c |2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
 
  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.

--
Thanks,
Chengwei

 
 
 Auke


signature.asc
Description: Digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel