Bug 578115

Summary: missingok problem with globs
Product: [Fedora] Fedora Reporter: Daniel Novotny <dnovotny>
Component: logrotateAssignee: Daniel Novotny <dnovotny>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: dnovotny, otaylor, tsmetana
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 540119 Environment:
Last Closed: 2010-04-06 10:06:58 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 540119, 578116    
Bug Blocks:    
Attachments:
Description Flags
patch ported from Debian none

Description Daniel Novotny 2010-03-30 09:51:53 UTC
+++ 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 09:47:57 UTC
Created attachment 404667 [details]
patch ported from Debian

Comment 2 Daniel Novotny 2010-04-06 10:06:58 UTC
fixed in logrotate-3.7.8-8.fc14