NetBSD Problem Report #39444

From dholland@eecs.harvard.edu  Mon Sep  1 04:13:11 2008
Return-Path: <dholland@eecs.harvard.edu>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 6DDBF63BC7D
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  1 Sep 2008 04:13:11 +0000 (UTC)
Message-Id: <20080901041206.116EFF8CE@tanaqui.eecs.harvard.edu>
Date: Mon,  1 Sep 2008 00:12:05 -0400 (EDT)
From: dholland@eecs.harvard.edu
Reply-To: dholland@eecs.harvard.edu
To: gnats-bugs@gnats.NetBSD.org
Subject: in last(1), an empty wtmp "begins" now
X-Send-Pr-Version: 3.95

>Number:         39444
>Category:       bin
>Synopsis:       in last(1), an empty wtmp "begins" now
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 01 04:15:00 +0000 2008
>Closed-Date:    Thu Mar 15 21:36:48 +0000 2012
>Last-Modified:  Thu Mar 15 21:36:48 +0000 2012
>Originator:     David A. Holland <dholland@eecs.harvard.edu>
>Release:        NetBSD 4.99.72 (20080831)
>Organization:
>Environment:
System: NetBSD valkyrie 4.99.72 NetBSD 4.99.72 (VALKYRIE) #31: Sun Aug  3 18:48:19 EDT 2008  root@valkyrie:/usr/src/sys/arch/amd64/compile/VALKYRIE amd64
Architecture: amd64
Machine: x86_64
>Description:

When you run last(1), it finishes up by printing the time it's reached
back to, like this:

	wtmpx begins Sun Aug 31 2008 23:58:33

If wtmp is empty because nobody has logged in or out since the last
time wtmp was rotated, it prints just the timestamp. The problem: the
timestamp is $NOW, which is misleading, rather than the mtime of the
empty wtmp file, which reflects when wtmp was rotated and thus when
the wtmp actually began.

It is particularly annoying if you bring up an idle shell window to
check a system for unwanted activity, because then you have to go look
in /var/log to see if you need to also check wtmp.0.

>How-To-Repeat:

Stay logged in for a while, then run last.

>Fix:

Should be trivial, except that the code in usr.bin/last is failing to
make sense to me.

>Release-Note:

>Audit-Trail:
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/39444 CVS commit: src/usr.bin/last
Date: Thu, 15 Mar 2012 03:01:04 +0000

 Module Name:	src
 Committed By:	dholland
 Date:		Thu Mar 15 03:01:03 UTC 2012

 Modified Files:
 	src/usr.bin/last: want.c

 Log Message:
 When the wtmp file is empty, for the "wtmp[x] begins..." output, use
 the last mod time of the wtmp file (in practice, the time it was last
 rotated, which is when it begins) instead of the current time, which
 wasn't ever particularly useful. PR 39444.


 To generate a diff of this commit:
 cvs rdiff -u -r1.15 -r1.16 src/usr.bin/last/want.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->pending-pullups
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Thu, 15 Mar 2012 03:30:22 +0000
State-Changed-Why:
pullup-6 #117, pullup-5 #1744


From: "Stephen Borrill" <sborrill@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/39444 CVS commit: [netbsd-5] src/usr.bin/last
Date: Thu, 15 Mar 2012 08:50:41 +0000

 Module Name:	src
 Committed By:	sborrill
 Date:		Thu Mar 15 08:50:41 UTC 2012

 Modified Files:
 	src/usr.bin/last [netbsd-5]: want.c

 Log Message:
 Pull up the following revisions(s) (requested by dholland in ticket #1744):
 	usr.bin/last/want.c:	revision 1.15-1.16

 Keep track of the timestamp of the last (thus oldest) record seen and use
 it to print "wtmp[x] begins" at the end. When the wtmp file is empty, use
 the last mod time of the wtmp file. Fixes PR/39444.


 To generate a diff of this commit:
 cvs rdiff -u -r1.11 -r1.11.12.1 src/usr.bin/last/want.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Stephen Borrill" <sborrill@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/39444 CVS commit: [netbsd-6] src/usr.bin/last
Date: Thu, 15 Mar 2012 08:53:43 +0000

 Module Name:	src
 Committed By:	sborrill
 Date:		Thu Mar 15 08:53:43 UTC 2012

 Modified Files:
 	src/usr.bin/last [netbsd-6]: want.c

 Log Message:
 Pull up the following revisions(s) (requested by dholland in ticket #117):
 	usr.bin/last/want.c:	revision 1.15-116

 Keep track of the timestamp of the last (thus oldest) record seen and use
 it to print "wtmp[x] begins" at the end. When the wtmp file is empty, use
 the last mod time of the wtmp file. Fixes PR/39444.


 To generate a diff of this commit:
 cvs rdiff -u -r1.14 -r1.14.4.1 src/usr.bin/last/want.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Thu, 15 Mar 2012 21:36:48 +0000
State-Changed-Why:
Pullups applied.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.