Package: logrotate
Version: 3.7.1-3
Severity: wishlist
Tags: patch
Logrotate currently exits if chown() fails. Chown() is impossible in
some network filesystem situations. The attached patch is a workaround
that preserves the warning but continues.
>From gzip(1):
gzip preserves the mode, ownership and timestamps of files when
compressing or decompressing.
However, I don't think assuming all compressors will do what gzip does
is safe.
A better solution that would work for all compressors would be to create
and chown/chmod the output file in /tmp first, then move it to the final
location before executing the compression.
-- Package-specific info:
Contents of /etc/logrotate.d
total 76
-rw-r--r-- 1 root root 137 2006-01-15 15:24 acpid
-rw-r--r-- 1 root root 366 2005-05-11 04:33 apache
-rw-r--r-- 1 root root 240 2006-01-16 04:15 apache2
-rw-r--r-- 1 root root 79 2003-06-09 15:05 aptitude
-rw-r--r-- 1 root root 384 2003-12-08 17:25 base-config
-rw-r--r-- 1 root root 215 2005-05-16 19:52 clamav-freshclam
-rw-r--r-- 1 root root 308 2004-01-20 15:17 distcc
-rw-r--r-- 1 root root 111 2005-06-28 08:22 dpkg
-rw-r--r-- 1 root root 273 2006-10-23 14:10 exim4-base
-rw-r--r-- 1 root root 151 2002-11-11 10:54 iptraf
-rw-r--r-- 1 root root 466 2005-05-04 19:13 nessusd
-rw-r--r-- 1 root root 153 2005-11-03 15:34 postgresql-common
-rw-r--r-- 1 root root 94 2003-10-30 15:44 ppp
-rw-r--r-- 1 root root 417 2006-02-11 15:45 privoxy
-rw-r--r-- 1 root root 330 2005-05-27 02:19 samba
-rw-r--r-- 1 root root 159 2001-10-29 18:29 samba.dpkg-old
-rw-r--r-- 1 root root 68 2004-02-08 03:18 scrollkeeper
-rw-r--r-- 1 root root 120 2003-01-24 08:35 tetrinetx
-rw-r--r-- 1 root root 333 2005-08-31 11:02 xdm
-- System Information:
Debian Release: 4.0
APT prefers testing
APT policy: (990, 'testing')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16.11
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
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-13 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
--- logrotate-3.7.1/logrotate.c 2004-10-19 16:41:24.000000000 -0500
+++ new/logrotate.c 2007-03-22 11:44:41.000000000 -0500
@@ -158,12 +158,9 @@
close(inFile);
return 1;
}
- if (fchown(outFile, sb->st_uid, sb->st_gid)) {
- message(MESS_ERROR, "error setting owner of %s: %s\n",
+ if (fchown(outFile, sb->st_uid, sb->st_gid)) {
+ message(MESS_ERROR, "unable to set owner of %s: %s\n",
compressedName, strerror(errno));
- close(outFile);
- close(inFile);
- return 1;
}
if (fchmod(outFile, sb->st_mode)) {
message(MESS_ERROR, "error setting mode of %s: %s\n",