diff --git a/logrotate-3.7.8-scripts-args.patch b/logrotate-3.7.8-scripts-args.patch new file mode 100644 index 0000000..9a7aac8 --- /dev/null +++ b/logrotate-3.7.8-scripts-args.patch @@ -0,0 +1,22 @@ +Index: logrotate.c +=================================================================== +--- logrotate.c (revision 277) ++++ logrotate.c (working copy) +@@ -1293,7 +1293,7 @@ + "since no logs will be rotated\n"); + } else { + message(MESS_DEBUG, "running prerotate script\n"); +- if (runScript(log->pattern, log->pre)) { ++ if (runScript(log->flags & LOG_FLAG_SHAREDSCRIPTS ? log->pattern : log->files[j], log->pre)) { + if (log->flags & LOG_FLAG_SHAREDSCRIPTS) + message(MESS_ERROR, + "error running shared prerotate script " +@@ -1328,7 +1328,7 @@ + "since no logs were rotated\n"); + } else { + message(MESS_DEBUG, "running postrotate script\n"); +- if (runScript(log->pattern, log->post)) { ++ if (runScript(log->flags & LOG_FLAG_SHAREDSCRIPTS ? log->pattern : log->files[j], log->post)) { + if (log->flags & LOG_FLAG_SHAREDSCRIPTS) + message(MESS_ERROR, + "error running shared postrotate script " diff --git a/logrotate-3.7.8-scripts-man.patch b/logrotate-3.7.8-scripts-man.patch new file mode 100644 index 0000000..26c1ce7 --- /dev/null +++ b/logrotate-3.7.8-scripts-man.patch @@ -0,0 +1,102 @@ +Index: logrotate.8 +=================================================================== +--- logrotate.8 (revision 277) ++++ logrotate.8 (working copy) +@@ -217,6 +217,11 @@ + The default value is -%Y%m%d. Note that also the character separating log + name from the extension is part of the dateformat string. The system clock + must be set past Sep 9th 2001 for %s to work correctly. ++Note that the datestamps generated by this format must be lexically sortable ++(i.e., first the year, then the month then the day. e.g., 2001/12/01 is ok, ++but 01/12/2001 is not, since 01/11/2002 would sort lower while it is later). ++This is because when using the \fBrotate\fR option, logrotate sorts all ++rotated filenames to find out which logfiles are older and should be removed. + + .TP + \fBdelaycompress\fR +@@ -336,7 +341,8 @@ + \fBnosharedscripts\fR + Run \fBprerotate\fR and \fBpostrotate\fR scripts for every log file which + is rotated (this is the default, and overrides the \fBsharedscripts\fR +-option). If the scripts exit with error, the remaining actions will ++option). The absolute path to the log file is passed as first argument ++to the script. If the scripts exit with error, the remaining actions will + not be executed for the affected log only. + + .TP +@@ -359,36 +365,44 @@ + .TP + \fBpostrotate\fR/\fBendscript\fR + The lines between \fBpostrotate\fR and \fBendscript\fR (both of which +-must appear on lines by themselves) are executed after the log file is +-rotated. These directives may only appear inside a log file definition. ++must appear on lines by themselves) are executed (using \fB/bin/sh\fR) ++after the log file is rotated. These directives may only appear inside ++a log file definition. Normally, the absolute path to the log file is ++passed as first argument to the script. If \fBsharedscripts\fR is specified, ++whole pattern is passed to the script. + See also \fBprerotate\fR. See \fBsharedscripts\fR and \fBnosharedscripts\fR + for error handling. + + .TP + \fBprerotate\fR/\fBendscript\fR + The lines between \fBprerotate\fR and \fBendscript\fR (both of which +-must appear on lines by themselves) are executed before the log file is +-rotated and only if the log will actually be rotated. These directives +-may only appear inside a log file definition. See also \fBpostrotate\fR. ++must appear on lines by themselves) are executed (using \fB/bin/sh\fR) before ++the log file is rotated and only if the log will actually be rotated. These ++directives may only appear inside a log file definition. Normally, ++the absolute path to the log file is passed as first argument to the script. ++If \fBsharedscripts\fR is specified, whole pattern is passed to the script. ++See also \fBpostrotate\fR. + See \fBsharedscripts\fR and \fBnosharedscripts\fR for error handling. + + .TP + \fBfirstaction\fR/\fBendscript\fR + The lines between \fBfirstaction\fR and \fBendscript\fR (both of which +-must appear on lines by themselves) are executed once before all log +-files that match the wildcarded pattern are rotated, before prerotate script +-is run and only if at least one log will actually be rotated. These directives +-may only appear inside a log file definition. If the script exits +-with error, no further processing is done. See also \fBlastaction\fR. ++must appear on lines by themselves) are executed (using \fB/bin/sh\fR) once ++before all log files that match the wildcarded pattern are rotated, before ++prerotate script is run and only if at least one log will actually be rotated. ++These directives may only appear inside a log file definition. Whole pattern is ++passed to the script as first argument. If the script exits with error, ++no further processing is done. See also \fBlastaction\fR. + + .TP + \fBlastaction\fR/\fBendscript\fR + The lines between \fBlastaction\fR and \fBendscript\fR (both of which +-must appear on lines by themselves) are executed once after all log +-files that match the wildcarded pattern are rotated, after postrotate script +-is run and only if at least one log is rotated. These directives may only +-appear inside a log file definition. If the script exits with +-error, just an error message is shown (as this is the last ++must appear on lines by themselves) are executed (using \fB/bin/sh\fR) once ++after all log files that match the wildcarded pattern are rotated, after ++postrotate script is run and only if at least one log is rotated. These ++directives may only appear inside a log file definition. Whole pattern is ++passed to the script as first argument. If the script exits ++with error, just an error message is shown (as this is the last + action). See also \fBfirstaction\fR. + + .TP +@@ -408,10 +422,12 @@ + .TP + \fBsharedscripts\fR + Normally, \fBprerotate\fR and \fBpostrotate\fR scripts are run for each +-log which is rotated, meaning that a single script may be run multiple ++log which is rotated and the absolute path to the log file is passed as first ++argument to the script. That means a single script may be run multiple + times for log file entries which match multiple files (such as the +-\fI/var/log/news/*\fR example). If \fBsharedscript\fR is specified, the scripts +-are only run once, no matter how many logs match the wildcarded pattern. ++\fI/var/log/news/*\fR example). If \fBsharedscripts\fR is specified, the scripts ++are only run once, no matter how many logs match the wildcarded pattern, ++and whole pattern is passed to them. + However, if none of the logs in the pattern require rotating, the scripts + will not be run at all. If the scripts exit with error, the remaining + actions will not be executed for any logs. This option overrides the diff --git a/logrotate.spec b/logrotate.spec index 6509471..811f282 100644 --- a/logrotate.spec +++ b/logrotate.spec @@ -1,7 +1,7 @@ Summary: Rotates, compresses, removes and mails system log files Name: logrotate Version: 3.7.8 -Release: 11%{?dist} +Release: 12%{?dist} License: GPL+ Group: System Environment/Base Source: https://fedorahosted.org/releases/l/o/logrotate/logrotate-%{version}.tar.gz @@ -14,6 +14,8 @@ Patch5: logrotate-3.7.8-readonly.patch Patch7: logrotate-3.7.8-missingok.patch Patch8: logrotate-3.7.8-configsize.patch Patch9: logrotate-3.7.8-dont-remove-log.patch +Patch10: logrotate-3.7.8-scripts-args.patch +Patch11: logrotate-3.7.8-scripts-man.patch Requires: coreutils >= 5.92 libsepol libselinux popt BuildRequires: libselinux-devel popt-devel @@ -41,6 +43,8 @@ log files on your system. %patch7 -p1 -b .missingok %patch8 -p2 -b .configsize %patch9 -b dont-remove-log.patch +%patch10 -b .scripts-args +%patch11 -b .scripts-man %build make %{?_smp_mflags} RPM_OPT_FLAGS="$RPM_OPT_FLAGS" WITH_SELINUX=yes @@ -71,6 +75,11 @@ rm -rf $RPM_BUILD_ROOT %attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate.status %changelog +* Tue Jun 22 2010 Jan Kaluza 3.7.8-12 +- fix #602643 - update manpage to reflect scripts changes +- fix #606675 - pass currently rotated file as argument to + postrotate/prerotate script in nosharedscripts mode + * Tue Jun 15 2010 Jan Kaluza 3.7.8-11 - fix #603040 - do not remove log if there is an error in rotate process