logrotate cron script fails for logs with a space

Bug #932225 reported by Frederik Grunta
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
logrotate (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

/etc/cron.daily has a script called "logrotate" which will kick off logrotate. Before logrotate is executed, the script scans the logrotate status file, located in /var/lib/logrotate/status to search for non-existant files and remove them from the status file.

This script is written in a way which assumes all log files will not have spaces in their name, causing logrotate not to be passed these log files for rotation. The sequence of events is:

1) logrotate bash script starts, starting logrote, which looks into /etc/logrotate.d for logrotate configuration files. It inserts the relevant log file names into /var/lib/logrotate/status. On first detection of the log type, logrotate will not rotate the log.
2) Once one hour has passed, cron calls the logrotate bash script again. It scans /var/lib/logrotate/status for non-existant files. It is unable to parse a log file with a space in the name, and assumes the log file does not exist. It then removes the log from the status file.
3) logrotate starts, and as it does not have an entry for the log, adds it back into the status file, but does not rotate (same as 1) )

Attached is a patch - a replacement logrotate cron script.

---------

Ubuntu Server 11.04 Natty x64
logrotate 3.7.8-6ubuntu3.1
cron 3.0pl1-116ubuntu1

Revision history for this message
Frederik Grunta (fgrunta) wrote :
Revision history for this message
Frederik Grunta (fgrunta) wrote :

Removed verbopse flag from previous patch

description: updated
description: updated
description: updated
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Proposed replacement for /etc/cron.daily/logrotate" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Revision history for this message
renard (renard0) wrote :

Hi guys,

Any news about that fix?

We we it in production with no issues.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in logrotate (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.