Package: logrotate
Version: 3.7.1-3
Severity: grave
Tags: patch
Justification: causes non-serious data loss
Logrotate overwrites logfiles by starting the compress program in
debug mode. In order to investigate why logrotate didn't compress
a logfile, I touched the file /var/log/my.own.log.1 without realising
that /var/log/my.own.log.1.gz already existed. After running
logrotate -d, the file /var/log/my.own.log.1.gz was overwritten by
the compressed contents of the empty file I just created and I lost
the original log file. This is in violation with the manual page,
which states:
-d Turns on debug mode and implies -v. In debug mode, no changes
will be made to the logs or to the logrotate state file.
Right now it will touch log files (opens my.log.1, creates my.log.1.gz).
Here is a patch to fix that:
--- logrotate.c-old 2008-09-19 10:39:56.000000000 +0200
+++ logrotate.c 2008-09-19 10:45:45.000000000 +0200
@@ -140,6 +140,11 @@
strlen(log->compress_ext) + 2);
sprintf(compressedName, "%s%s", name, log->compress_ext);
+ message(MESS_DEBUG, "compressing log with: %s\n", fullCommand[0]);
+
+ if (debug)
+ return 0;
+
if ((inFile = open(name, O_RDONLY)) < 0) {
message(MESS_ERROR, "unable to open %s for compression\n", name);
return 1;
@@ -173,8 +178,6 @@
return 1;
}
- message(MESS_DEBUG, "compressing log with: %s\n", fullCommand[0]);
-
if (!fork()) {
dup2(inFile, 0);
close(inFile);
Please consider applying this patch.
Regards,
Erik
-- Package-specific info:
Contents of /etc/logrotate.d
total 60
-rw-r--r-- 1 root root 137 2006-01-15 22:24 acpid
-rw-r--r-- 1 root root 366 2004-09-09 07:40 apache
-rw-r--r-- 1 root root 79 2003-06-09 22:05 aptitude
-rw-r--r-- 1 root root 384 2005-05-15 21:00 base-config
-rw-r--r-- 1 root root 113 2004-08-20 23:44 cron-apt
-rw-r--r-- 1 root root 245 2006-06-22 09:05 cupsys
-rw-r--r-- 1 root root 111 2007-01-02 00:02 dpkg
-rw-r--r-- 1 root root 273 2007-11-03 09:29 exim4-base
-rw-r--r-- 1 root root 151 2002-11-11 17:54 iptraf
-rw-r--r-- 1 root root 837 2008-06-26 22:38 mysql-server
-rw-r--r-- 1 root root 1116 2005-09-15 19:54 mysql-server.dpkg-old
-rw-r--r-- 1 root root 94 2003-10-30 22:44 ppp
-rw-r--r-- 1 root root 68 2002-07-25 18:10 scrollkeeper
-rw-r--r-- 1 root root 80 2006-07-19 07:13 wpa_action
-rw-r--r-- 1 root root 314 2006-12-11 14:26 wu-ftpd
-- System Information:
Debian Release: 4.0
APT prefers proposed-updates
APT policy: (500, 'proposed-updates'), (500, 'stable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.26
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Versions of packages logrotate depends on:
ii base-passwd 3.5.11 Debian base system master password
ii cron 3.0pl1-100 management of regular background p
ii libc6 2.3.6.ds1-13etch7 GNU C Library: Shared libraries
ii libpopt0 1.10-3 lib for parsing cmdline parameters
ii libselinux1 1.32-3 SELinux shared libraries
Versions of packages logrotate recommends:
ii mailx 1:8.1.2-0.20050715cvs-1 A simple mail user agent
-- no debconf information
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]