[Xfce4-commits] <xfce4-session:master> Reuse existing ConsoleKit sessions (bug #6685).

Jannis Pohlmann jannis at xfce.org
Mon Sep 20 13:14:27 CEST 2010


Hey,

On Mon, 20 Sep 2010 08:07:24 +0200
Yves-Alexis Perez <corsac at debian.org> wrote:

> On dim., 2010-09-19 at 23:25 +0200, Jannis Pohlmann wrote:
> > > > Maybe calling ck-l-s within xfce4-session is just too late?
> > > 
> > > I don't think so, but starting CK unconditionally while there
> > > might be another session running may lead to troubles.
> > 
> > Yes. The question is how scripts (e.g. the ones on Debian) decide
> > when to open a new ConsoleKit session that is set up to work with
> > XOrg/Xfce. Can you find out what the conditions are or what is done
> > to set up ConsoleKit when calling "startx"? 
> 
> When only doing startx, scripts in /etc/X11/Xsession.d gets executed,
> and 90consolekit is:
> 
> ----
> # -*- sh -*-
> # Xsession.d script for ck-launch-session.
> #
> #
> # This file is sourced by Xsession(5), not executed.
> 
> CK_LAUNCH_SESSION=/usr/bin/ck-launch-session
> 
> is_on_console() {
> 	session=$(dbus-send --system
> --dest=org.freedesktop.ConsoleKit \ --type=method_call --print-reply
> --reply-timeout=2000 \ /org/freedesktop/ConsoleKit/Manager \
> 		org.freedesktop.ConsoleKit.Manager.GetCurrentSession \
> 		| grep path | awk '{print $3}' | sed s/\"//g)
> 	x11_display=$(dbus-send --system
> --dest=org.freedesktop.ConsoleKit \ --type=method_call --print-reply
> --reply-timeout=2000 \ $session
> org.freedesktop.ConsoleKit.Session.GetX11Display \ | grep string |
> awk '{print $2}' | sed s/\"//g)
> 
> 	if [ -z "$x11_display" ] ; then
> 		return 0
> 	else
> 		return 1
> 	fi
> }
> 
> # gdm already creates a CK session for us, so do not run the
> expensive D-Bus # calls if we have $GDMSESSION
> if [ -z "$GDMSESSION" ] && [ -x "$CK_LAUNCH_SESSION" ] && \
>  ( [ -z "$XDG_SESSION_COOKIE" ] || is_on_console ) ; then
>     STARTUP="$CK_LAUNCH_SESSION $STARTUP"
> fi
> 
> So basically it checks if we runs from GDM (which sets the stuff
> itself) or if $XDG_SESSION_COOKIE is set (by the pam connector). 

I suppose the GDM check is not really necessary here, as GDM will set
XDG_SESSION_COOKIE. So the important part is that a new
ConsoleKit session is only opened if

  1) $XDG_SESSION_COOKIE is not set, or
  2) we are in a session that is not associated with an X display.

At the moment, we're only running the first check in startxfce4 (or
rather, in our xinitrc). We could check for 2) as well by reusing the
code from 90consolekit. It won't even hurt anyone.

> I'm not too sure about the is_on_console, maybe it's for people
> wanting to reuse 90consolekit for console use.

Currently, if you are on a tty without X and you call "startxfce4",
you'll end up with a broken session because $XDG_SESSION_COOKIE is
already set, and xfce4-session tries to reuse the session even though
the session is not associated with a running X instance.

So that's the check we'd need to make "startxfce4" work again for
people not using a login manager. The question is: is this fix good
enough or is calling "startxfce4" manually completely wrong from the
start, now that we have ConsoleKit?

  - Jannis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://mail.xfce.org/pipermail/xfce4-dev/attachments/20100920/531da01b/attachment.pgp>


More information about the Xfce4-dev mailing list