[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: best way to check for an active X session from a maintainer script?



On Wed, Sep 12, 2007 at 02:17:28AM +0200, Luca Capello wrote:

> Nothing changed:
> =====
> luca@gismo:~$ who
> luca     pts/1        Sep 12 01:58 (:0:S.0)
> luca     pts/2        Sep 12 02:03 (:0:S.1)

> luca@gismo:~$ who | awk '{print $2}'|grep -q '^:[0-9]'
> luca@gismo:~$ 

> luca@gismo:~$ who | awk '{print $2}'|grep '^:[0-9]'
> luca@gismo:~$ 
> =====

> My X session is started from xdm which launch SBCL [1] from a shell
> script to start StumpWM [2].

Do you have xutils or sessreg installed on this system?

Have you modified /etc/X11/xdm/Xstartup, or have you removed the
"use-sessreg" option from /etc/X11/xdm/xdm.options?

> >>         So, this does not seem to work in all cases.
> >
> > However, THAT is right and was already corrected, the ^ is
> > unnecessary.

> Again, nothing changed:
> =====
> luca@gismo:~$ who | awk '{print $2}'|grep ':[0-9]'
> luca@gismo:~$ 
> =====

> But without the awk part works:
> =====
> luca@gismo:~$ who | grep ':[0-9]'
> luca     pts/1        Sep 12 01:58 (:0:S.0)
> luca     pts/2        Sep 12 02:03 (:0:S.1)
> luca@gismo:~$ 
> =====

But this only shows "logins" associated with xterms that have been launched
from within the X session, not the X session itself.  Further, matching on
the fourth field would give false positives, by (at least) matching logins
from IPv6 hosts with no reverse DNS.

Whereas the false negative here is when the user is running xdm (wdm and kdm
are not subject to this), didn't install the 'xorg' metapackage, doesn't
have xutils installed for any other reason, and blindly confirms the
"restart these services" list without considering the consequences.

YMMV, but I think it's acceptable to let the user's session get creamed in
this case, given that the alternative would be to leave some users unable to
log in to xdm after the upgrade because their admin wasn't paying attention.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
vorlon@debian.org                                   http://www.debian.org/



Reply to: