[Pkg-acpi-devel] Bug#560804: Bug#560804: Implementation of getXuser is wrong so that logged in user is not detected

Michael Meskes meskes at debian.org
Sat Dec 12 17:33:39 UTC 2009


On Sat, Dec 12, 2009 at 01:02:08PM +0100, Klaus Ethgen wrote:
> When the user is logged in under X and has no open shell the getXuser
> function will not see him and so the screen is not locked.
> ...

Something's wrong here.

> The reason is that "pinky -fw" returns something like:
>    klaus    ?:0       ?????  Dec 11 16:57
>    klaus    *pts/0           Dec 11 17:15 :0.0
>    klaus     pts/1           Dec 11 17:16 :0.0
>    klaus    *pts/2    00:04  Dec 11 17:21 :0.0

This means that $(NF) in that awk statement is ":0.0" for the last three lines,
so it should print "klaus" once and then exit.

The only way I see to not get the user here is if displaynum is not correctly
set. Could you please check that getXconsole correctly determines the display.

> - -	user=`pinky -fw | awk '{ if ($2 == ":'$displaynum'" || $(NF) == ":'$displaynum'" || $2 == ":'$displaynum'.0" || $(NF) == ":'$displaynum'.0"  ) { print $1; exit; } }'`
> +	user=`w -h | awk '{ if ($2 == ":'$displaynum'" || $3 == ":'$displaynum'" || $2 == ":'$displaynum'.0" || $3 == ":'$displaynum'.0"  ) { print $1; exit; } }'`

w is not an option as it truncates usernames.

Michael
-- 
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ: 179140304, AIM/Yahoo/Skype: michaelmeskes, Jabber: meskes at jabber.org
VfL Borussia! Forca Barca! Go SF 49ers! Use: Debian GNU/Linux, PostgreSQL





More information about the Pkg-acpi-devel mailing list