rpms/logrotate/F-13 logrotate-3.7.8-configsize.patch, NONE, 1.1 logrotate-3.7.8-dont-remove-log.patch, NONE, 1.1 logrotate-3.7.8-missingok.patch, NONE, 1.1 logrotate-3.7.8-scripts-args.patch, NONE, 1.1 logrotate-3.7.8-scripts-man.patch, NONE, 1.1 logrotate.spec, 1.85, 1.86

Jan Kaluža jkaluza at fedoraproject.org
Tue Jun 22 10:28:04 UTC 2010


Author: jkaluza

Update of /cvs/pkgs/rpms/logrotate/F-13
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv27054

Modified Files:
	logrotate.spec 
Added Files:
	logrotate-3.7.8-configsize.patch 
	logrotate-3.7.8-dont-remove-log.patch 
	logrotate-3.7.8-missingok.patch 
	logrotate-3.7.8-scripts-args.patch 
	logrotate-3.7.8-scripts-man.patch 
Log Message:
* Tue Jun 22 2010 Jan Kaluza <jkaluza at redhat.com> 3.7.8-9
- fix #602643 - update manpage to reflect scripts changes
- fix #606675 - pass currently rotated file as argument to
  postrotate/prerotate script in nosharedscripts mode
- fix #606715 - logrotate "size" directive cannot exceed
  1895825408 bytes
- fix missingok problem with globs


logrotate-3.7.8-configsize.patch:
 config.c    |    2 +-
 logrotate.c |    4 ++--
 logrotate.h |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

--- NEW FILE logrotate-3.7.8-configsize.patch ---
Index: /trunk/logrotate.c
===================================================================
--- /trunk/logrotate.c (revision 273)
+++ /trunk/logrotate.c (revision 276)
@@ -1199,5 +1199,5 @@
     switch (log->criterium) {
     case ROT_DAYS:
-	message(MESS_DEBUG, "after %d days ", log->threshhold);
+	message(MESS_DEBUG, "after %llu days ", log->threshhold);
 	break;
     case ROT_WEEKLY:
@@ -1211,5 +1211,5 @@
 	break;
     case ROT_SIZE:
-	message(MESS_DEBUG, "%d bytes ", log->threshhold);
+	message(MESS_DEBUG, "%llu bytes ", log->threshhold);
 	break;
     case ROT_FORCE:
Index: /trunk/logrotate.h
===================================================================
--- /trunk/logrotate.h (revision 248)
+++ /trunk/logrotate.h (revision 276)
@@ -34,6 +34,6 @@
     enum { ROT_DAYS, ROT_WEEKLY, ROT_MONTHLY, ROT_YEARLY, ROT_SIZE,
 	    ROT_FORCE } criterium;
-    unsigned int threshhold;
-    unsigned int minsize;
+    unsigned long long threshhold;
+    unsigned long long minsize;
     int rotateCount;
     int rotateAge;
Index: /trunk/config.c
===================================================================
--- /trunk/config.c (revision 274)
+++ /trunk/config.c (revision 276)
@@ -794,5 +794,5 @@
 		*endtag = oldchar, start = endtag;
 	    } else if (!strcmp(start, "size") || !strcmp(start, "minsize")) {
-		unsigned int size = 0;
+		unsigned long long size = 0;
 		char *opt = start;
 		*endtag = oldchar, start = endtag;

logrotate-3.7.8-dont-remove-log.patch:
 logrotate.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- NEW FILE logrotate-3.7.8-dont-remove-log.patch ---
Index: logrotate.c
===================================================================
--- logrotate.c	(revision 276)
+++ logrotate.c	(working copy)
@@ -848,9 +848,10 @@
 				    mailLogWrapper(mailFilename,
 						   mailCommand, logNum,
 						   log);
-			    if (!hasErrors)
+			    if (!hasErrors) {
 				message(MESS_DEBUG, "removing %s\n", mailFilename);
 				hasErrors = removeLogFile(mailFilename, log);
+				}
 			}
 			mail_out = i;
 		    }

logrotate-3.7.8-missingok.patch:
 config.c |   30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

--- NEW FILE logrotate-3.7.8-missingok.patch ---
diff -up logrotate-3.7.8/config.c.missingok logrotate-3.7.8/config.c
--- logrotate-3.7.8/config.c.missingok	2010-04-06 11:35:11.000000000 +0200
+++ logrotate-3.7.8/config.c	2010-04-06 11:43:37.000000000 +0200
@@ -41,6 +41,7 @@ static int defTabooCount = sizeof(defTab
 /* I shouldn't use globals here :-( */
 static char **tabooExts = NULL;
 int tabooCount = 0;
+static int glob_errno = 0;
 
 static int readConfigFile(const char *configFile, struct logInfo *defConfig);
 static int globerr(const char *pathname, int theerr);
@@ -461,8 +462,7 @@ int readAllConfigPaths(const char **path
 
 static int globerr(const char *pathname, int theerr)
 {
-    message(MESS_ERROR, "error accessing %s: %s\n", pathname,
-	    strerror(theerr));
+    glob_errno = theerr;
 
     /* We want the glob operation to abort on error, so return 1 */
     return 1;
@@ -501,6 +501,7 @@ static int readConfigFile(const char *co
     int logerror = 0;
     struct logInfo *log;
 	static unsigned recursion_depth = 0U;
+	char *globerr_msg = NULL;
 
     /* FIXME: createOwner and createGroup probably shouldn't be fixed
        length arrays -- of course, if we aren't run setuid it doesn't
@@ -1346,16 +1347,25 @@ static int readConfigFile(const char *co
 	    newlog->files = NULL;
 	    newlog->numFiles = 0;
 	    for (argNum = 0; argNum < argc && logerror != 1; argNum++) {
+		if (globerr_msg) {
+		    free(globerr_msg);
+		    globerr_msg = NULL;
+		}
+			
 		rc = glob(argv[argNum], GLOB_NOCHECK, globerr,
 			  &globResult);
 		if (rc == GLOB_ABORTED) {
 		    if (newlog->flags & LOG_FLAG_MISSINGOK)
 			continue;
 
-		    message(MESS_ERROR, "%s:%d glob failed for %s\n",
-			    configFile, lineNum, argv[argNum]);
-		    logerror = 1;
-		    break;
+          /* We don't yet know whether this stanza has "missingok"
+		     * set, so store the error message for later. */
+		    rc = asprintf(&globerr_msg, "%s:%d glob failed for %s: %s\n",
+			    configFile, lineNum, argv[argNum], strerror(glob_errno));
+		    if (rc == -1)
+			globerr_msg = NULL;
+		    
+		    globResult.gl_pathc = 0;
 		}
 
 		newlog->files =
@@ -1407,6 +1417,14 @@ duperror:
 			lineNum);
 		return 1;
 	    }
+	if (globerr_msg) {
+		if (!(newlog->flags & LOG_FLAG_MISSINGOK))
+		    message(MESS_ERROR, globerr_msg);
+		free(globerr_msg);
+		globerr_msg = NULL;
+		if (!(newlog->flags & LOG_FLAG_MISSINGOK))
+		    return 1;
+	    }
 
 	    if (newlog->oldDir) {
 		for (i = 0; i < newlog->numFiles; i++) {

logrotate-3.7.8-scripts-args.patch:
 logrotate.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- NEW FILE logrotate-3.7.8-scripts-args.patch ---
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 "

logrotate-3.7.8-scripts-man.patch:
 logrotate.8 |   54 +++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 35 insertions(+), 19 deletions(-)

--- NEW FILE logrotate-3.7.8-scripts-man.patch ---
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


Index: logrotate.spec
===================================================================
RCS file: /cvs/pkgs/rpms/logrotate/F-13/logrotate.spec,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -p -r1.85 -r1.86
--- logrotate.spec	20 Apr 2010 13:58:32 -0000	1.85
+++ logrotate.spec	22 Jun 2010 10:28:04 -0000	1.86
@@ -1,7 +1,7 @@
 Summary: Rotates, compresses, removes and mails system log files
 Name: logrotate
 Version: 3.7.8
-Release: 8%{?dist}
+Release: 9%{?dist}
 License: GPL+
 Group: System Environment/Base
 Source: https://fedorahosted.org/releases/l/o/logrotate/logrotate-%{version}.tar.gz
@@ -11,6 +11,11 @@ Patch3: logrotate-3.7.8-devnull.patch
 Patch4: logrotate-3.7.8-man5.patch
 Patch5: logrotate-3.7.8-readonly.patch
 #Patch6: logrotate-3.7.8-perm.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
@@ -35,6 +40,11 @@ log files on your system.
 %patch4 -p1 -b .man5
 %patch5 -p1 -b .readonly
 #%%patch6 -p1 -b .perm
+%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
@@ -65,6 +75,14 @@ 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 <jkaluza at redhat.com> 3.7.8-9
+- fix #602643 - update manpage to reflect scripts changes
+- fix #606675 - pass currently rotated file as argument to
+  postrotate/prerotate script in nosharedscripts mode
+- fix #606715 - logrotate "size" directive cannot exceed
+  1895825408 bytes
+- fix missingok problem with globs
+
 * Tue Apr 20 2010 Daniel Novotny <dnovotny at redhat.com> 3.7.8-8
 - revert the permission change (#489038)
 



More information about the scm-commits mailing list