Commit 399ef751 authored by Paul Martin's avatar Paul Martin Committed by Tobias Frost

Import Debian changes 3.8.1-1

logrotate (3.8.1-1) unstable; urgency=low

  * New upstream release
    + Changes in 3.8.0 fix build problems on non-POSIX architectures 
      (Closes: #632501)
    + New config options: dateyesterday, maxsize, su. (See manpage.)
      (maxsize Closes: #635184)
  * New patch:
    + man-compressext-576362.patch. Correct manpage about compressext,
      compressoptions behaviour. (Closes: #576362)
  * debian/logrotate.README.Debian: update now that rsyslog is default
    for new installs. (Closes: #649598)
  * Incidentally, rsyslog is now default syslog, and that doesn't use 
    savelog but makes use of logrotate. (Closes: #379843)
  * Install logrotate.conf.5 (a redirect to logrotate.8) (Closes: #182261)
  * debian/control: depend on cron-daemon as an alternative to cron.
    (Closes: #334137)
  * lintian warning fix: move debian/logrotate.copyright to debian/copyright
  * debian/control: add Breaks: postgresql-common (<= 126) as its config 
    file requires an "su". Postgres maintainer is aware and awaits this
    upload.
  * Upload to unstable. (Closes: #648025)
parents ca055dc4 cf6bd7c0
3.8.0 -> 3.8.1
- fixed 1 memory leak in prerotateSingleLog
- another fixes for Solaris
- fixed HP-UX compilation and default config
- do not redirect logrotate errors to /dev/null in cron script
- fixed "size" directive parsing
- handle situation when acl_get_fd is supported, but acl_set_fd is not
- added "maxsize" directive (see man page)
3.7.9 -> 3.8.0
- added "dateyesterday" option (see man page)
- fixed crash when config file had exactly 4096*N bytes
......
......@@ -41,16 +41,14 @@ endif
# Solaris using gcc
ifeq ($(OS_NAME),SunOS)
CFLAGS = -I/opt/baw/include -D_GNU_SOURCE -D$(OS_NAME) -DVERSION=\"$(VERSION)\" $(RPM_OPT_FLAGS) $(LFS)
CFLAGS = -D_GNU_SOURCE -D$(OS_NAME) -DVERSION=\"$(VERSION)\" $(RPM_OPT_FLAGS) $(LFS)
CC ?= gcc
CPP = $(CC) -E -M
INSTALL = /usr/ucb/install
ifeq ($(CC),cc)
CPP = cc -xM
endif
ifeq ($(BASEDIR),)
BASEDIR = /usr/local
endif
BASEDIR ?= /usr/local
endif
# Red Hat Linux
......@@ -83,7 +81,7 @@ ifneq ($(STATEFILE),)
endif
BINDIR = $(BASEDIR)/sbin
MANDIR = $(BASEDIR)/man
MANDIR ?= $(BASEDIR)/man
#--------------------------------------------------------------------------
......@@ -95,6 +93,9 @@ CFLAGS += -g
LDFLAGS = -g
endif
LDFLAGS += $(EXTRA_LDFLAGS) $(EXTRA_LIBS)
CFLAGS += $(EXTRA_CPPFLAGS) $(EXTRA_CFLAGS)
ifeq (.depend,$(wildcard .depend))
TARGET=$(PROG)
else
......
#include <sys/queue.h>
#ifdef _ALLOCA_H
#include <alloca.h>
#else
#include <limits.h>
#endif
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
......@@ -41,6 +38,10 @@
#endif
#endif
#ifdef __hpux
#include "asprintf.c"
#endif
#if !defined(asprintf)
#include <stdarg.h>
......@@ -74,6 +75,29 @@ int asprintf(char **string_ptr, const char *format, ...)
#endif
#if !defined(strndup)
char *strndup(const char *s, size_t n)
{
size_t nAvail;
char *p;
if(!s)
return NULL;
/* min() */
nAvail = strlen(s) + 1;
if ( (n + 1) < nAvail)
nAvail = n + 1;
p = malloc(nAvail);
if (!p)
return NULL;
memcpy(p, s, nAvail);
p[nAvail - 1] = 0;
return p;
}
#endif
enum {
STATE_DEFAULT = 2,
STATE_SKIP_LINE = 4,
......@@ -270,6 +294,7 @@ static void copyLogInfo(struct logInfo *to, struct logInfo *from)
to->criterium = from->criterium;
to->threshhold = from->threshhold;
to->minsize = from->minsize;
to->maxsize = from->maxsize;
to->rotateCount = from->rotateCount;
to->rotateAge = from->rotateAge;
to->logStart = from->logStart;
......@@ -484,6 +509,7 @@ int readAllConfigPaths(const char **paths)
.criterium = ROT_SIZE,
.threshhold = 1024 * 1024,
.minsize = 0,
.maxsize = 0,
.rotateCount = 0,
.rotateAge = 0,
.logStart = -1,
......@@ -865,13 +891,13 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig)
newlog->flags |= LOG_FLAG_CREATE;
} else if (!strcmp(key, "nocreate")) {
newlog->flags &= ~LOG_FLAG_CREATE;
} else if (!strcmp(key, "size") || !strcmp(key, "minsize")) {
} else if (!strcmp(key, "size") || !strcmp(key, "minsize") ||
!strcmp(key, "maxsize")) {
unsigned long long size = 0;
char *opt = key;
if ((key = isolateValue(configFile, lineNum, opt, &start,
&buf, length)) != NULL) {
free(opt);
int l = strlen(key) - 1;
if (key[l] == 'k') {
key[l] = '\0';
......@@ -883,6 +909,7 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig)
key[l] = '\0';
multiplier = 1024 * 1024 * 1024;
} else if (!isdigit(key[l])) {
free(opt);
message(MESS_ERROR, "%s:%d unknown unit '%c'\n",
configFile, lineNum, key[l]);
if (newlog != defConfig) {
......@@ -899,6 +926,7 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig)
if (*chptr) {
message(MESS_ERROR, "%s:%d bad size '%s'\n",
configFile, lineNum, key);
free(opt);
if (newlog != defConfig) {
state = STATE_ERROR;
continue;
......@@ -906,11 +934,15 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig)
goto error;
}
}
if (!strncmp(key, "size", 4)) {
if (!strncmp(opt, "size", 4)) {
newlog->criterium = ROT_SIZE;
newlog->threshhold = size;
} else
} else if (!strncmp(opt, "maxsize", 7)) {
newlog->maxsize = size;
} else {
newlog->minsize = size;
}
free(opt);
}
else {
free(opt);
......@@ -1112,7 +1144,7 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig)
goto error;
}
}
else continue;
#if 0
if (stat(newlog->oldDir, &sb)) {
message(MESS_ERROR, "%s:%d error verifying olddir "
......@@ -1157,7 +1189,6 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig)
goto error;
}
}
else continue;
if (access(newlog->compress_prog, X_OK)) {
message(MESS_ERROR,
......@@ -1188,7 +1219,6 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig)
goto error;
}
}
else continue;
if (access(newlog->uncompress_prog, X_OK)) {
message(MESS_ERROR,
......@@ -1224,7 +1254,7 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig)
} else {
goto error;
}
} else continue;
}
if (poptParseArgvString(options,
&newlog->compress_options_count,
......@@ -1257,7 +1287,7 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig)
} else {
goto error;
}
} else continue;
}
message(MESS_DEBUG, "compress_ext is now %s\n",
newlog->compress_ext);
......
......@@ -7,7 +7,7 @@
#ifdef __hpux
#define DEFAULT_MAIL_COMMAND "/usr/bin/mailx"
#define COMPRESS_COMMAND "/usr/contrib/bin/gzip"
#define UNCOMPRESS_COMMAND " /usr/contrib/bin/gunzip"
#define UNCOMPRESS_COMMAND "/usr/contrib/bin/gunzip"
#define STATEFILE "/var/run/logrotate.status"
#endif
......
logrotate (3.8.1-1) unstable; urgency=low
* New upstream release
+ Changes in 3.8.0 fix build problems on non-POSIX architectures
(Closes: #632501)
+ New config options: dateyesterday, maxsize, su. (See manpage.)
(maxsize Closes: #635184)
* New patch:
+ man-compressext-576362.patch. Correct manpage about compressext,
compressoptions behaviour. (Closes: #576362)
* debian/logrotate.README.Debian: update now that rsyslog is default
for new installs. (Closes: #649598)
* Incidentally, rsyslog is now default syslog, and that doesn't use
savelog but makes use of logrotate. (Closes: #379843)
* Install logrotate.conf.5 (a redirect to logrotate.8) (Closes: #182261)
* debian/control: depend on cron-daemon as an alternative to cron.
(Closes: #334137)
* lintian warning fix: move debian/logrotate.copyright to debian/copyright
* debian/control: add Breaks: postgresql-common (<= 126) as its config
file requires an "su". Postgres maintainer is aware and awaits this
upload.
* Upload to unstable. (Closes: #648025)
-- Paul Martin <pm@debian.org> Mon, 05 Dec 2011 17:58:16 +0000
logrotate (3.8.0-1) experimental; urgency=low
* New upstream release (Closes: #633529)
......
......@@ -7,7 +7,8 @@ Standards-Version: 3.9.2
Package: logrotate
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, cron | anacron | fcron, base-passwd (>= 2.0.3.4)
Depends: ${shlibs:Depends}, ${misc:Depends}, cron | anacron | fcron | cron-daemon, base-passwd (>= 2.0.3.4)
Breaks: postgresql-common (<= 126)
Recommends: mailx
Description: Log rotation utility
The logrotate utility is designed to simplify the administration of
......
......@@ -19,7 +19,7 @@ Copyright: GNU GENERAL PUBLIC LICENSE (GPL) Version 2
All modifications to the packaging and patches by Paul Martin
<pm@debian.org> are also made available under the GPL:
Copyright (C) 2001-2008 Paul Martin
Copyright (C) 2001-2011 Paul Martin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
logrotate for Debian
--------------------
Note that logrotate is not the only log rotation program on a typical
Debian system. sysklogd uses its own log rotation scripts which can be
found in /etc/cron.daily/sysklogd and /etc/cron.weekly/sysklogd
Note that logrotate may not be the only log rotation program on a Debian
system.
If sysklogd is installed, as was the case in older versions of Debian,
it uses its own log rotation scripts which can be found in
/etc/cron.daily/sysklogd and /etc/cron.weekly/sysklogd
Current installs use rsyslog, which does not perform its own log
rotation, but makes use of logrotate.
~~
Logrotate prerotate/postrotate/firstaction/lastaction scripts are
currently executed by giving the whole script to "sh -c" thus:
......@@ -12,4 +20,4 @@ currently executed by giving the whole script to "sh -c" thus:
This might change in future versions.
-- Paul Martin <pm@debian.org> Sat, 8 Apr 2006 22:07:07 +0100
-- Paul Martin <pm@debian.org> Mon, 05 Dec 2011 17:38:47 +0000
Index: logrotate-3.8.0/logrotate.c
Index: logrotate-3.8.1/logrotate.c
===================================================================
--- logrotate-3.8.0.orig/logrotate.c 2011-08-28 18:44:41.751173686 +0100
+++ logrotate-3.8.0/logrotate.c 2011-08-28 18:44:48.575361785 +0100
@@ -316,8 +316,12 @@
--- logrotate-3.8.1.orig/logrotate.c 2011-12-05 16:40:17.796749416 +0000
+++ logrotate-3.8.1/logrotate.c 2011-12-05 16:40:20.936836809 +0000
@@ -317,8 +317,12 @@
if (fchown(fd, sb->st_uid, sb->st_gid)) {
message(MESS_ERROR, "error setting owner of %s: %s\n",
fileName, strerror(errno));
......
# Loosens the config syntax checking to allow more flexibility.
# (Closes: #95617,#95630)
Index: logrotate-3.8.0/config.c
Index: logrotate-3.8.1/config.c
===================================================================
--- logrotate-3.8.0.orig/config.c 2011-06-21 09:12:02.000000000 +0100
+++ logrotate-3.8.0/config.c 2011-08-28 18:36:43.501990594 +0100
@@ -1062,7 +1062,7 @@
--- logrotate-3.8.1.orig/config.c 2011-12-05 16:39:33.119505108 +0000
+++ logrotate-3.8.1/config.c 2011-12-05 16:39:38.151646143 +0000
@@ -1094,7 +1094,7 @@
while (*endtag) {
chptr = endtag;
......@@ -14,7 +14,7 @@ Index: logrotate-3.8.0/config.c
chptr++;
tabooExts = realloc(tabooExts, sizeof(*tabooExts) *
@@ -1074,8 +1074,10 @@
@@ -1106,8 +1106,10 @@
tabooCount++;
endtag = chptr;
......
shredcycles was not copied from outer blocks (eg. defaults) to inner
blocks. (Closes: #512152)
Index: logrotate-3.8.0/config.c
Index: logrotate-3.8.1/config.c
===================================================================
--- logrotate-3.8.0.orig/config.c 2011-08-28 18:36:43.501990594 +0100
+++ logrotate-3.8.0/config.c 2011-08-28 18:44:35.270995062 +0100
@@ -292,6 +292,7 @@
--- logrotate-3.8.1.orig/config.c 2011-12-05 16:39:38.151646143 +0000
+++ logrotate-3.8.1/config.c 2011-12-05 16:40:13.868640111 +0000
@@ -317,6 +317,7 @@
if (from->compress_ext)
to->compress_ext = strdup(from->compress_ext);
to->flags = from->flags;
......
......@@ -6,11 +6,11 @@ dpkg-cross sets CPP variable, and compilation failures, because
the executable 'cpp' does not accept multiple input files.
Index: logrotate-3.8.0/Makefile
Index: logrotate-3.8.1/Makefile
===================================================================
--- logrotate-3.8.0.orig/Makefile 2011-06-21 09:12:03.000000000 +0100
+++ logrotate-3.8.0/Makefile 2011-08-28 18:44:09.358280830 +0100
@@ -111,7 +111,7 @@
--- logrotate-3.8.1.orig/Makefile 2011-12-05 16:39:32.675492750 +0000
+++ logrotate-3.8.1/Makefile 2011-12-05 16:40:02.792331901 +0000
@@ -112,7 +112,7 @@
rm -f $(OBJS) $(PROG) core* .depend
depend:
......
......@@ -7,11 +7,11 @@ hasn't been compressed yet).
Index: logrotate-3.8.0/logrotate.c
Index: logrotate-3.8.1/logrotate.c
===================================================================
--- logrotate-3.8.0.orig/logrotate.c 2011-08-28 18:44:15.434448307 +0100
+++ logrotate-3.8.0/logrotate.c 2011-08-28 18:44:22.910654376 +0100
@@ -1064,7 +1064,8 @@
--- logrotate-3.8.1.orig/logrotate.c 2011-12-05 16:40:06.688440279 +0000
+++ logrotate-3.8.1/logrotate.c 2011-12-05 16:40:09.932530558 +0000
@@ -1072,7 +1072,8 @@
}
/* firstRotated is most recently created/compressed rotated log */
sprintf(rotNames->firstRotated, "%s/%s%s%s%s",
......
No longer consider state file dates before 1996 as fatal errors.
(Closes: #65534)
Index: logrotate-3.8.0/logrotate.c
Index: logrotate-3.8.1/logrotate.c
===================================================================
--- logrotate-3.8.0.orig/logrotate.c 2011-06-21 09:12:02.000000000 +0100
+++ logrotate-3.8.0/logrotate.c 2011-08-28 18:37:28.479231202 +0100
@@ -1760,7 +1760,7 @@
--- logrotate-3.8.1.orig/logrotate.c 2011-12-05 16:39:33.039502886 +0000
+++ logrotate-3.8.1/logrotate.c 2011-12-05 16:39:48.615937357 +0000
@@ -1775,7 +1775,7 @@
}
/* Hack to hide earlier bug */
......
......@@ -18,11 +18,11 @@ with the day of the last rotation, 01:00 AM. This can be solved by
setting lastRotated.tm_isdst correctly prior to the mktime() call.
Index: logrotate-3.8.0/logrotate.c
Index: logrotate-3.8.1/logrotate.c
===================================================================
--- logrotate-3.8.0.orig/logrotate.c 2011-08-28 18:37:28.479231202 +0100
+++ logrotate-3.8.0/logrotate.c 2011-08-28 18:44:15.434448307 +0100
@@ -210,6 +210,8 @@
--- logrotate-3.8.1.orig/logrotate.c 2011-12-05 16:39:48.615937357 +0000
+++ logrotate-3.8.1/logrotate.c 2011-12-05 16:40:06.688440279 +0000
@@ -211,6 +211,8 @@
new->lastRotated.tm_mon = now.tm_mon;
new->lastRotated.tm_mday = now.tm_mday;
new->lastRotated.tm_year = now.tm_year;
......
Index: logrotate-3.8.1/logrotate.8
===================================================================
--- logrotate-3.8.1.orig/logrotate.8 2011-12-05 16:39:57.248177567 +0000
+++ logrotate-3.8.1/logrotate.8 2011-12-05 17:17:53.407598914 +0000
@@ -170,13 +170,15 @@
.TP
\fBcompressext\fR
Specifies which extension to use on compressed logfiles, if compression
-is enabled. The default follows that of the configured compression
-command.
+is enabled. The default is ".gz". If you use a different compression
+command, you will need to change \fBcompressext\fR accordingly.
.TP
\fBcompressoptions\fR
Command line options may be passed to the compression program, if one is
-in use. The default, for \fBgzip\fR(1), is "-9" (maximum compression).
+in use. The default is "-9" (maximum compression for gzip). If you use a
+different compression command, you may need to change the
+\fBcompressoptions\fR to match.
.TP
\fBcopy\fR
Inconsistency in manpage logrotate(8), start directive
(Closes: #290628)
Index: logrotate-3.8.0/logrotate.8
Index: logrotate-3.8.1/logrotate.8
===================================================================
--- logrotate-3.8.0.orig/logrotate.8 2011-08-28 18:43:47.189669779 +0100
+++ logrotate-3.8.0/logrotate.8 2011-08-28 18:44:01.494064061 +0100
@@ -463,7 +463,7 @@
--- logrotate-3.8.1.orig/logrotate.8 2011-12-05 16:39:53.736079839 +0000
+++ logrotate-3.8.1/logrotate.8 2011-12-05 16:39:57.248177567 +0000
@@ -473,7 +473,7 @@
you specify 0, the logs will be created with a .0 extension as they are
rotated from the original log files. If you specify 9, log files will
be created with a .9, skipping 0-8. Files will still be rotated the
......
......@@ -4,10 +4,10 @@ Patches from: J S Bygott <jsb_no_spm@jsbygott.fsnet.co.uk>
General fixes to manpages.
Index: logrotate-3.8.0/logrotate.8
Index: logrotate-3.8.1/logrotate.8
===================================================================
--- logrotate-3.8.0.orig/logrotate.8 2011-06-21 09:12:02.000000000 +0100
+++ logrotate-3.8.0/logrotate.8 2011-08-28 18:43:47.189669779 +0100
--- logrotate-3.8.1.orig/logrotate.8 2011-12-05 16:39:32.891498763 +0000
+++ logrotate-3.8.1/logrotate.8 2011-12-05 16:39:53.736079839 +0000
@@ -11,9 +11,9 @@
weekly, monthly, or when it grows too large.
.P
......@@ -134,7 +134,7 @@ Index: logrotate-3.8.0/logrotate.8
no mail should be generated by a particular log, the \fBnomail\fR directive
may be used.
@@ -334,7 +339,7 @@
@@ -344,7 +349,7 @@
.TP
\fBnomail\fR
......@@ -143,7 +143,7 @@ Index: logrotate-3.8.0/logrotate.8
.TP
\fBnomissingok\fR
@@ -342,7 +347,7 @@
@@ -352,7 +357,7 @@
.TP
\fBnoolddir\fR
......@@ -152,7 +152,7 @@ Index: logrotate-3.8.0/logrotate.8
overrides the \fBolddir\fR option).
.TP
@@ -425,7 +430,7 @@
@@ -435,7 +440,7 @@
\fIsize\fR is followed by \fIk\fR, the size is assumed to be in kilobytes.
If the \fIM\fR is used, the size is in megabytes, and if \fIG\fR is used, the
size is in gigabytes. So \fBsize 100\fR, \fIsize 100k\fR, \fIsize 100M\fR and
......@@ -161,7 +161,7 @@ Index: logrotate-3.8.0/logrotate.8
.TP
\fBsharedscripts\fR
@@ -498,12 +503,15 @@
@@ -508,12 +513,15 @@
.SH SEE ALSO
.BR gzip (1)
......
......@@ -9,3 +9,4 @@ dateext-504079.patch
copyloginfo-512152.patch
sharedscripts-519432.patch
chown-484762.patch
man-compressext-576362.patch
Index: logrotate-3.8.0/logrotate.c
Index: logrotate-3.8.1/logrotate.c
===================================================================
--- logrotate-3.8.0.orig/logrotate.c 2011-08-28 18:44:22.910654376 +0100
+++ logrotate-3.8.0/logrotate.c 2011-08-28 18:44:41.751173686 +0100
@@ -259,6 +259,42 @@
--- logrotate-3.8.1.orig/logrotate.c 2011-12-05 16:40:09.932530558 +0000
+++ logrotate-3.8.1/logrotate.c 2011-12-05 16:40:17.796749416 +0000
@@ -260,6 +260,42 @@
return rc;
}
......@@ -45,7 +45,7 @@ Index: logrotate-3.8.0/logrotate.c
int createOutputFile(char *fileName, int flags, struct stat *sb)
{
int fd;
@@ -1533,18 +1569,22 @@
@@ -1548,18 +1584,22 @@
"since no logs will be rotated\n");
} else {
message(MESS_DEBUG, "running prerotate script\n");
......@@ -73,7 +73,7 @@ Index: logrotate-3.8.0/logrotate.c
}
}
}
@@ -1568,18 +1608,22 @@
@@ -1583,18 +1623,22 @@
"since no logs were rotated\n");
} else {
message(MESS_DEBUG, "running postrotate script\n");
......
#!/bin/sh
/usr/sbin/logrotate /etc/logrotate.conf >/dev/null 2>&1
/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
......
......@@ -285,7 +285,17 @@ if the logfile is to be rotated. The files are mailed to the
configured address if \fBmaillast\fR and \fBmail\fR are configured.
.TP
\fBminsize\fR \fIsize\fR
\fBmaxsize\fR \fIsize\fR
Log files are rotated when they grow bigger than \fIsize\fR bytes even
before the additionally specified time interval (\fBdaily\fR, \fBweekly\fR,
\fBmonthly\fR, or \fByearly\fR). The related \fBsize\fR option is similar
except that it is mutually exclusive with the time interval options, and it
causes log files to be rotated without regard for the last rotation time.
When \fBmaxsize\fR is used, both the size and timestamp of a log file are
considered.
.TP
\fBminsize\fR \fIsize\fR
Log files are rotated when they grow bigger than \fIsize\fR bytes, but not
before the additionally specified time interval (\fBdaily\fR, \fBweekly\fR,
\fBmonthly\fR, or \fByearly\fR). The related \fBsize\fR option is similar
......
#include <sys/queue.h>
#ifdef _ALLOCA_H
#include <alloca.h>
#else
#include <limits.h>
#endif
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
......@@ -51,6 +48,10 @@ static acl_t prev_acl = NULL;
#define STATEFILE_BUFFER_SIZE 4096
#endif
#ifdef __hpux
extern int asprintf(char **str, const char *fmt, ...);
#endif
struct logState {
char *fn;
struct tm lastRotated; /* only tm.mon, tm_mday, tm_year are good! */
......@@ -413,13 +414,15 @@ static int compressLogFile(char *name, struct logInfo *log, struct stat *sb)
}
if (prev_acl) {
if (acl_set_fd(outFile, prev_acl) == -1) {
message(MESS_ERROR, "setting ACL for %s: %s\n",
compressedName, strerror(errno));
acl_free(prev_acl);
prev_acl = NULL;
close(inFile);
close(outFile);
return 1;
if (errno != ENOTSUP) {
message(MESS_ERROR, "setting ACL for %s: %s\n",
compressedName, strerror(errno));
acl_free(prev_acl);
prev_acl = NULL;
close(inFile);
close(outFile);
return 1;
}
}
acl_free(prev_acl);
prev_acl = NULL;
......@@ -627,14 +630,16 @@ static int copyTruncate(char *currLog, char *saveLog, struct stat *sb,
}
#ifdef WITH_ACL
if (prev_acl) {
if (acl_set_fd(fdsave, prev_acl) == -1) {
message(MESS_ERROR, "setting ACL for %s: %s\n",
saveLog, strerror(errno));
acl_free(prev_acl);
prev_acl = NULL;
close(fdsave);
close(fdcurr);
return 1;
if ((fdsave, prev_acl) == -1) {
if (errno != ENOTSUP) {
message(MESS_ERROR, "setting ACL for %s: %s\n",
saveLog, strerror(errno));
acl_free(prev_acl);
prev_acl = NULL;
close(fdsave);
close(fdcurr);
return 1;
}
}
acl_free(prev_acl);
prev_acl = NULL;
......@@ -787,6 +792,9 @@ int findNeedRotating(struct logInfo *log, int logNum)
state->doRotate = 0;
}
if (log->maxsize && sb.st_size > log->maxsize)
state->doRotate = 1;
/* The notifempty flag overrides the normal criteria */
if (!(log->flags & LOG_FLAG_IFEMPTY) && !sb.st_size)
state->doRotate = 0;
......@@ -1153,6 +1161,8 @@ int prerotateSingleLog(struct logInfo *log, int logNum, struct logState *state,
hasErrors = 1;
}
}
if (hasErrors || i - 1 < 0)
free(oldName);
}
free(newName);
......@@ -1332,9 +1342,11 @@ int rotateSingleLog(struct logInfo *log, int logNum, struct logState *state,
#ifdef WITH_ACL
if (prev_acl) {
if (acl_set_fd(fd, prev_acl) == -1) {
message(MESS_ERROR, "setting ACL for %s: %s\n",
log->files[logNum], strerror(errno));
hasErrors = 1;
if (errno != ENOTSUP) {
message(MESS_ERROR, "setting ACL for %s: %s\n",
log->files[logNum], strerror(errno));
hasErrors = 1;
}
}
acl_free(prev_acl);
prev_acl = NULL;
......@@ -1460,6 +1472,9 @@ int rotateLogSet(struct logInfo *log, int force)
if (log->minsize)
message(MESS_DEBUG, "only log files >= %llu bytes are rotated, ", log->minsize);
if (log->maxsize)
message(MESS_DEBUG, "log files >= %llu are rotated earlier, ", log->minsize);
if (log->logAddress) {
message(MESS_DEBUG, "old logs mailed to %s\n", log->logAddress);
} else {
......
......@@ -36,6 +36,7 @@ struct logInfo {
enum { ROT_DAYS, ROT_WEEKLY, ROT_MONTHLY, ROT_YEARLY, ROT_SIZE,
ROT_FORCE } criterium;
unsigned long long threshhold;
unsigned long long maxsize;
unsigned long long minsize;
int rotateCount;
int rotateAge;
......
Summary: Rotates, compresses, removes and mails system log files
Name: logrotate
Version: 3.8.0
Version: 3.8.1
Release: 1
License: GPL+
Group: System Environment/Base
......@@ -52,6 +52,9 @@ rm -rf $RPM_BUILD_ROOT
%attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate.status
%changelog
* Wed Aug 31 2011 Jan Kaluza <jkaluza@redhat.com> 3.8.1-1
- new upstream version
* Tue Jun 21 2011 Jan Kaluza <jkaluza@redhat.com> 3.8.0-1
- new upstream version
......
......@@ -142,6 +142,7 @@ preptest() {
# we don't want any stuff left from previous runs
cleanup
# ------------------------------- Test 1 -------------------------------------
# Without a log file, no rotations should occur
preptest test.log 1 2
$RLR test-config.1
......@@ -176,6 +177,7 @@ EOF
cleanup 1
# ------------------------------- Test 2 -------------------------------------
preptest test.log 2 3
$RLR test-config.2 --force
......@@ -203,6 +205,7 @@ EOF
cleanup 3
# ------------------------------- Test 3 -------------------------------------
preptest test.log 3 1
preptest test2.log 3 1
$RLR test-config.3 --force
......@@ -217,6 +220,7 @@ EOF
cleanup 4
# ------------------------------- Test 4 -------------------------------------
preptest test.log 4 1
preptest test2.log 4 1
$RLR test-config.4 --force
......@@ -231,6 +235,7 @@ EOF
cleanup 5
# ------------------------------- Test 5 -------------------------------------
preptest test.log 5 1
preptest anothertest.log 5 1
$RLR test-config.5 --force
......@@ -245,6 +250,7 @@ EOF
cleanup 6
# ------------------------------- Test 6 -------------------------------------
preptest test.log 6 1
preptest anothertest.log 6 1
$RLR test-config.6 --force
......@@ -259,6 +265,7 @@ EOF
cleanup 7
# ------------------------------- Test 7 -------------------------------------
preptest test.log 7 1
preptest anothertest.log 7 1
......@@ -274,6 +281,7 @@ EOF
cleanup 8
# ------------------------------- Test 8 -------------------------------------
preptest test.log 8 1 1
$RLR test-config.8 --force
......@@ -287,6 +295,7 @@ checkmail test.log zero
cleanup 9
# ------------------------------- Test 9 -------------------------------------
preptest test.log 9 1 1