On 2018-08-22 23:44:05 +0200, Christian Göttsche wrote:
> I tested logrotate version 3.14.0-2 with an ancient logfile from 1904
> and it got rotated. Also no such date should show up in the state file
> (only rotation times, not file mtimes).
> Can you reproduce this issue with logrotate 3.14.0-2 or newer?
> Please post a logrotate state file with such ancient dates.

This is old, and I'm not sure that the issue is the same.
And I no longer have the old machine to test under the
same conditions. But...

/var/lib/logrotate/status contains:

"/var/log/lpr.log" 2018-1-23-12:00:00

(i.e. a date sufficiently old to trigger a rotate).

# ls -l /var/log/lpr.log*
-rw-r----- 1 root adm  5 1904-01-01 00:00:00 /var/log/lpr.log
-rw-r----- 1 root adm  4 1904-01-01 00:00:00 /var/log/lpr.log.1
-rw-r----- 1 root adm 60 2015-06-18 18:41:13 /var/log/lpr.log.2.gz
# /usr/sbin/logrotate /etc/logrotate.conf
error: Compressing program wrote following message to stderr when compressing 
log /var/log/lpr.log.1:
gzip: stdin: warning: file timestamp out of range for gzip format
error: failed to compress log /var/log/lpr.log.1
# ls -l /var/log/lpr.log*
-rw-r----- 1 root adm  5 1904-01-01 00:00:00 /var/log/lpr.log
-rw-r----- 1 root adm  4 1904-01-01 00:00:00 /var/log/lpr.log.1
-rw-r----- 1 root adm 60 2015-06-18 18:41:13 /var/log/lpr.log.2.gz
# /usr/sbin/logrotate /etc/logrotate.conf
# ls -l /var/log/lpr.log*
-rw-r----- 1 root adm  5 1904-01-01 00:00:00 /var/log/lpr.log
-rw-r----- 1 root adm  4 1904-01-01 00:00:00 /var/log/lpr.log.1
-rw-r----- 1 root adm 60 2015-06-18 18:41:13 /var/log/lpr.log.2.gz

I don't know whether this was the cause of the failure of the
rotations in the past. But the error has disappeared and the
logs files are no longer rotated. This is inconsistent.

In case of gzip error, logrotate should either ignore it and rotate
the files, or it should keep the old date in /var/lib/logrotate/status
(I assume that the user should see the repeating error in cron
e-mails).

-- 
Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Reply via email to