After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 93906 - Figure out utmp, wtmp, lastlog, --login etc.
Figure out utmp, wtmp, lastlog, --login etc.
Status: RESOLVED FIXED
Product: gnome-terminal
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: 2.7
Assigned To: GNOME Terminal Maintainers
GNOME Terminal Maintainers
: 82904 82905 82906 82908 82909 92284 93770 99898 119910 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2002-09-22 19:57 UTC by Havoc Pennington
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Do all that (5.50 KB, patch)
2004-02-09 14:30 UTC, Mariano Suárez-Alvarez
none Details | Review
Do it all, correctly now (6.22 KB, patch)
2004-06-28 07:39 UTC, Mariano Suárez-Alvarez
committed Details | Review

Description Havoc Pennington 2002-09-22 19:57:27 UTC
This is a catch-all bug for sorting out utmp/wtmp/lastlog/--login 
on a high level, will dup all the outstanding issues here to clean 
up bugzilla a bit.

Here are the steps in my mind:

 - figure out exactly what each of these are used for
   and when they covary or need to be independent
 - figure out what the correct defaults are
 - figure out use-cases for using nondefault settings
 - figure out appropriate UI for those use-cases including
   command line options and prefs options

(The answer seems to be "w" and "talk" for the most part.)
Comment 1 Havoc Pennington 2002-09-22 19:57:55 UTC
*** Bug 82904 has been marked as a duplicate of this bug. ***
Comment 2 Havoc Pennington 2002-09-22 19:58:09 UTC
*** Bug 82905 has been marked as a duplicate of this bug. ***
Comment 3 Havoc Pennington 2002-09-22 19:58:26 UTC
*** Bug 82906 has been marked as a duplicate of this bug. ***
Comment 4 Havoc Pennington 2002-09-22 19:59:08 UTC
*** Bug 92284 has been marked as a duplicate of this bug. ***
Comment 5 Havoc Pennington 2002-09-22 20:11:27 UTC
*** Bug 93770 has been marked as a duplicate of this bug. ***
Comment 6 Havoc Pennington 2002-09-22 21:55:19 UTC
*** Bug 82909 has been marked as a duplicate of this bug. ***
Comment 7 Havoc Pennington 2002-09-22 22:28:18 UTC
*** Bug 82908 has been marked as a duplicate of this bug. ***
Comment 8 Havoc Pennington 2002-10-26 05:12:44 UTC
Nalin kindly wrote this up, see vte/doc/utmpwtmp.txt, I'll paste its
current version for convenience.


 The utmp, wtmp, and lastlog files are used to track which users are
logged in,
but in slightly different ways.

Summary:

The utmp file contains at most one entry per terminal.
The wtmp file has the same format as the utmp file, but has no limit
on the
number of entries it contains.
The lastlog file contains at most one entry per UID.

When a user logs in, the entry for the terminal is set in utmp.
When a user logs in, an entry is appended to wtmp.
When a user logs in, the entry for the user's UID is set in lastlog.

When a user logs out, the entry for the terminal is cleared from utmp.
This prevents the utmp file from growing beyond a fixed size.

When a user logs out, an entry is appended to wtmp.  This provides a
complete history of who logged in and out and when.

When a user logs out, nothing happens to the lastlog.

Conclusions:
A terminal should always log to utmp, because it keeps track of who's
using
a given terminal device.
A terminal should probably log to wtmp, because it correlates with utmp.
A terminal should not log to lastlog, but a display manager should.

References:
http://netbsd.gw.com/cgi-bin/man-cgi?utmp++NetBSD-current
http://www.netsys.com/sunmgr/1997-12/msg00155.html
Comment 9 Havoc Pennington 2002-10-26 05:22:19 UTC
My interpretation of this is:

 - lastlog should correspond exactly to the login shell option, i.e. 
   if this is a login shell we do lastlog, otherwise
   we assume the user is already logged in and gdm did lastlog.
   So there's no separate lastlog setting, it keys off whether 
   you are creating a login session.

 - utmp/wtmp should be the same setting, because wtmp is the history 
   of changes to utmp.

So there are two flags, login/nologin and
track-the-terminal/dont-track-the-terminal.

The defaults should be nologin and track-the-terminal. 
nologin because gdm already does the login, and track-the-terminal 
so that write, ytalk, etc. work.

I guess that's exactly what Nalin said, just writing it down to 
be sure I have it straight.
Comment 10 Havoc Pennington 2002-11-29 17:33:01 UTC
*** Bug 99898 has been marked as a duplicate of this bug. ***
Comment 11 Mariano Suárez-Alvarez 2004-02-09 06:04:35 UTC
*** Bug 119910 has been marked as a duplicate of this bug. ***
Comment 12 Mariano Suárez-Alvarez 2004-02-09 06:05:47 UTC
Note 119910 has a patch to make terminal-widget pass the update-record
option to vte.
Comment 13 Mariano Suárez-Alvarez 2004-02-09 14:29:30 UTC
Here follows a patch that implements what I understand from Nalin's
description---which is not the same as what Havoc understood :(

  -- update lastlog only if the shell is to be a login shell; this 
     should not be the default;
  -- always update the utmp record; and
  -- only update the wtmp record if the profile says so, and let 
     profiles say so by default.
Comment 14 Mariano Suárez-Alvarez 2004-02-09 14:30:15 UTC
Created attachment 24235 [details] [review]
Do all that
Comment 15 Mariano Suárez-Alvarez 2004-02-14 06:29:55 UTC
This needs to wait for 2.7
Comment 16 Mariano Suárez-Alvarez 2004-06-28 07:39:46 UTC
Created attachment 29056 [details] [review]
Do it all, correctly now

Ok. More reading convinced me that utmp and wtmp should either both be updated
simultaneously or both let alone. This is what I commited on HEAD: it updates
lastlog for login shells, and utmp/wtmp for when the profile says so. It also
removes "utmp/wtmp" from the UI.
Comment 17 Mariano Suárez-Alvarez 2004-06-28 07:42:57 UTC
Comment on attachment 29056 [details] [review]
Do it all, correctly now

Fixed on HEAD.