From cr@silva.signetica.com  Tue Feb  5 14:34:20 2008
Return-Path: <cr@silva.signetica.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0994416A418
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  5 Feb 2008 14:34:20 +0000 (UTC)
	(envelope-from cr@silva.signetica.com)
Received: from silva.signetica.com (unknown [IPv6:2002:943f:34a2:0:21e:8cff:fe0b:6b0])
	by mx1.freebsd.org (Postfix) with ESMTP id 68C7913C4D3
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  5 Feb 2008 14:34:15 +0000 (UTC)
	(envelope-from cr@silva.signetica.com)
Received: from silva.signetica.com (localhost [127.0.0.1])
	by silva.signetica.com (8.14.2/8.14.2) with ESMTP id m15EYAgQ025979
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 5 Feb 2008 07:34:10 -0700 (MST)
	(envelope-from cr@silva.signetica.com)
Received: (from cr@localhost)
	by silva.signetica.com (8.14.2/8.14.2/Submit) id m15EY7E7025978;
	Tue, 5 Feb 2008 07:34:07 -0700 (MST)
	(envelope-from cr)
Message-Id: <200802051434.m15EY7E7025978@silva.signetica.com>
Date: Tue, 5 Feb 2008 07:34:07 -0700 (MST)
From: Cyrus Rahman <cr@silva.signetica.com>
Reply-To: Cyrus Rahman <cr@silva.signetica.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: sa(8) fails to summarize/truncate accounting data
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         120293
>Category:       bin
>Synopsis:       [patch] sa(8) fails to summarize/truncate accounting data
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    grog
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 05 14:40:01 UTC 2008
>Closed-Date:    Thu Feb 21 07:13:54 UTC 2008
>Last-Modified:  Thu Jul 31 20:00:13 UTC 2008
>Originator:     Cyrus Rahman
>Release:        FreeBSD 7.0-RC1 amd64
>Organization:
>Environment:
System: FreeBSD silva.signetica.com 7.0-RC1 FreeBSD 7.0-RC1 #0: Tue Jan 29 21:59:21 MST 2008 cr@silva.signetica.com:/usr/src/sys/amd64/compile/SIGNETICA amd64


>Description:
	sa(8) no longer truncates accounting data with the -s flag.  As a
	result, the /etc/periodic/daily script simply copies an ever-growing
	file and the active file grows in length until /var is exhausted.

>How-To-Repeat:
	Enable accounting on a server and wait until that new huge /var is
	full.  Or view the messages from /etc/periodic/daily:

	# sa -s
	sa: converting user accounting stats: Inappropriate file type or format
	sa: user accounting initialization failed

>Fix:
	The version record is correctly written into the user and process
	summary files, but because the compare routine is not specified on the
	database dbopen() in db_copy_in(), this version record is not reliably
	found and the user database is assumed to be a version 1 database.
	Needless to say, the conversion routine fails.

	The following patch corrects the problem:

--- db.c.orig	2008-02-05 07:17:45.000000000 -0700
+++ db.c	2008-02-05 07:18:22.000000000 -0700
@@ -67,7 +67,7 @@
 	if (iflag)
 		return (0);
 
-	if ((ddb = dbopen(dbname, O_RDONLY, 0, DB_BTREE, NULL)) == NULL) {
+	if ((ddb = dbopen(dbname, O_RDONLY, 0, DB_BTREE, bti)) == NULL) {
 		if (errno == ENOENT)
 			return (0);
 		warn("retrieving %s summary", uname);
>Release-Note:
>Audit-Trail:

From: "Niki Denev" <nike_d@cytexbg.com>
To: bug-followup@FreeBSD.org, cr@silva.signetica.com
Cc:  
Subject: Re: bin/120293: [patch] sa(8) fails to summarize/truncate accounting data
Date: Wed, 20 Feb 2008 13:02:16 +0200

 This is indeed a serious problem.
 Hopefully the patch fixed it for me.
 
 Thanks.
State-Changed-From-To: open->closed 
State-Changed-By: grog 
State-Changed-When: Thu Feb 21 07:09:55 UTC 2008 
State-Changed-Why:  
grog committed the patch. 


Responsible-Changed-From-To: freebsd-bugs->grog 
Responsible-Changed-By: grog 
Responsible-Changed-When: Thu Feb 21 07:09:55 UTC 2008 
Responsible-Changed-Why:  
grog committed this patch. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=120293 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/120293: commit references a PR
Date: Thu, 21 Feb 2008 07:13:05 +0000 (UTC)

 grog        2008-02-21 07:12:57 UTC
 
   FreeBSD src repository
 
   Modified files:
     usr.sbin/sa          db.c 
   Log:
   Ensure that the -s flag truncates the accounting data.
   
   This problem has only been reported on the amd64 platform.
   
   PR:             bin/120293
   Tested by:      Callum Gibson
   MFC after:      2 weeks
   
   Revision  Changes    Path
   1.3       +1 -1      src/usr.sbin/sa/db.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: Jason Fesler <jfesler@gigo.com>
To: bug-followup@FreeBSD.org, cr@silva.signetica.com
Cc:  
Subject: Re: bin/120293: [patch] sa(8) fails to summarize/truncate accounting
 data
Date: Thu, 27 Mar 2008 07:57:18 -0700 (PDT)

 This PR mentions MFC after 2 weeks- should I expect RELENG_7 to have this 
 change now?

From: Alan Amesbury <amesbury@umn.edu>
To: bug-followup@FreeBSD.org
Cc: cr@silva.signetica.com
Subject: Re: bin/120293: [patch] sa(8) fails to summarize/truncate accounting
 data
Date: Thu, 31 Jul 2008 14:24:01 -0500

 This bug persists in FreeBSD 7.0-RELEASE-p3 (at least as tested on 
 7.0-RELEASE-p3 amd64).  The patch supplied by Cyrus appears to work as 
 expected (thanks, Cyrus!).  Is this going to be applied to 7-STABLE, to 
 7.1-RELEASE, or somewhere similar?
 
 Thanks in advance!
 
 
 -- 
 Alan Amesbury
 OIT Security and Assurance
 University of Minnesota
>Unformatted:

Patch applied--thanks.
