[Pkg-acpi-devel] Bug#550546: sleep.sh does not lock screen correctly

Carlo Contavalli ccontavalli at gmail.com
Sun Oct 11 01:31:18 UTC 2009


Package: acpid
Version: 1.0.10-2
Severity: normal

Short story:
  - I press the sleep button on my laptop
  - it goes to sleep (suspend to ram)
  - when it resumes, the screen is unlocked
  - despite me setting LOCK_SCREEN to true
    in /etc/default/acpi

I believe the bug to be in sleep.sh, here's a snippet of the
code:

    if pidof xscreensaver > /dev/null; then
        for x in /tmp/.X11-unix/*; do
            displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
            getXuser;
            if [ x"$XAUTHORITY" != x"" ]; then
                export DISPLAY=":$displaynum"
                . /usr/share/acpi-support/screenblank
            fi
        done
    fi


if I run with bash -x, I can see that:

[...]
+ pidof xscreensaver
+ for x in '/tmp/.X11-unix/*'
++ echo /tmp/.X11-unix/X0
++ sed s#/tmp/.X11-unix/X##
+ displaynum=0
+ getXuser
++ pinky -fw
++ awk '{ if ($2 == ":0" || $(NF) == ":0" ) { print $1; exit; } }'
+ user=
+ '[' x = x ']'
++ pgrep -n startx
+ startx=

So:
  - xscreensaver is running
  - displaynum is set to 0 (# ls /tmp/.X11-unix/ gives X0)
  - getXuser runs pinky, and tries to find the username on display :0
  - doesn't find it, and return an empty AUTHORITY

Eg, getXuser cannot find my AUTHORITY file, so screenblank is never run.

The problem is 'displaynum'. The script sets it to 0, so awk matches
for $2 == ":0" or $NF == ":0". But if I run pinky -fw, neither $2 nor $NF
are set to :0:

# pinky -fw
ccontavalli  pts/0    03:08  Oct 10 22:45 :0.0
ccontavalli  pts/1           Oct 10 23:11 :0.0
ccontavalli  pts/2           Oct 11 02:05 :0.0

awk should match for :0.0 instead!!

from my bash, if I run:

. /usr/share/acpi-support/power-funcs
export displaynum=0.0
getXuser
echo $XUSER
echo $XAUTHORITY

I get the right result:
ccontavalli
/home/ccontavalli/.Xauthority

While if I run:
export displaynum=0 [like it is done by sleep.sh]
getXuser
echo $XUSER
echo $XAUTHORITY

I get no result, which is wrong!

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (1100, 'testing'), (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.30-1-686 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash

Versions of packages acpid depends on:
ii  libc6                         2.9-25     GNU C Library: Shared libraries
ii  lsb-base                      3.2-23     Linux Standard Base 3.2 init scrip
ii  module-init-tools             3.10-3     tools for managing Linux kernel mo

Versions of packages acpid recommends:
ii  acpi-support-base             0.123-1    scripts for handling base ACPI eve

acpid suggests no packages.

-- no debconf information





More information about the Pkg-acpi-devel mailing list