Bug 578115 - missingok problem with globs
missingok problem with globs
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: logrotate (Show other bugs)
rawhide
All Linux
low Severity medium
: ---
: ---
Assigned To: Daniel Novotny
Fedora Extras Quality Assurance
:
Depends On: 540119 578116
Blocks:
  Show dependency treegraph
 
Reported: 2010-03-30 05:51 EDT by Daniel Novotny
Modified: 2010-04-06 06:06 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 540119
Environment:
Last Closed: 2010-04-06 06:06:58 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
patch ported from Debian (2.42 KB, patch)
2010-04-06 05:47 EDT, Daniel Novotny
no flags Details | Diff

  None (edit)
Description Daniel Novotny 2010-03-30 05:51:53 EDT
+++ This bug was initially created as a clone of Bug #540119 +++

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-06 05:47:57 EDT
Created attachment 404667 [details]
patch ported from Debian
Comment 2 Daniel Novotny 2010-04-06 06:06:58 EDT
fixed in logrotate-3.7.8-8.fc14

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