Hi,
So, I've run into this bug twice now. And I think this problem is
actually considerably easier to hit than most of the reports here
are already suggesting, even with an otherwise normally functioning
system.
[Mathieu, I've cc'd you because I think the patch you proposed may
actually make this worse, since rather than the admin getting a
failure notice from cron, it will just silently hide the problem
and leave you with a *.backup file that will then *never* be rotated
or deleted ... but maybe I miss some detail there]
The first time I saw this, it appears to have been due to an
unfortunately timed reboot. There was a power outage during the
normal morning cron run, one set of logs was only partially rotated
and then logrotate failed to recover from that thereafter (which it
should have been able to easily do without any risk of loss).
That was a few months ago, and I didn't have time to dig into why,
so I just fixed it and moved on.
The second time was yesterday, and the cause was basically the same.
There was no major error in anything that logrotate used, and the
log partition wasn't full, logrotate was just interrupted in the
middle of its daily run, which in this case, left me with something
like:
munin-node.log
munin-node.log.1
munin-node.log.3.gz
munin-node.log.4.gz
munin-node.log.5.gz
...
from a config of:
/var/log/munin/munin-node.log {
daily
missingok
rotate 7
compress
copytruncate
notifempty
create 640 root root
}
And after some digging, the problem appears to be due to logrotate
making fragile assumptions about current state and the order it can
perform things in.
Ideally, it should have seen that log.1 was not compressed and then
compressed it during (or before) the rotate phase rather than just
whining log.1.gz was not present and failing to "overwrite" the
log.1 file.
Basically, people would hit exactly the same bug if they ever just
changed a configuration to remove the 'delaycompress' option ...
Given that this should be an easy state for logrotate to naturally
recover from, and that it appears to be a 'newly' introduced bug,
I don't think we should ship another release with this issue, and
it would be really nice to have it fixed in Jessie too, so I'm
going to bump the severity of this to make it RC now.