Bug 540119 - missingok problem with globs
Summary: missingok problem with globs
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: logrotate
Version: 5.4
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Jan Kaluža
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks: 578115 578116
TreeView+ depends on / blocked
 
Reported: 2009-11-22 13:34 UTC by Owen Taylor
Modified: 2018-11-14 17:05 UTC (History)
6 users (show)

Fixed In Version: logrotate-3.7.4-12
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 578115 578116 (view as bug list)
Environment:
Last Closed: 2011-05-18 14:57:46 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
patch ported from Debian (2.38 KB, patch)
2010-04-13 16:00 UTC, Daniel Novotny
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:0816 0 normal SHIPPED_LIVE logrotate bug fix update 2011-05-18 14:57:14 UTC

Description Owen Taylor 2009-11-22 13:34:14 UTC
Description of problem:
globs for filenames are processed before the options for a log file are processed, causing the code that attempts to handle glob errors not to work correctly.

Version-Release number of selected component (if applicable):
logrotate-3.7.4-9 [RHEL 5]
logrotate-3.7.8-5.fc12 [Fedora 12]

Steps to Reproduce:
1. Add to /etc/logrotate.conf

===
/var/log/missing/foo {
    missingok
}

/var/log/missing2/foo* {
    missingok
}
===

2. Run logrotate
  
Actual results:

No error is produced for the first stanza where no glob is involved, the second stanza produces:

===
error: error accessing /var/log/missing2: No such file or directory
error: /etc/logrotate.conf:39 glob failed for /var/log/missing2/foo*
error: found error in /var/log/missing2/foo* , skipping
====

(The last line occurs for Fedora 12, in RHEL 5, the entire log rotation process fails.)

Expected results:
missingok causes log rotation to be silently skipped, even when a glob is involved.

Additional info:
There are two problems in the code in config.c:

 1. The 'globerr' function has no access to the flags for the logfile and prints the first line above unconditionally. Current logInfo could be stored in a global variable.

 2. The glob parsing is done before the options for the log file have been read, so even though the code checks:

                if (rc == GLOB_ABORTED) {
                    if (newlog->flags & LOG_FLAG_MISSINGOK)
                        continue;

that has no affect if the flag is set in the options for that log file.

Comment 1 Daniel Novotny 2010-04-13 16:00:50 UTC
Created attachment 406281 [details]
patch ported from Debian

Comment 5 RHEL Program Management 2011-01-11 20:38:44 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 6 RHEL Program Management 2011-01-11 23:01:08 UTC
This request was erroneously denied for the current release of
Red Hat Enterprise Linux.  The error has been fixed and this
request has been re-proposed for the current release.

Comment 11 Stefan Neufeind 2011-04-26 07:11:03 UTC
Would be great to have this solved ...

Comment 13 errata-xmlrpc 2011-05-18 14:57:46 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0816.html


Note You need to log in before you can comment on or make changes to this bug.