← Back to team overview

touch-packages team mailing list archive

[Bug 183729] Re: compat: utmp not cleared on tty logout

 

Are you sure this is fixed?
I'm seeing this exact bug in Trusty. Logging out of a TTY doesn't lower the number of users in uptime, w, etc.

Now, Vivid switched to systemd, so if the bug is really in upstart, it may not be worth wasting time here.
But, Trusty is an LTS... so, I don't know.

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to upstart in Ubuntu.
https://bugs.launchpad.net/bugs/183729

Title:
  compat: utmp not cleared on tty logout

Status in upstart :
  Fix Released
Status in kdebase-workspace package in Ubuntu:
  Invalid
Status in upstart package in Ubuntu:
  Fix Released
Status in upstart package in Fedora:
  In Progress

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:~/source/procps-3.2.7/proc$ w
   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(&entry);
    while ((utmpstruct = getutent())){
          if ((utmpstruct->ut_type == USER_PROCESS) && (utmpstruct->ut_name[0] != '\0'))
          printf(utmpstruct->ut_line);
          printf("\t");
          printf("%d",utmpstruct->ut_pid);
          printf("\n");
    }
    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:~/source/procps-3.2.7/proc$ ps aux | grep 4313
  mac     15524  0.0  0.0   2988   768 pts/1    R+   10:42   0:00 grep 4313
  mac@tootoo:~/source/procps-3.2.7/proc$ 

  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:~/source/procps-3.2.7/proc$ ps aux | grep tty1
  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:~/source/procps-3.2.7/proc$ 

  There is now a new pid for tty1

To manage notifications about this bug go to:
https://bugs.launchpad.net/upstart/+bug/183729/+subscriptions