diff --git a/logrotate-3.8.0-maxsize.patch b/logrotate-3.8.0-maxsize.patch new file mode 100644 index 0000000..d23146e --- /dev/null +++ b/logrotate-3.8.0-maxsize.patch @@ -0,0 +1,97 @@ +Index: logrotate.c +=================================================================== +--- logrotate.c (revision 336) ++++ logrotate.c (working copy) +@@ -786,6 +786,8 @@ + } + if (log->minsize && sb.st_size < log->minsize) + state->doRotate = 0; ++ if (log->maxsize && sb.st_size > log->maxsize) ++ state->doRotate = 1; + } + + /* The notifempty flag overrides the normal criteria */ +@@ -1465,6 +1467,9 @@ + 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 { +Index: logrotate.h +=================================================================== +--- logrotate.h (revision 336) ++++ logrotate.h (working copy) +@@ -36,6 +36,7 @@ + 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; +Index: config.c +=================================================================== +--- config.c (revision 336) ++++ config.c (working copy) +@@ -290,6 +290,7 @@ + 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; +@@ -504,6 +505,7 @@ + .criterium = ROT_SIZE, + .threshhold = 1024 * 1024, + .minsize = 0, ++ .maxsize = 0, + .rotateCount = 0, + .rotateAge = 0, + .logStart = -1, +@@ -885,7 +887,8 @@ + 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; + +@@ -930,6 +933,8 @@ + if (!strncmp(opt, "size", 4)) { + newlog->criterium = ROT_SIZE; + newlog->threshhold = size; ++ } else if (!strncmp(opt, "maxsize", 7)) { ++ newlog->maxsize = size; + } else { + newlog->minsize = size; + } +Index: logrotate.8 +=================================================================== +--- logrotate.8 (revision 336) ++++ logrotate.8 (working copy) +@@ -285,7 +285,17 @@ + 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 diff --git a/logrotate.spec b/logrotate.spec index fc8993c..2aa0f61 100644 --- a/logrotate.spec +++ b/logrotate.spec @@ -1,7 +1,7 @@ Summary: Rotates, compresses, removes and mails system log files Name: logrotate Version: 3.8.0 -Release: 4%{?dist} +Release: 5%{?dist} License: GPL+ Group: System Environment/Base Url: https://fedorahosted.org/logrotate/ @@ -9,6 +9,7 @@ Source: https://fedorahosted.org/releases/l/o/logrotate/logrotate-%{version}.tar Patch0: logrotate-3.8.0-no-cron-redirection.patch Patch1: logrotate-3.8.0-rot-size.patch Patch2: logrotate-3.8.0-handle-acl-not-supported.patch +Patch3: logrotate-3.8.0-maxsize.patch Requires: coreutils >= 5.92 libsepol libselinux popt libacl BuildRequires: libselinux-devel popt-devel libacl-devel @@ -31,6 +32,7 @@ log files on your system. %patch0 -p1 %patch1 -p1 %patch2 +%patch3 %build make %{?_smp_mflags} RPM_OPT_FLAGS="$RPM_OPT_FLAGS" WITH_SELINUX=yes WITH_ACL=yes @@ -61,6 +63,9 @@ rm -rf $RPM_BUILD_ROOT %attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate.status %changelog +* Mon Aug 08 2011 Jan Kaluza 3.8.0-5 +- fix #723797 - added maxsize option + * Wed Aug 01 2011 Jan Kaluza 3.8.0-4 - fix #726980 - work properly when acl_get_fd is supported, but acl_set_fd is not