dbus-launch --exit-with-session and stdin
Havoc Pennington
hp at redhat.com
Thu Jul 13 16:46:33 PDT 2006
Artem Kachitchkine wrote:
> 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?
I don't honestly remember the history of this code. What the above does
(to state the obvious) is exit if stdin gets EOF, but I don't know why.
Conceivably we rely on it somewhere by starting a bus with a pipe on
stdin or something instead of a tty.
> 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.
is stdin a tty, or perhaps /dev/null or the like that would give an EOF
instead of a HUP?
I don't know if the dbus code tests isatty()
Havoc
More information about the dbus
mailing list