#631 lxdm starts executing Xsession before PostLogin completed

open
dgod.osa
lxdm (77)
5
2014-09-16
2014-01-29
J G Miller
No

The execution of the PostLogin script, as I understand it, from

<https://wiki.archlinux.ORG/index.php/LXDM>

[NB the documentation on the LXDM page at the official LXDE wiki is totally inadequate]

is supposed to happen before the execution of Xsession.

Although this appears to be trivial, it probably point to a more serious malaise in the way lxdm launches the PostLogin and Xsession scripts.

This bug was observed in both git version rb8b08e5 and the latest (as of 2014-01-29 16:28:08h UTC) git version r478bcc4.

If the Xsession file in /etc/lxdm is a shell script and does NOT have execute permission (and therefore will fail to be executed by lxdm) then if the PostLogin script tries to use /bin/ps then /bin/ps crashes and the PostLogin script exits immediately.

This was observed using this simple PostLogin script and the permission on Xsession set to 644 instead of 755

#! /bin/sh

exec 2> /tmp/PostLogin.err

/bin/date +"%Y-%m-%d %Th %Z" > /tmp/PostLogin.log

echo "start of PostLogin"
echo "home is ->${HOME}<-" >> /tmp/PostLogin.log
echo "user is ->${USER}<-" >> /tmp/PostLogin.log
echo "going to do /bin/ps" >> /tmp/PostLogin.log
/bin/ps >> /tmp/PostLogin.log
echo "completed doing /bin/ps" >> /tmp/PostLogin.log
echo "end of PostLogin" >> /tmp/PostLogin.log

The contents of PostLogin.err state

Signal 1 (HUP) caught by ps (procps-ng version 3.3.3).
/bin/ps:display.c:59: please report this bug

The "exectuability" of Xsession should not affect the execution of commands in PostLogin, but clearly it does.

Further testing with the permission on Xsession changed to 755 but using an empty Xsession file, shows that lxdm is starting to execute the Xsession file before the PostLogin script has completed. This should not be the case.

So in summary, lxdm should wait until it has received the exit status of PostLogin (ie it has completed) before trying to start executing Xsession.

Discussion

  • dgod.osa

    dgod.osa - 2014-01-30

    User or packager should make sure xsession is ok, or I don't see any reason to keep postlogin run.

     
  • J G Miller

    J G Miller - 2014-03-24

    "I don't see any reason to keep postlogin run."

    The way that LXDE has implemented postlogin and postlogout, running these scripts as the logged in USER is pointless and so they should not be kept if that method of operation is intentional because as shewn above it it not respecting the completion of the script before starting Xsession.

    The traditional display manager way of running postlogin and postlogout scripts is to run these scripts not as the logged in USER but with root privileges before and after the Xsession in order to allow certain operations to be done on a user login.

    These scripts were named Xstartup and Xreset with traditional display manager (xdm, wdm) and PreSession/Default and PostSession/Default with gdm3/mdm

    If lxdm is not going to follow this standard practice, then the PostLogin and PostLogout are pointless since everything would just be done in Xsession by the user and anything needed to be done with root privileges would not be possible as is currently the case and thus a limitation of lxdm compared to other display managers which have this feature.

     

Log in to post a comment.