severity 277652 serious
tags 277652 patch pending
thanks
On Wed, Oct 08, 2008 at 02:10:17PM +0200, Martin Pitt wrote:

> in Ubuntu we consider this a release critical bug, because a single
> glob failure in any configuration file can break the entire logrotate
> system. Thus we applied a quick hack (thanks to Jean-Baptiste
> Lallement) which works around the problem. syslog will stil get the
> glob errors, but at least the following logrotate.d files will be
> processed. This kind of breaks "nomissingok", but I don't think that
> it was ever intended to break the *entire* log rotation, it should
> just stop the current config file.

My response is to push the check to the end of the block. We're still going
to get people saying "why am I getting spammed by cron?" due to the error
messages.

How does this look? (I'm going to be giving it some testing before
uploading.)

--- logrotate-3.7.1.orig/config.c       2008-10-08 15:57:39.318679248 +0100
+++ logrotate-3.7.1/config.c    2008-10-08 16:09:33.203414313 +0100
@@ -370,6 +370,7 @@
     int createMode;
     struct stat sb, sb2;
     glob_t globResult;
+    int glob_failed;
     const char ** argv;
     int argc, argNum;
 
@@ -422,6 +423,7 @@
 
     message(MESS_DEBUG, "reading config file %s\n", configFile);
 
+    glob_failed = 0;
     start = buf;
     while (*start) {
        while (isblank(*start) && (*start)) start++;
@@ -968,7 +970,8 @@
 
                    message(MESS_ERROR, "%s:%d glob failed for %s\n",
                            configFile, lineNum, argv[argNum]);
-                   return 1;
+                   glob_failed = 1;
+                   continue;
                }
 
                newlog->files = realloc(newlog->files, sizeof(*newlog->files) * 
@@ -1011,6 +1014,12 @@
                message(MESS_ERROR, "%s:%d unxpected }\n", configFile, lineNum);
                return 1;
            }
+          
+           if (glob_failed && !(newlog->flags & LOG_FLAG_MISSINGOK)) {
+               message(MESS_ERROR, "%s:%d glob failure without missingok\n",
+                       configFile, lineNum);
+               return 1;
+           }
 
            if (newlog->oldDir) {
                for (i = 0; i < newlog->numFiles; i++) {
@@ -1046,6 +1055,7 @@
            }
 
            newlog = defConfig;
+           glob_failed = 0;
 
            start++;
            while (isblank(*start)) start++;


-- 
Paul Martin <[EMAIL PROTECTED]>

Attachment: signature.asc
Description: Digital signature

Reply via email to