Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#26395 - [xorg-xdm] who and who -u /var/run/utmp produce different output

Attached to Project: Arch Linux
Opened by Norbert Zeh (nzeh) - Tuesday, 11 October 2011, 12:21 GMT
Last edited by Jan de Groot (JGC) - Tuesday, 12 June 2012, 10:44 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Jan de Groot (JGC)
Architecture x86_64
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No


Description: My xdm Xstartup file uses sessreg to register a login on :0. Once a user is logged in, who /var/run/utmp correctly shows this user as logged in on :0, while who without arguments does not report it. Yet, according to the manpage, no arguments will use /var/run/utmp.

Running sessreg with or without -u /var/run/tmp does not make any difference.

Running sessreg from a TTY with the exact same arguments as used by xdm's Xstartup file does not produce the above behaviour, that is, both who and who /var/run/utmp show the user as logged in on :0.

Additional info:
* package version(s)
* config and/or log files etc.

Steps to reproduce:
This task depends upon

Closed by  Jan de Groot (JGC)
Tuesday, 12 June 2012, 10:44 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed in svn
Comment by Norbert Zeh (nzeh) - Tuesday, 11 October 2011, 14:25 GMT
I looked at the source code of who. Here's what's going on: who without parameters excludes utmp entries whose corresponding processes are dead (flag READ_UTMP_CHECK_PIDS), while who with a file argument does not check process IDs. sessreg seems to register the PID of its parent process as the session's PID. When running sessreg from the command line without logging out afterwards, the process associated with the session (the shell) is running. Thus, who reports the utmp entry. When running sessreg from Xsetup, the shell executing Xsetup runs sessreg (and anything else in Xsetup) and then quits. Thus, this looks like a dead process to who. Is this a bug or feature?
Comment by David J. Haines (dhaines) - Wednesday, 12 October 2011, 14:28 GMT
This should be assigned to the xorg-xdm maintainer.

What appears to be happening is that instead of calling GiveConsole from a standardized Xstartup if $DISPLAY is :0, xdm-config is calling GiveConsole directly, bypassing Xstartup and the sessreg goodness inside.

What should happen is essentially what is described in the second example of the STARTUP PROGRAM section of the xdm manpage, probably with an if-then statement to only allow it on :0.

A quick hack would be to just add the sessreg line from Xstartup to the end of GiveConsole.
Comment by erdbeer (erdbeer) - Sunday, 06 May 2012, 23:29 GMT
my bugfix:
in /etc/X11/xdm/xdm-config, comment out the following lines by prepending a '!' (or simply remove them):
DisplayManager._0.setup: /etc/X11/xdm/Xsetup_0
DisplayManager._0.startup: /etc/X11/xdm/GiveConsole
DisplayManager._0.reset: /etc/X11/xdm/TakeConsole

any comments on that fix?