From update@michaelchaney.com  Sat May 25 21:08:43 2002
Return-Path: <update@michaelchaney.com>
Received: from mail.michaelchaney.com (ns2.michaelchaney.com [207.65.84.67])
	by hub.freebsd.org (Postfix) with ESMTP id A4D9B37B405
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 25 May 2002 21:08:42 -0700 (PDT)
Received: from update by mail.michaelchaney.com with local (Exim 3.36 #2 (FreeBSD))
	id 17BpJv-0006uo-00; Sat, 25 May 2002 23:07:51 -0500
Message-Id: <E17BpJv-0006uo-00@mail.michaelchaney.com>
Date: Sat, 25 May 2002 23:07:51 -0500
From: Brandon D.Valentine <bugs@geekpunk.net>
Sender: Updater <update@michaelchaney.com>
Reply-To: Brandon D.Valentine <bugs@geekpunk.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc: bugs@geekpunk.net
Subject: newsyslog disobeys -F flag
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         38558
>Category:       bin
>Synopsis:       newsyslog disobeys -F flag
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat May 25 21:10:01 PDT 2002
>Closed-Date:    Mon May 27 07:31:04 PDT 2002
>Last-Modified:  Mon May 27 07:31:04 PDT 2002
>Originator:     Brandon D. Valentine
>Release:        FreeBSD 4.5-RELEASE-p2 i386
>Organization:
N/A
>Environment:
System: FreeBSD leto 4.5-RELEASE-p2 FreeBSD 4.5-RELEASE-p2 #1: Fri Apr 26 01:50:45 CDT 2002 root@leto:/export/obj/export/src/sys/LETO_DEBUG i386


>Description:
/usr/sbin/newsyslog fails to obey the -F flag to force log trimming.  According
to newsyslog(8):

-F      Force newsyslog to trim the logs, even if the trim conditions
have not been met.  This option is useful for diagnosing system problems
by providing you with fresh logs that contain only the problems.
>How-To-Repeat:
[bandix@leto ~]% cat .newsyslog.conf 
# configuration file for newsyslog
#
# logfilename          [owner:group]    mode count size when [ZJB]
# [/pid_file] [sig_num]
/home/bandix/mail/caught-spam                   644  6          *
$W5D23Z
[bandix@leto ~]% newsyslog -Frv -f $HOME/.newsyslog.conf -a
../mail-archive/ $HOME/mail/caught-spam
/home/bandix/mail/caught-spam <6Z>: --> will trim at Fri May 31 23:00:00
2002
>Fix:

The workaround is to manually edit newsyslog.conf and make the file you
wish you rotate immediately up for rotation.  This is an undesirable
solution.  The -F flag should be available for adminstrators and
developers' debugging needs.
>Release-Note:
>Audit-Trail:

From: Peter Pentchev <roam@ringlet.net>
To: "Brandon D.Valentine" <bugs@geekpunk.net>
Cc: bug-followup@FreeBSD.org
Subject: Re: bin/38558: newsyslog disobeys -F flag
Date: Sun, 26 May 2002 16:41:25 +0300

 On Sat, May 25, 2002 at 11:07:51PM -0500, Brandon D.Valentine wrote:
 > 
 > >Number:         38558
 > >Category:       bin
 > >Synopsis:       newsyslog disobeys -F flag
 > >Originator:     Brandon D. Valentine
 > >Environment:
 > System: FreeBSD leto 4.5-RELEASE-p2 FreeBSD 4.5-RELEASE-p2 #1: Fri Apr 26 01:50:45 CDT 2002 root@leto:/export/obj/export/src/sys/LETO_DEBUG i386
 > 
 > 
 > >Description:
 > /usr/sbin/newsyslog fails to obey the -F flag to force log trimming.  According
 > to newsyslog(8):
 > 
 > -F      Force newsyslog to trim the logs, even if the trim conditions
 > have not been met.  This option is useful for diagnosing system problems
 > by providing you with fresh logs that contain only the problems.
 
 I believe that this may have something to do with the fix I made
 in rev. 1.39 of src/usr.sbin/newsyslog/newsyslog.c and later MFC'd
 into RELENG_4 in rev. 1.25.2.5.  As this is not technically a security fix,
 though, it will probably not make its way into the 'security branches',
 such as RELENG_4_5 is.  If you are building your systems from source,
 you may add a new step to your build process - applying other patches -
 and apply the attached patch to the src/usr.sbin/newsyslog/newsyslog.c file.
 
 Since this change was merged into RELENG_4, it will make its way
 into FreeBSD 4.6-RELEASE, which will be out soon.  Until then (and even
 after that), the only way to handle this on RELENG_4_x security branches,
 where x < 6, would be to apply the attached patch manually before the build.
 
 G'luck,
 Peter
 
 -- 
 Peter Pentchev	roam@ringlet.net	roam@FreeBSD.org
 PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
 Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
 This sentence claims to be an Epimenides paradox, but it is lying.
 
 Index: src/usr.sbin/newsyslog/newsyslog.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.sbin/newsyslog/newsyslog.c,v
 retrieving revision 1.25.2.4
 diff -u -r1.25.2.4 newsyslog.c
 --- src/usr.sbin/newsyslog/newsyslog.c	14 Nov 2001 16:58:58 -0000	1.25.2.4
 +++ src/usr.sbin/newsyslog/newsyslog.c	3 Feb 2002 09:35:09 -0000
 @@ -159,7 +159,7 @@
  		if (verbose)
  			printf("does not exist.\n");
  	} else {
 -		if (ent->flags & CE_TRIMAT) {
 +		if (ent->flags & CE_TRIMAT && !force) {
  			if (timenow < ent->trim_at
  			    || difftime(timenow, ent->trim_at) >= 60 * 60) {
  				if (verbose)

From: "Brandon D. Valentine" <bandix@geekpunk.net>
To: Peter Pentchev <roam@ringlet.net>
Cc: "Brandon D.Valentine" <bugs@geekpunk.net>,
	bug-followup@FreeBSD.org
Subject: Re: bin/38558: newsyslog disobeys -F flag
Date: Sun, 26 May 2002 13:08:01 -0500 (CDT)

 On Sun, 26 May 2002, Peter Pentchev wrote:
 
 >I believe that this may have something to do with the fix I made
 >in rev. 1.39 of src/usr.sbin/newsyslog/newsyslog.c and later MFC'd
 >into RELENG_4 in rev. 1.25.2.5.  As this is not technically a security fix,
 >though, it will probably not make its way into the 'security branches',
 >such as RELENG_4_5 is.  If you are building your systems from source,
 >you may add a new step to your build process - applying other patches -
 >and apply the attached patch to the src/usr.sbin/newsyslog/newsyslog.c file.
 
 Thank you kindly, this fixed it.  Next time I'll read the commit logs
 before filing a bug.  Go ahead and close this PR.
 
 Brandon D. Valentine
 -- 
 "Time to resign from the human race, wipe those tears
 from your lovely face.  Baby, wave to the man in the
 ol' red caboose before all hell breaks loose."
                                      - Kinky Friedman
 
 
State-Changed-From-To: open->closed 
State-Changed-By: roam 
State-Changed-When: Mon May 27 07:25:33 PDT 2002 
State-Changed-Why:  
It turns out that I had already fixed this bug in both --CURRENT 
and -STABLE; however, the submitter was tracking a security branch, 
which did not (and will not) have the fix merged. 

Still, thanks for reporting the problem! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=38558 
>Unformatted:
