Subject: "w" complains erroneously about "Stale utmp entry"'s
To: None <tech-userlevel@netbsd.org>
From: Frederick Bruckman <fredb@immanent.net>
List: tech-userlevel
Date: 07/27/2002 11:55:49
This is in regards to PR pkg/12261.

"mgetty" writes a utmp entry in order to help keep track of programs
that are using the serial port. "w" tries to match every every line in
every utmp entry with a session leader for which that line is the
controlling terminal, and spews the error "Stale utmp entry" when it
cannot.

The problem is that "pppd" doesn't usually have a controlling
terminal, and when it does, it's never the line dialed out on - it
would be either the terminal inherited from the shell (in the
"nodetach" case), or a reference clock. The controlling terminal for
other dialers, like "cu" and "kermit", is likewise the user's
terminal, and never the dial out line.  So it would appear to be
legitimate for there to be lines which are not the controlling
terminal for any process.

Moreover, assuming the lack of a matching session leader for a utmp
entry is significant, it's not easy to tell from the output *which*
entry doesn't have the match.

Therefore, I propose changing the nomatch case from printing an error,
to putting `????' (four question marks) in the `WHAT' field. Another
possibility which springs to mind: since we already have the list of
all process, walk the list looking for the pid from the UUCP-style
lockfile, and fall-back to `????' if none is found.

Does that make sense?

Frederick