[Debian-eeepc-devel] [eeepc-acpi-scripts PATCH] Allow X detection without an existing console/terminal session

Damyan Ivanov dmn at debian.org
Fri Oct 24 13:42:25 UTC 2008


-=| Darren Salt, Fri, Oct 24, 2008 at 01:58:03PM +0100 |=-
> <snip>

> I forgot to mention that I find that the first method only succeeds if a user
> is currently logged in via a console or X terminal.

Or the display manager updates utmp.

$ who|head -3
dam      tty8         2008-10-07 16:19 (:0)
dam      pts/1        2008-10-07 16:19 (:0.0)
dam      pts/3        2008-10-07 09:53 (:0:S.0)

The first line above is my gdm login. The second - a terminal (I have 
set the "use login shell" option).  The third - a screen session 
(ditto).

> I'm not certain that the first detection method is actually still 
> needed with
> this patch; I've not (yet) tested.

Thing is that the "X" process (the one holding the tty) runs as root, 
not as the logged-in user.

> > Shouldn't "user=root" actually be "user = $_user"? For example if X was
> > started with "startx" from the console...
> 
> That doesn't seem to matter, and I don't really see how we could reliably set
> it anyway; $_user contains an X process ID, so we'd need to find another
> process which shares the same credentials ($DISPLAY and $XAUTHORITY) – but
> there's no guarantee that that's owned by whoever actually logged in. (That
> said, it's likely to be that user or root.)

The matching set of credentials seems right, although probably not so 
easy to implement. Hmm, there may be more than one matching user.  
gksu and gksudo can pass along the credentials to another user. Doh :|

I think that detecting the user that runs the login session is 
important as this is required when mangling with kscreensaver via dcop 
or gnome notification service via dbus.

Anyway, your patch looks OK for the case when no user has yet logged 
in. I will commit it.

-- 
dam            JabberID: dam at jabber.minus273.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/debian-eeepc-devel/attachments/20081024/795a91b3/attachment.pgp 


More information about the Debian-eeepc-devel mailing list