From se@FreeBSD.org  Sat Jan  4 09:50:56 2003
Return-Path: <se@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id ED91837B401
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  4 Jan 2003 09:50:55 -0800 (PST)
Received: from mailout02.sul.t-online.com (mailout02.sul.t-online.com [194.25.134.17])
	by mx1.FreeBSD.org (Postfix) with ESMTP id DA2C943EC5
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  4 Jan 2003 09:50:54 -0800 (PST)
	(envelope-from se@FreeBSD.org)
Received: from fwd08.sul.t-online.de 
	by mailout02.sul.t-online.com with smtp 
	id 18UsRh-0007gl-0A; Sat, 04 Jan 2003 18:50:53 +0100
Received: from Gatekeeper.FreeBSD.org (520047440004-0001@[80.132.254.189]) by fmrl08.sul.t-online.com
	with esmtp id 18UsRc-0YarTcC; Sat, 4 Jan 2003 18:50:48 +0100
Received: from StefanEsser.FreeBSD.org (StefanEsser [10.0.0.1])
	by Gatekeeper.FreeBSD.org (Postfix) with ESMTP id D07475F1C
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  4 Jan 2003 18:50:47 +0100 (CET)
Received: by StefanEsser.FreeBSD.org (Postfix, from userid 200)
	id A296C14B3; Sat,  4 Jan 2003 18:50:47 +0100 (CET)
Message-Id: <20030104175047.A296C14B3@StefanEsser.FreeBSD.org>
Date: Sat,  4 Jan 2003 18:50:47 +0100 (CET)
From: Stefan Esser <se@FreeBSD.org>
Reply-To: Stefan Esser <se@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [Patch] periodic scripts ignore .bz2 files
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         46759
>Category:       misc
>Synopsis:       [Patch] periodic scripts ignore .bz2 files
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 04 10:00:11 PST 2003
>Closed-Date:    Fri Jan 10 11:45:09 PST 2003
>Last-Modified:  Fri Jan 10 11:45:09 PST 2003
>Originator:     Stefan Esser
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD StefanEsser.FreeBSD.org 5.0-CURRENT FreeBSD 5.0-CURRENT #9: Sat Jan 4 09:52:47 CET 2003 se@StefanEsser.FreeBSD.org:/usr/src/sys/i386/compile/ISDN686 i386


	
>Description:
When newsyslog.conf was modified to compress rotated log files with bzip2
instead of gzip some 3 months ago, most of the periodic scripts that process 
those log files were not tought how to decompress those archived files.

This affects the following scripts:
	etc/periodic/daily/470.status-named
	etc/periodic/security/800.loginfail
	etc/periodic/security/900.tcpwrap
>How-To-Repeat:
Just check the scripts or their output for bzip2ed files ...
>Fix:
Just apply the following patch, which adds bzip2 support without 
dropping gzip support ...

Index: etc/periodic/daily/470.status-named
===================================================================
RCS file: /usr/cvs/src/etc/periodic/daily/470.status-named,v
retrieving revision 1.4
diff -u -r1.4 470.status-named
--- etc/periodic/daily/470.status-named	7 Dec 2002 23:37:44 -0000	1.4
+++ etc/periodic/daily/470.status-named	4 Jan 2003 17:33:00 -0000
@@ -14,7 +14,13 @@
 catmsgs() {
 	find /var/log -name 'messages.*' -mtime -2 |
 	    sort -t. -r -n -k 2,2 |
-	    xargs zcat -f
+	    while read f
+	    do
+		case $f in
+		    *.gz)	zcat -f $f;;
+		    *.bz2)	bzcat -f $f;;
+		esac
+	    done
 	[ -f /var/log/messages ] && cat /var/log/messages
 }
 
Index: etc/periodic/security/800.loginfail
===================================================================
RCS file: /usr/cvs/src/etc/periodic/security/800.loginfail,v
retrieving revision 1.4
diff -u -r1.4 800.loginfail
--- etc/periodic/security/800.loginfail	24 Sep 2002 18:53:46 -0000	1.4
+++ etc/periodic/security/800.loginfail	4 Jan 2003 17:33:15 -0000
@@ -45,7 +45,13 @@
 catmsgs() {
 	find ${LOG} -name 'auth.log.*' -mtime -2 |
 	    sort -t. -r -n -k 2,2 |
-	    xargs zcat -f
+	    while read f
+	    do
+		case $f in
+		    *.gz)	zcat -f $f;;
+		    *.bz2)	bzcat -f $f;;
+		esac
+	    done
 	[ -f ${LOG}/auth.log ] && cat $LOG/auth.log
 }
 
Index: etc/periodic/security/900.tcpwrap
===================================================================
RCS file: /usr/cvs/src/etc/periodic/security/900.tcpwrap,v
retrieving revision 1.2
diff -u -r1.2 900.tcpwrap
--- etc/periodic/security/900.tcpwrap	24 Sep 2002 18:53:46 -0000	1.2
+++ etc/periodic/security/900.tcpwrap	4 Jan 2003 17:33:38 -0000
@@ -45,7 +45,13 @@
 catmsgs() {
 	find ${LOG} -name 'messages.*' -mtime -2 |
 	    sort -t. -r -n -k 2,2 |
-	    xargs zcat -f
+	    while read f
+	    do
+		case $f in
+		    *.gz)	zcat -f $f;;
+		    *.bz2)	bzcat -f $f;;
+		esac
+	    done
 	[ -f ${LOG}/messages ] && cat $LOG/messages
 }
 
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: se 
State-Changed-When: Fri Jan 10 11:44:15 PST 2003 
State-Changed-Why:  
Patch applied. 

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