dbus-launch --exit-with-session and stdin

Artem Kachitchkine Artem.Kachitchkin at Sun.COM
Thu Jul 13 16:16:27 PDT 2006


The man page says what I expect:

      --exit-with-session
           If this option is provided, a  persistent  "babysitter"
           process  will be created that watches stdin for HUP and
           tries to connect to the X server. If this process  gets
           a  HUP on stdin or loses its X connection, it kills the
           message bus daemon.

The babysitter process does appear to stay attached to the original tty and 
would kill_bus_and_exit() when SIGHUP is received. But then there's this 
additional code:

           if (FD_ISSET (tty_fd, &read_set))
             {
               int bytes_read;
               char discard[512];

               verbose ("TTY ready for reading\n");

               bytes_read = read (tty_fd, discard, sizeof (discard));

               verbose ("Read %d bytes from TTY errno = %d\n",
                        bytes_read, errno);

               if (bytes_read == 0)
                 kill_bus_and_exit (); /* EOF */

What is it supposed to do that SIGHUP wouldn't do?

This code giving us a problem on Solaris: we start session bus from Xinitrc in 
an obvious way:

command=/usr/bin/gnome-session
if [ -x "/usr/bin/dbus-launch" -a -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
     command="/usr/bin/dbus-launch --exit-with-session $command"
fi
exec $command

but the first read() returns 0 (still need to figure out why), so the session 
bus is killed immediately, even though the session runs normally.

-Artem.


More information about the dbus mailing list