compat: utmp not cleared on tty logout
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
upstart |
Fix Released
|
Low
|
Petr Lautrbach | ||
kdebase-workspace (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
upstart (Fedora) |
Fix Released
|
Low
|
|||
upstart (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Log into tty1, then tty2 and then log out of both. Now run a w command and you should see something similar to the following;
mac@tootoo:
10:39:09 up 33 days, 23:11, 4 users, load average: 1.31, 0.62, 0.39
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
mac tty7 :0 11Jan08 4:34m 7:24m 36.02s x-session-manager
mac pts/1 :0.0 08:54 0.00s 0.19s 0.00s w
It shows that 4 users are logged in. Obviously this is wrong. I wrote a small C utility to hack out what w and uptime get as information from utmp.
#include <string.h>
#include <stdlib.h>
#include <pwd.h>
#include <unistd.h>
#include <utmp.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
struct utmp *utmpstruct;
struct utmp entry;
//system("echo before adding entry:;who");
setutent();
//pututline(
while ((utmpstruct = getutent())){
if ((utmpstruct-
}
endutent();
return 0;
}
You'll get an output like this
mac@tootoo:~$ ./a.out
0
50
4305
4306
tty2 14989
4312
tty1 4313
4314
tty7 30255
0
pts/1 9712
0
0
0
0
0
20929
14914
15034
However, running the following , to try to find the pid for the tty1 process, gives;
mac@tootoo:
mac 15524 0.0 0.0 2988 768 pts/1 R+ 10:42 0:00 grep 4313
mac@tootoo:
This is obviously wrong, utmp still has the old process id's associated as being logged in.
Running the following gives the new tty pid
mac@tootoo:
root 14914 0.0 0.0 1692 516 tty1 Ss+ 10:33 0:00 /sbin/getty 38400 tty1
mac 15605 0.0 0.0 2988 764 pts/1 R+ 10:44 0:00 grep tty1
mac@tootoo:
There is now a new pid for tty1
Related branches
Changed in upstart: | |
milestone: | none → 0.5 |
Changed in upstart: | |
milestone: | 0.5 → none |
Changed in upstart: | |
status: | Invalid → Triaged |
Changed in upstart: | |
milestone: | none → 0.5-later |
Changed in upstart (Fedora): | |
status: | Unknown → In Progress |
Changed in kdebase-workspace (Ubuntu): | |
status: | New → Invalid |
Changed in upstart: | |
status: | Triaged → Fix Committed |
assignee: | nobody → Petr Lautrbach (plautrba) |
milestone: | none → 0.6.8 |
Changed in upstart: | |
milestone: | none → 1.0 |
Changed in upstart: | |
status: | Fix Committed → Fix Released |
Changed in upstart (Ubuntu): | |
status: | Invalid → New |
importance: | Low → Undecided |
tags: | added: patch |
Changed in upstart (Ubuntu): | |
status: | Confirmed → Fix Released |
Changed in upstart (Fedora): | |
importance: | Unknown → Low |
status: | In Progress → Fix Released |
behaviour confirmed on gutsy amd64
2.6.22-14-generic #1 SMP Tue Dec 18 05:28:27 UTC 2007 x86_64 GNU/Linux