NetBSD Problem Report #46608

From jbernard@knox.mines.edu  Sun Jun 17 01:44:28 2012
Return-Path: <jbernard@knox.mines.edu>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 66B4C63B8CC
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 17 Jun 2012 01:44:28 +0000 (UTC)
Message-Id: <201206170144.q5H1iPV3005114@knox.mines.edu>
Date: Sat, 16 Jun 2012 19:44:25 -0600 (MDT)
From: Jim Bernard <jbernard@mines.edu>
Reply-To: jbernard@mines.edu
To: gnats-bugs@gnats.NetBSD.org
Subject: Add xz compression support to newsyslog
X-Send-Pr-Version: 3.95

>Number:         46608
>Category:       bin
>Synopsis:       Add a third compression option to newsyslog
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 17 01:45:00 +0000 2012
>Closed-Date:    Fri Dec 21 20:45:27 +0000 2012
>Last-Modified:  Fri Dec 21 20:45:27 +0000 2012
>Originator:     Jim Bernard
>Release:        NetBSD 6.99.7
>Organization:
>Environment:
System: NetBSD 6.99.7 #0: Wed Jun 13 19:59:26 MDT 2012 i386
Architecture: i386
Machine: i386
>Description:
	newsyslog currently supports two types of compression, gzip with
	the configuration-file "Z" flag and bzip2 with the "J" flag.  The
	person who added bzip2 compression really planned ahead, making
	it trivial to add new compression types.  The attached patch set
	adds compression with xz, using configuration-file flag "X".

>How-To-Repeat:
	Read the man page or the code.

>Fix:
	I elected to use the default compression level, because the
	compression time and memory usage vary so widely with the
	compression preset levels in xz.

--- newsyslog.c-dist	2009-08-21 02:20:19.000000000 -0600
+++ newsyslog.c	2012-06-16 19:01:35.000000000 -0600
@@ -119,10 +119,11 @@
 static struct compressor compress[] =
 {
 	{NULL, "", "", ""}, /* 0th compressor is "no compression" */
 	{"/usr/bin/gzip", "-f", ".gz", "Z"},
 	{"/usr/bin/bzip2", "-9f", ".bz2", "J"},
+	{"/usr/bin/xz", "-f", ".xz", "X"},
 };

 #define _PATH_NEWSYSLOGCONF	"/etc/newsyslog.conf"
 #define _PATH_SYSLOGDPID	_PATH_VARRUN"syslogd.pid"

@@ -375,11 +376,11 @@
 			log->flags |= CE_NOSIGNAL;
 			break;
 		case 'P':
 			log->flags |= CE_PLAIN0;
 			break;
-		case 'J': case 'Z':
+		case 'J': case 'X': case 'Z':
 			for (ziptype = __arraycount(compress); --ziptype; ) {
 				if (*compress[ziptype].flag == qq)
 				    break;
 			}
 			break;
--- newsyslog.8-dist	2007-12-21 12:45:33.000000000 -0700
+++ newsyslog.8	2012-06-16 19:13:38.000000000 -0600
@@ -38,11 +38,11 @@
 .\" the suitability of this software for any purpose.  It is
 .\" provided "as is" without express or implied warranty.
 .\"
 .\" from FreeBSD: newsyslog.8,v 1.14.2.1 1999/02/25 18:38:33 wollman Exp
 .\"
-.Dd December 21, 2007
+.Dd June 16, 2012
 .Dt NEWSYSLOG 8
 .Os
 .Sh NAME
 .Nm newsyslog
 .Nd maintain system log files to manageable sizes
@@ -332,10 +332,14 @@
 should not be compressed.
 .It Sy j
 Archived log files should be compressed with
 .Xr bzip2 1
 to save space.
+.It Sy x
+Archived log files should be compressed with
+.Xr xz 1
+to save space.
 .It Sy z
 Archived log files should be compressed with
 .Xr gzip 1
 to save space.
 .El

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/46608 CVS commit: src/usr.bin/newsyslog
Date: Sat, 16 Jun 2012 23:52:33 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Sun Jun 17 03:52:33 UTC 2012

 Modified Files:
 	src/usr.bin/newsyslog: newsyslog.8 newsyslog.c

 Log Message:
 PR/46608: Jim Bernard: Add xz conversion "X"


 To generate a diff of this commit:
 cvs rdiff -u -r1.36 -r1.37 src/usr.bin/newsyslog/newsyslog.8
 cvs rdiff -u -r1.59 -r1.60 src/usr.bin/newsyslog/newsyslog.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->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Fri, 21 Dec 2012 20:45:27 +0000
State-Changed-Why:
christos committed it in june


>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.