missingok does not work

Bug #256891 reported by Martin Pitt
16
Affects Status Importance Assigned to Milestone
logrotate (Debian)
Fix Released
Unknown
logrotate (Ubuntu)
Fix Released
High
Martin Pitt
Feisty
Won't Fix
Undecided
Unassigned
Gutsy
Fix Released
Undecided
Martin Pitt
Hardy
Fix Released
High
Martin Pitt
Intrepid
Fix Released
High
Martin Pitt

Bug Description

Binary package hint: logrotate

When a package is removed, but not purged, "missingok" usually prevents logrotate from complaining about missing files. That has regressed a while ago, see Debian bug for details.

--

SRU justification: Any logrotate.d/* file with a nonexisting log directory breaks complete log rotation.

Test case:

Create a logrotate snippet with nonexisting file:

    echo -e '/var/log/nonexisting/*.log {\n daily\n missingok\n}' | sudo tee /etc/logrotate.d/foo

Now check log rotation with

    logrotate -d -f /etc/logrotate.conf

With the broken package, it stops at foo, without processing any further files:

  [...]
  reading config file foo
  error: error accessing /var/log/nonexisting: No such file or directory
  error: foo:1 glob failed for /var/log/nonexisting/*.log
  # exit code 1

With the fixed package, it still logs the glob error, but goes on:

  [...]
  reading config file foo
  error: error accessing /var/log/nonexisting: No such file or directory
  error: foo:1 glob failed for /var/log/nonexisting/*.log
  reading config info for /var/log/nonexisting/*.log
  reading config file ppp
  [...]

However, if "missingok" is not specified, logrotate should continue to stop completely:

    echo -e '/var/log/nonexisting/*.log {\n daily\n }' | sudo tee /etc/logrotate.d/foo

  $ logrotate -d -f /etc/logrotate.conf
  [...]
  error: error accessing /var/log/nonexisting: No such file or directory
  error: foo:1 glob failed for /var/log/nonexisting/*.log
  reading config info for /var/log/nonexisting/*.log
  error: foo:3 glob failure without missingok
  # exit code 1

Revision history for this message
Martin Pitt (pitti) wrote :

This leads to accumulation of large quantities of log files, raising severity.

Changed in logrotate:
status: New → Triaged
assignee: nobody → pitti
importance: Undecided → High
Revision history for this message
Martin Pitt (pitti) wrote :

This does not affect dapper and edgy, and is confirmed to affect hardy and intrepid. Feisty and Gutsy need to be investigated.

Changed in logrotate:
assignee: nobody → pitti
importance: Undecided → High
status: New → Confirmed
Changed in logrotate:
status: Unknown → New
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Feisty and Gutsy are also affected by this bug.

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

This not only accumulate log files but this leads to a completely unnoticed failure of the log rotation system. A quick & dirty fix is to replace the "return 1" at line 971 in config.c with a "continue" .

According to https://bugzilla.redhat.com/show_bug.cgi?id=166510 this has been fixed in FC6 logrotate-3.7.4-10.fc6, and rawhide logrotate-3.7.4-11.fc7 nearly 2 years ago.

Backporting those changes is a huge work and upgrading to the latest version would definitely be the right solution.

Martin Pitt (pitti)
Changed in logrotate:
status: Triaged → In Progress
Changed in logrotate:
importance: High → Low
milestone: none → ubuntu-8.10
Revision history for this message
Martin Pitt (pitti) wrote :

Raising severity, this breaks other packages' log rotation.

Changed in logrotate:
importance: Low → High
Revision history for this message
Martin Pitt (pitti) wrote :

Jean-Baptiste, I looked through the code a bit, and I didn't find a better solution than your's either (except for very intrusive changes). I'll apply the change you suggested.

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

This bug was fixed in the package logrotate - 3.7.1-3ubuntu2

---------------
logrotate (3.7.1-3ubuntu2) intrepid; urgency=low

  * Add debian/patches/glob-failure.patch: Prevent logrotate from failing
    completely if one glob in any included file fails. This more or less
    behaves like an implied # "missingok" now, which isn't correctly parsed in
    the current version. Fixing it properly is a very intrusive change.
    (LP: #256891)

 -- Martin Pitt <email address hidden> Wed, 08 Oct 2008 13:59:23 +0200

Changed in logrotate:
status: In Progress → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote :

Whoops, forgot to credit you in the changelog.

Changed in logrotate:
status: Fix Released → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package logrotate - 3.7.1-3ubuntu3

---------------
logrotate (3.7.1-3ubuntu3) intrepid; urgency=low

  * Argh, forgot to credit the patch author in previous upload, updated
    changelog.

logrotate (3.7.1-3ubuntu2) intrepid; urgency=low

  * Add debian/patches/glob-failure.patch: Prevent logrotate from failing
    completely if one glob in any included file fails. This more or less
    behaves like an implied # "missingok" now, which isn't correctly parsed in
    the current version. Fixing it properly is a very intrusive change.
    (LP: #256891) Thanks to Jean-Baptiste Lallement for analyzing the problem
    and proposing the patch!

 -- Martin Pitt <email address hidden> Wed, 08 Oct 2008 14:07:33 +0200

Changed in logrotate:
status: In Progress → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote :

Fix for hardy uploaded, waiting for Steve to accept now.

For the record, the upstream test suite still passes with the patch applied, and the SRU test case now succeeds for me.

description: updated
Changed in logrotate:
status: Confirmed → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

Feisty will go end of live in some two weeks, not worth the trouble any more.

Changed in logrotate:
status: New → Won't Fix
Revision history for this message
Martin Pitt (pitti) wrote :

gutsy update uploaded, too (same version as for hardy, just with different version number)

Changed in logrotate:
assignee: nobody → pitti
status: New → In Progress
Changed in logrotate:
status: New → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote :

I rejected the current hardy and gutsy uploads, I just got a better fix for Intrepid (from Debian) which I am going to test first.

Revision history for this message
Martin Pitt (pitti) wrote :

This is the new patch. The essential idea is the same (replace the "return 1" with a "continue"), but with better error reporting.

Revision history for this message
Martin Pitt (pitti) wrote :

Also, the patch ensures that logrotate keeps stopping completely if "missingok" is *not* specified, to not change behaviour in that case.

description: updated
Revision history for this message
Martin Pitt (pitti) wrote :

Updated logrotate packages uploaded to hardy/gutsy-proposed, waiting for approval.

Revision history for this message
Steve Langasek (vorlon) wrote :

Accepted into -proposed, please test and give feedback here. Please see https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in logrotate:
status: In Progress → Fix Committed
Revision history for this message
Steve Langasek (vorlon) wrote :

Accepted into gutsy-proposed as well.

Changed in logrotate:
status: In Progress → Fix Committed
Revision history for this message
Paul Elliott (omahn) wrote :

Verified that the gutsy-proposed package resolves the issue on Gutsy.

Revision history for this message
Martin Pitt (pitti) wrote :

Copied to -updates.

Changed in logrotate:
status: Fix Committed → Fix Released
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Patches

Remote bug watches

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