[comp.bugs.sys5] Multiple utmp entries: Howzit happen?

jr@oglvee.UUCP (Jim Rosenberg) (12/13/89)

We are suffering from a recurring arthritis of the loginism.  The symptoms
range from pain in the outer mail utilities all the way to collapse of the
HDB validation.  It seemed pretty clear something was going wrong with
/etc/utmp, and sure enough that proved to be the case.  We keep getting (or
should I say gettying?) just a couple or three tty lines with more than one
entry in /etc/utmp.  Here's an example:

LOGIN     tty12        Dec 11 18:24   .    11884               
jr        tty12        Dec 12 08:19   .    11884               

The above two lines were grepped from a who -a listing.  I *thought* /etc/utmp
was only supposed to have one entry per tty.  It appears that utilities don't
all do the same thing regarding utmp:  Some assume that the first matching
entry is correct, others take the trouble to search the whole file.  Elm, for
instance, has no trouble with this situation and realizes that I'm jr, not
LOGIN.  But the elm utilities wnewmail and from will no longer work right when
the second utmp entry for tty12 materializes.  (This is elm 2.1, 2.2 may fix
this for all I know.)

Our version of HDB messes up badly under these conditions.  When I get a second
utmp entry for the modem line, it appears in doing site validation HDB is
pulling off the login name from the first (WRONG!) utmp entry.  It concludes
the user is LOGIN.  But then it seems to know this can't be right (no passwd
entry for LOGIN?) so it paws through /etc/passwd for the first entry that
matches by uid.  Not fun at all if you have multiple uuwhoever logins all with
the same uid as uucp.  So when the modem line acquires a callus of the utmpnail
HDB validation suddenly starts failing.

This is really annoying.  I've fixed it by going single-user and catting
/dev/null >/etc/utmp, but now it's come back.  Does anybody know how this
happens?  Our system is an Altos 2000 with Altos UNIX 5.3.1 d.  [Please excuse
if this is one of those oft-discussed questions; I've been buried under a mound
of MIS work lately & haven't had much time to read news.]
-- 
Jim Rosenberg                        pitt
Oglevee Computer Systems                 >--!amanue!oglvee!jr
151 Oglevee Lane                      cgh
Connellsville, PA 15425                                #include <disclaimer.h>

allbery@ncoast.org (Brandon S. Allbery) (12/14/89)

In article <519@oglvee.UUCP> jr@oglvee.UUCP (Jim Rosenberg) writes:

   LOGIN     tty12        Dec 11 18:24   .    11884               
   jr        tty12        Dec 12 08:19   .    11884               

That is most likely a bug in login.  Are you running the stock 5.3d login, or
one gleaned from the Usenet?  Or a non-stock getty?

I've not seen this on other systems running Altos 5.3dS1, including one 2000.
(If you're running dS0, consider getting the update for dS1.)

++Brandon
--
Brandon S. Allbery    allbery@NCoast.ORG, BALLBERY (MCI Mail), ALLBERY (Delphi)
uunet!hal.cwru.edu!ncoast!allbery ncoast!allbery@hal.cwru.edu bsa@telotech.uucp
*(comp.sources.misc mail to comp-sources-misc[-request]@backbone.site, please)*
*Third party vote-collection service: send mail to allbery@uunet.uu.net (ONLY)*
expnet.all: Experiments in *net management and organization.  Mail me for info.
-- 
Brandon S. Allbery    allbery@NCoast.ORG, BALLBERY (MCI Mail), ALLBERY (Delphi)
uunet!hal.cwru.edu!ncoast!allbery ncoast!allbery@hal.cwru.edu bsa@telotech.uucp
*(comp.sources.misc mail to comp-sources-misc[-request]@backbone.site, please)*
*Third party vote-collection service: send mail to allbery@uunet.uu.net (ONLY)*
expnet.all: Experiments in *net management and organization.  Mail me for info.

rob@PacBell.COM (Rob Bernardo) (12/14/89)

In article <519@oglvee.UUCP> jr@oglvee.UUCP (Jim Rosenberg) writes:
+  It seemed pretty clear something was going wrong with
+/etc/utmp, and sure enough that proved to be the case.  We keep getting (or
+should I say gettying?) just a couple or three tty lines with more than one
+entry in /etc/utmp.  Here's an example:
...
+But the elm utilities wnewmail and from will no longer work right when
+the second utmp entry for tty12 materializes.  (This is elm 2.1, 2.2 may fix
+this for all I know.)

This made shed some light on the matter.

The elm utility wnewmail (version 2.2) is a program that runs for the duration
of a login session. It knows to die when one of the following happen:

	1. it receives a hangup signal, as is sent to all processes of
	   of terminal's process group when the user logs out.
	2. getppid() returns 1, which is to say that the originating login
	   shell has gone away and the wnewmail process has taken on init
	   as its parent.
	3. isatty(1)  returns 0, which is to say standard output is not
	   a terminal (I don't quite see why this would *change* over the
	   course of the process running and it may only be a test that
	   would fail the first time it's tested).

It's possible that version 2.1 of wnewmail dies under #1 above as #2 and #3
were added in some recent version of ELM maybe after 2.1.

In any case, I presume that by your saying "wnewmail no longer works
right when the second utmp entry materializes", you mean wnewmail
terminates prematurely.  Since wnewmail does not consult the utmp file
at all, then you may  have a situation of whatever is wrong causing both the
utmp phenomenon and the wnewmail phenomenon separately, *not* a situation of
the utmp phenomenon causing the wnewmail phenomenon.
-- 
Rob Bernardo      ...![backbone]!pacbell!pbhyf!rob -or- rob@pbhyf.PacBell.COM
  Product engineer, UNIX/C Reusable Code Library        Editor, "Go `C' UNIX"
  Office: (415) 823-2417                Pacific * Bell, San Ramon, California
  Residence: (415) 827-4301                     R BAR JB, Concord, California