--- logrotate-3.7.1.orig/debian/changelog +++ logrotate-3.7.1/debian/changelog @@ -0,0 +1,457 @@ +logrotate (3.7.1-3ubuntu0.8.04) hardy-proposed; urgency=low + + * Add debian/patches/globfix-277652: Prevent logrotate from failing + completely if one glob in any included file fails, but missing ok is + specified. Backported from 3.7.1-5, thanks to Jean-Baptiste Lallement for + analyzing the problem and proposing the inital patch, and to Paul Martin + for improving it. (LP: #256891) + + -- Martin Pitt Thu, 09 Oct 2008 09:17:32 +0200 + +logrotate (3.7.1-3) unstable; urgency=low + + * Patch debian/control to fix FTBFS on kfreebsd-amd64. Perhaps we need + a build-depends macro for !kfreebsd. (Closes: #361465) + * Use and depend on debhelper version 5. + * Switch from dpatch to quilt. + * cpp-crossbuild.patch: change from using $(CPP) to $(CC) -E. + Thanks to NIIBE Yutaka. (Closes: #284040) + * dst.patch: fix mktime initialisation so that daylight savings is + taken into account. Thanks to Holger Weiss. (Closes: #278591) + * man-333996.patch: fix typos in logrotate.8 where "then" should be + "than". Thanks to Adrian Knoth. (Closes: #333996) + * manpage.patch: Apply missed fixes from #101272. Thanks to J S Bygott. + (Closes: #335060) + * script-argument.patch: Allow the use of $1 in scripts again. + (Closes: #330783) + * README.Debian: Document that sysklogd does its own log rotation. + (Closes: #308963) + * README.Debian: Document how scripts are called. (Closes: #308920) + * Update the copyright file. + * debian/control: remove versioned dependency on cron. The version of + cron forbidden pre-dates woody (currently "oldstable") by several + years. This versioned dependency is preventing logrotate being + installed with bcron. (Closes: #304038, #349150) + * debian/rules: Fix backports, allowing them to use selinux. + (Closes: #340363) + * uncompressChild-warning.patch: Fix a "might be used uninitialised" + warning from gcc. + + -- Paul Martin Sat, 8 Apr 2006 23:02:19 +0100 + +logrotate (3.7.1-2) unstable; urgency=low + + * Patches: + + 40-compressutime: Preserve mtime/atime on compression. + (Closes: #286957) + + 40-scripterrors: Give error messages identifying log file on + script errors. (Closes: #122691, #195790, #222050, #306020) + + * Patch debian/control to fix FTBFS on kfreebsd-i386. (Closes: + #320331). + + -- Paul Martin Sat, 3 Sep 2005 13:37:53 +0100 + +logrotate (3.7.1-1) unstable; urgency=low + + * New upstream release (based on upstream 3.7.1-11) + + * This upload enables selinux code. (Closes: #193601, #315514) + + * Updated dpatches: + + 30-config-h: upstream has changed to using "/bin/mail" instead of + "/bin/mail -s" + + No need for 41-execlp-fix or 42-execlp-bin-sh. + + Upstream fix obsoletes 60-compressowner. + + * Upstream uses a patch system, too. Patches from upstream: + + 01-rh-dateext (logrotate-3.7.1-dateext.patch) + + 01-rh-maxage (logrotate-3.7.1-maxage.patch) + dateext and maxage (Closes: #178526, #188198, #226061, #257685, + #306304) + + 01-rh-noTMPDIR (logrotate-3.7.1-noTMPDIR.patch) + This has the effect of never requiring a tempdir for scripts. + There's the possibility of large scripts running into stack + limits. + + 01-rh-selinux (logrotate-3.7.1-selinux.patch) + Updates to selinux code. + + 52-man-rh-1 (based on logrotate-3-man.patch) + Explains a bit more about postrotate scripts and updates the + sharedscripts entry. + + * Update Standards-Version (no changes needed). + * Update copyright file with current upstream location. + + -- Paul Martin Mon, 25 Jul 2005 22:15:18 +0100 + +logrotate (3.7-5) unstable; urgency=high + + Brown paper bag upload. + + * 42-execlp-bin-sh: Fix major flaw in the last patch... it tries to + execute the logfile. Thanks very much for the quick report, Philipp. + It was my fault, not yours. (Closes: #279965) + + -- Paul Martin Wed, 25 May 2005 10:43:42 +0100 + +logrotate (3.7-4) unstable; urgency=high + + * 42-execlp-bin-sh: Call /bin/sh directly for scripts. Allows /tmp to + be mounted noexec. This is a simple fix for sarge -- a potentially + better fix is available upstream. Thanks to Philipp Hartmann. + (Closes: #279965) + + * Documentation fixes: + + 52-man-overriden: Fix spelling of "overridden" in manpage. + (Closes: #310337) + + 52-man-mailtypo: Fixes formatting of the -mail option in manpage. + (Closes: #300644) + + -- Paul Martin Wed, 25 May 2005 08:49:07 +0100 + +logrotate (3.7-3) unstable; urgency=high + + * 41-execlp-fix: "critical" bug with execlp() call on scripts. + This affects only those who use the undocumented feature of the + arguments of the script being the files that are being rotated. + Oh rats... I've just documented it! (Closes: #276172) + Thanks to Lars for the quick NMU. + + The rest of the changes are minor and are mainly to documentation: + + * Depend on cron | anacron | fcron. (Closes: #308172) + * 52-man-sizetypo.dpatch fixes "size=100k" typo in manpage. Thanks to + Ged Haywood for spotting this. Also spotted by Kjetil Kjernsmo + (Closes: #272716) + * 52-man-lastaction.dpatch fixes mistake in the lastaction + description. (Closes: #278172) + * Credit some of the RedHat authors in the debian/copyright file, and + update the location of the cvs repository. + * 52-man-startcount.dpatch, fixes manpage for "start" description. + (Closes: #290628) + + -- Paul Martin Mon, 16 May 2005 23:01:32 +0100 + +logrotate (3.7-2) unstable; urgency=high + + * Added commented out stuff in debian/rules to build a + logrotate-selinux package should Russell's move to get libselinux1 + made "base" fail. + * Patch: 21-taboo-to-debug, reduces the "Ignoring..." messages of + the taboo filter from ERROR to DEBUG. (Closes: #249073) + * Patch: 30-config-h, changed to fix upstream bug with mailing + logs. (Closes: #253837) + + -- Paul Martin Fri, 11 Jun 2004 13:51:34 +0100 + +logrotate (3.7-1) unstable; urgency=low + + * Moved to using dpatch to keep track of changes. + * New upstream release: + + Includes some SELinux code, not compiled in by default as + libselinux1 is not a base package. (Refer: #224880) + + Always use compressext for the extension for compressed + files; before compresscmd and compressext had to agree + + Compression and scripts don't use system() anymore + + compress and maillast didn't work together properly + + delaycompress and mailfirst didn't work properly + (Closes: #186818,#211687) + + Don't use system() for mailing (or uncompressing) logs anymore + + missingok works on directories, too (Closes: #246352,#248318) + * Manpage fixes: + + Include mention of G suffix to "size" option. + + Fix also the wording of the "weekly" option. (Closes: #232263) + + Fix examples' location of killall. (Closes: #189243) + + Fix description of "compressext". (Closes: #230519) + * Patches applied: + + Trustix logrotate-3.7-compressowner.patch, which retains + original owner and mode of logs when they are compressed. + * Fixed upstream source location in copyright file. (Closes: #187384) + * Standards-Version: 3.6.1 + + New default compilation options (10.1). + * Use and depend on debhelper 4. + * Added reportbug script. + + -- Paul Martin Mon, 10 May 2004 19:43:54 +0100 + +logrotate (3.6.5-3) unstable; urgency=low + + * Added missingok to /var/log/wtmp entry of logrotate.conf. + (Closes: #199154) + + -- Paul Martin Tue, 11 Nov 2003 23:17:24 +0000 + +logrotate (3.6.5-2) unstable; urgency=low + + * Added check for prerotate and postrotate scripts having no + terminating endscript. (Closes: #162976) + + -- Paul Martin Wed, 9 Oct 2002 18:21:36 +0100 + +logrotate (3.6.5-1) unstable; urgency=low + + * New upstream release + - Stop the shared postrotate/prerotate scripts from running if none + of the log(s) need rotating (Closes: #149135, #153284, #15890) + - Use TMPDIR instead of /tmp, if specified, when executing scripts. + - New config directives "copy", "nocopy" and "start". + - Sizes can be expressed in gigabytes (G suffix). + - Some updates to manpage. + + Manpage documents naming of rotated files (Closes: #143169) + * Standards-Version: 3.5.6 + + -- Paul Martin Tue, 27 Aug 2002 00:21:14 +0100 + +logrotate (3.5.9-10) unstable; urgency=high + + * cron.daily was getting deleted by the debian/rules script. Mea + maxima culpa. (Closes: #152966). + + -- Paul Martin Tue, 30 Jul 2002 00:08:37 +0100 + +logrotate (3.5.9-9) unstable; urgency=high + + * Downgraded depends on mailx to a recommends. + (Closes: #127239, #149535) + * Really put check for existence of logrotate binary into the + cron.daily script. It was getting overwritten by a copy from the + examples directory. (Closes: #150727) + + -- Paul Martin Sat, 22 Jun 2002 23:48:27 +0100 + +logrotate (3.5.9-8) unstable; urgency=high + + * Added check to cron.daily (blatantly stolen from exim's) to only + attempt to run logrotate if it's binary exists. (Closes: #144265) + * Priority high to ensure this minimal bugfix (a violation of a + "should" policy directive) gets into woody. + + -- Paul Martin Tue, 23 Apr 2002 23:16:43 +0100 + +logrotate (3.5.9-7) unstable; urgency=medium + + * More typos fixed. Thanks to David Lawyer . + (Closes: #134944). + * Simple logic fix in decision of whether to uncompress a logfile + when mailing it. (Closes: #137573) + + -- Paul Martin Tue, 12 Mar 2002 17:30:02 +0000 + +logrotate (3.5.9-6) unstable; urgency=low + + * No changes to programs, only to documentation. + * Changes to manpage logrotate.8: + + Fixed typos, errors and omissions. (Closes: #101272) + Thanks to Jeremy S Bygott + + Documented the location of killall program. + + Fix the other mention of the status file location. + + Documented error behaviour of globs in config file. + (Closes: #128795) + * Upstream added an "olddir" directive some time ago. + (Closes: #56044) + + -- Paul Martin Fri, 8 Feb 2002 20:08:36 +0000 + +logrotate (3.5.9-5) unstable; urgency=low + + * Further development on bug #118466. Use stat() rather than + fgetc/ungetc. Thanks to Ian Wienand for being + unsatisfied with my previous attempts, which contained many + logic errors. Mea culpa. + (Closes: #119176) + + -- Paul Martin Sun, 18 Nov 2001 11:59:08 +0000 + +logrotate (3.5.9-4) unstable; urgency=low + + * Fix the logic error in the last two uploads. Use fgetc/ungetc + instead of feof. (Closes: #118466) + + -- Paul Martin Wed, 14 Nov 2001 00:37:55 +0000 + +logrotate (3.5.9-3) unstable; urgency=low + + * Fix a bug I introduced in the last upload. Check that filehandles + are non-null when you reference them. Brown paper bag time. + (Closes: #118907,#119176) + + -- Paul Martin Tue, 13 Nov 2001 12:45:51 +0000 + +logrotate (3.5.9-2) unstable; urgency=low + + * Manpage was giving wrong location for status file. Fixed. + * Test that status file is non zero length before trying + to read it. (Closes: #118466) + + -- Paul Martin Tue, 6 Nov 2001 21:36:48 +0000 + +logrotate (3.5.9-1) unstable; urgency=low + + * New upstream release: + + Incorporates the Debian fix to #110958. + + Manpage updates. + + Checks for negative values of rotate (Closes: #42683) + + Fix to "extension" being ignored (Closes: #104335) + + -- Paul Martin Wed, 5 Sep 2001 22:42:13 +0100 + +logrotate (3.5.7-5) unstable; urgency=low + + * Removed rotation of /var/log/lastlog. It's a file that doesn't grow, + and rotating it loses all the lastlog information. Perhaps making + a backup would make more sense. (Closes: #111184) + + -- Paul Martin Tue, 4 Sep 2001 16:14:16 +0100 + +logrotate (3.5.7-4) unstable; urgency=low + + * Fixed bug with trying to free() a static string. (Closes: #110958) + + -- Paul Martin Mon, 3 Sep 2001 00:03:37 +0100 + +logrotate (3.5.7-3) unstable; urgency=low + + * Removed the debian/logrotate.conffiles, as debhelper v3 now + automatically includes all files in /etc as conffiles. + (Closes: #105616) + + -- Paul Martin Wed, 18 Jul 2001 11:48:03 +0100 + +logrotate (3.5.7-2) unstable; urgency=low + + * Removed the "errors root" from the default /etc/logrotate.conf file. + (Closes: #105349) + + -- Paul Martin Sun, 15 Jul 2001 16:35:24 +0100 + +logrotate (3.5.7-1) unstable; urgency=low + + * New upstream release: + + Allows compression command to be configurable (Closes: #101007) + + Enables LFS support (Closes: #100810) + + Quotes filenames for running compress commands or pre/postrotate + commands. + + Errors directive has been removed. For reasons, see + http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=16544 + * Changed preinst and new postrm scripts to clean up old status files. + (Closes: #101831) + + -- Paul Martin Fri, 13 Jul 2001 23:21:57 +0100 + +logrotate (3.5.4-2) unstable; urgency=low + + * Loosened the config syntax checking to allow more flexibility. + (Closes: #95617,#95630) + * mailx is now in testing. (Closes: #67053) + * Compile with -O2. + + -- Paul Martin Tue, 15 May 2001 01:59:19 +0100 + +logrotate (3.5.4-1) unstable; urgency=low + + * New maintainer. + * New upstream release. (Closes: #71385,#78378,#81582,#88769) + * Added .dpkg-new to default tabooext list. (Closes: #80527) + * Changing to in log.c fixes compiler warning. + * Removed RPM from logrotate.conf. (Closes: #52802,#78349,#65162,#90990) + * Moved the logrotate.status back to /var/lib. FHS compliance. + (Closes: #49553,#59120,#68728) + * Removed tab characters from manpage source. (Closes: #53903) + * Changed dependencies to allow either cron or anacron. + (Closes: #87716) + * Placed upstream source location in copyright file. (Closes: #45184) + * Added rotation of /var/log/btmp and /var/log/lastlog to default + configuration. + * No longer consider state file dates before 1996 as fatal errors. + (Closes: #65534) + * Commas now no longer delimit tabooexts. Manpage changed to reflect + this. (Closes: #52719) + + -- Paul Martin Thu, 26 Apr 2001 02:22:52 +0100 + +logrotate (3.2-11) unstable; urgency=low + + * cron dependency is now versioned >= 3.0pl1-53, the first cron to fix + the wtmp/btmp rotation problem + + -- Joseph Carter Sun, 12 Sep 1999 15:51:07 -0700 + +logrotate (3.2-10) unstable; urgency=low + + * Added versioned depends on base-passwd to make upgrades from slink + work normally. (Closes: #44667) + + -- Joseph Carter Thu, 9 Sep 1999 19:05:02 -0700 + +logrotate (3.2-9) unstable; urgency=low + + * Cleaned up a couple of typos (Closes: #43716) + * Added btmp with missingok to logrotate defaults (Closes: #43717) + + -- Joseph Carter Sat, 4 Sep 1999 13:55:11 -0700 + +logrotate (3.2-8) unstable; urgency=low + + * You can now disable logrotate.d entries by renaming them to include + the .disabled extention. Also logrotate will now ignore dpkg dropping + files (Closes: #43703) + + -- Joseph Carter Sun, 29 Aug 1999 11:34:27 -0700 + +logrotate (3.2-7) unstable; urgency=low + + * No longer rotate lastlog (Closes: #43422) + + -- Joseph Carter Tue, 24 Aug 1999 20:52:39 -0700 + +logrotate (3.2-6) unstable; urgency=low + + * Now Depends on cron like it should + + -- Joseph Carter Mon, 2 Aug 1999 09:51:58 -0700 + +logrotate (3.2-5) unstable; urgency=low + + * /etc/logrotate.conf is now a conffile. How I missed this it one before + is quite beyond me. Oops. => (Closes #42195) + + -- Joseph Carter Fri, 30 Jul 1999 10:39:58 -0700 + +logrotate (3.2-4) unstable; urgency=low + + * removed dependency on bash from postinst (Closes: #41118) + + -- Joseph Carter Mon, 26 Jul 1999 00:47:41 -0700 + +logrotate (3.2-3) unstable; urgency=low + + * More FHS updates, new standards version, debhelper v2, etc + * Recompiled with libpopt + * We now have a group utmp and will use it + * Priority: Important since policy 3 mandates logrotate for log rotaton + + -- Joseph Carter Fri, 16 Jul 1999 10:09:23 -0700 + +logrotate (3.2-2) unstable; urgency=low + + * Moved the status file from /var/lib/logrotate.status which is lame to + /var/state/logrotate/status + * I spaced the use of /bin/mail---oops. It's a symlink on this system so + it didn't BREAK anything here. I also didn't declare dependency on + mailx. Someone get me a paper bag. Closes: bug#37817 + * Renamed debian/* files to debian/logrotate.* in preperation for The + Debhelper 2.x Way. Harmless change and makes me feel useful. => + * Changed wtmp rotation in the default conffile. Rotates as root.adm for + now. This is a temporary change pending utmp group implemenetation. + + -- Joseph Carter Sun, 16 May 1999 16:09:42 -0700 + +logrotate (3.2-1) unstable; urgency=low + + * Initial Release. + + -- Joseph Carter Thu, 22 Apr 1999 15:33:04 -0700 + +Local variables: +mode: debian-changelog +End: --- logrotate-3.7.1.orig/debian/source.lintian-overrides +++ logrotate-3.7.1/debian/source.lintian-overrides @@ -0,0 +1,2 @@ +# lintian doesn't seem to know about kfreebsd-amd64 yet. +logrotate source: invalid-arch-string-in-source-relation kfreebsd-amd64 [build-depends: libselinux1-dev [!hurd-i386 !kfreebsd-i386 !kfreebsd-amd64]] --- logrotate-3.7.1.orig/debian/logrotate.bug +++ logrotate-3.7.1/debian/logrotate.bug @@ -0,0 +1,5 @@ +#!/bin/sh + +printf "Contents of /etc/logrotate.d\n" >&3 +ls -l /etc/logrotate.d >&3 +printf "\n" >&3 --- logrotate-3.7.1.orig/debian/cron.daily +++ logrotate-3.7.1/debian/cron.daily @@ -0,0 +1,4 @@ +#!/bin/sh + +test -x /usr/sbin/logrotate || exit 0 +/usr/sbin/logrotate /etc/logrotate.conf --- logrotate-3.7.1.orig/debian/compat +++ logrotate-3.7.1/debian/compat @@ -0,0 +1 @@ +5 --- logrotate-3.7.1.orig/debian/logrotate.conf +++ logrotate-3.7.1/debian/logrotate.conf @@ -0,0 +1,32 @@ +# see "man logrotate" for details +# rotate log files weekly +weekly + +# keep 4 weeks worth of backlogs +rotate 4 + +# create new (empty) log files after rotating old ones +create + +# uncomment this if you want your log files compressed +#compress + +# packages drop log rotation information into this directory +include /etc/logrotate.d + +# no packages own wtmp, or btmp -- we'll rotate them here +/var/log/wtmp { + missingok + monthly + create 0664 root utmp + rotate 1 +} + +/var/log/btmp { + missingok + monthly + create 0664 root utmp + rotate 1 +} + +# system-specific logs may be configured here --- logrotate-3.7.1.orig/debian/rules +++ logrotate-3.7.1/debian/rules @@ -0,0 +1,148 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +CFLAGS = -Wall -g +INSTALL = install +INSTALL_FILE = $(INSTALL) -p -o root -g root -m 644 +INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755 +INSTALL_SCRIPT = $(INSTALL) -p -o root -g root -m 755 +INSTALL_DIR = $(INSTALL) -p -d -o root -g root -m 755 + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) +CFLAGS += -O0 +else +CFLAGS += -O2 +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) +INSTALL_PROGRAM += -s +endif + +export DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS \ + 2>/dev/null || true) + +export DEB_HOST_GNU_SYSTEM := $(shell dpkg-architecture \ + -qDEB_HOST_GNU_SYSTEM 2>/dev/null || true) + +ifeq ($(DEB_HOST_ARCH_OS),) + DEB_HOST_ARCH_OS := $(subst -gnu,,$(DEB_HOST_GNU_SYSTEM)) + ifeq ($(DEB_HOST_ARCH_OS),gnu) + DEB_HOST_ARCH_OS := hurd + endif +endif + +configure: configure-stamp +configure-stamp: patch + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + +build: configure-stamp build-stamp +build-stamp: patch + dh_testdir + +ifeq ($(DEB_HOST_ARCH_OS),linux) + $(MAKE) RPM_OPT_FLAGS="$(CFLAGS)" WITH_SELINUX="yes" +else + $(MAKE) RPM_OPT_FLAGS="$(CFLAGS)" +endif + + touch build-stamp + +clean: clean-patched unpatch +clean-patched: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + -$(MAKE) clean + rm -f .depend + + dh_clean logrotate.selinux + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/logrotate. + $(INSTALL_PROGRAM) $(CURDIR)/logrotate \ + $(CURDIR)/debian/logrotate/usr/sbin/ + #$(INSTALL_PROGRAM) $(CURDIR)/logrotate.selinux \ + # $(CURDIR)/debian/logrotate-selinux/usr/sbin/logrotate + + $(INSTALL_FILE) $(CURDIR)/debian/logrotate.conf \ + $(CURDIR)/debian/logrotate/etc/logrotate.conf + #$(INSTALL_FILE) $(CURDIR)/debian/logrotate.conf \ + # $(CURDIR)/debian/logrotate-selinux/etc/logrotate.conf + + # reportbug script + $(INSTALL_SCRIPT) $(CURDIR)/debian/logrotate.bug \ + $(CURDIR)/debian/logrotate/usr/share/bug/logrotate/script + #$(INSTALL_SCRIPT) $(CURDIR)/debian/logrotate.bug \ + # $(CURDIR)/debian/logrotate-selinux/usr/share/bug/logrotate/script + + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot +# dh_installdebconf + dh_installdocs + dh_installexamples +# dh_installmenu +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_installinit + dh_installcron + dh_installman logrotate.8 +# dh_installinfo +# dh_undocumented + dh_installchangelogs CHANGES + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_makeshlibs + dh_installdeb +# dh_perl + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch + +patch: patch-stamp +patch-stamp: + QUILT_PATCHES=debian/patches quilt push -a || test $$? = 2 + touch patch-stamp + +unpatch: + QUILT_PATCHES=debian/patches quilt pop -a -R || test $$? = 2 + rm -rf .pc patch-stamp + +#patch: patch-stamp +#patch-stamp: +# dpatch apply-all +# touch patch-stamp +# # dpatch call-all -a=pkg-info >patch-stamp +# +#unpatch: +# dpatch deapply-all +# rm -rf patch-stamp debian/patched + +.PHONY: build clean binary-indep binary-arch binary install configure \ + patch unpatch clean-patched --- logrotate-3.7.1.orig/debian/logrotate.README.Debian +++ logrotate-3.7.1/debian/logrotate.README.Debian @@ -0,0 +1,15 @@ +logrotate for Debian +-------------------- + +Note that logrotate is not the only log rotation program on a typical +Debian system. sysklogd uses its own log rotation scripts which can be +found in /etc/cron.daily/sysklogd and /etc/cron.weekly/sysklogd + +Logrotate prerotate/postrotate/firstaction/lastaction scripts are +currently executed by giving the whole script to "sh -c" thus: + + execl("/bin/sh", "sh", "-c", script, "sh", logfn, NULL); + +This might change in future versions. + + -- Paul Martin Sat, 8 Apr 2006 22:07:07 +0100 --- logrotate-3.7.1.orig/debian/logrotate.copyright +++ logrotate-3.7.1/debian/logrotate.copyright @@ -0,0 +1,33 @@ +This package was originally debianized by Joseph Carter + on Thu, 22 Apr 1999 15:33:04 -0700. + +This version was downloaded from RedHat's server at: + +http://download.fedora.redhat.com/pub/fedora/linux/core/development/SRPMS/ + + +Upstream Authors are various RedHat people, including Erik Troan, +Preston Brown, Elliot Lee, Miloslav Trmac, Dan Walsh and Peter Vrabec. + +Copyright: GNU GENERAL PUBLIC LICENSE (GPL) Version 2 + +All modifications to the packaging and patches by Paul Martin + are also made available under the GPL: + + Copyright (C) 2001-2006 Paul Martin + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On a Debian system, the GPL can be found in /usr/share/common-licenses/GPL --- logrotate-3.7.1.orig/debian/logrotate.dirs +++ logrotate-3.7.1/debian/logrotate.dirs @@ -0,0 +1,5 @@ +usr/sbin +usr/share/man/man8 +usr/share/bug/logrotate +var/lib/logrotate +etc/logrotate.d --- logrotate-3.7.1.orig/debian/control +++ logrotate-3.7.1/debian/control @@ -0,0 +1,19 @@ +Source: logrotate +Section: admin +Priority: important +Maintainer: Ubuntu Core Developers +XSBC-Original-Maintainer: Paul Martin +Build-Depends: libpopt-dev, debhelper (>= 5), quilt, libselinux1-dev [!hurd-i386 !kfreebsd-i386 !kfreebsd-amd64] +Standards-Version: 3.6.2 + +Package: logrotate +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, cron | anacron | fcron, base-passwd (>= 2.0.3.4) +Recommends: mailx +Description: Log rotation utility + The logrotate utility is designed to simplify the administration of + log files on a system which generates a lot of log files. Logrotate + allows for the automatic rotation compression, removal and mailing of + log files. Logrotate can be set to handle a log file daily, weekly, + monthly or when the log file gets to a certain size. Normally, logrotate + runs as a daily cron job. --- logrotate-3.7.1.orig/debian/logrotate.preinst +++ logrotate-3.7.1/debian/logrotate.preinst @@ -0,0 +1,30 @@ +#!/bin/sh + +if [ "$1" = "upgrade" ]; then + + # Fix up the location of the state files that previous versions used. + + if [ -f /var/state/logrotate/status ]; then + if [ -f /var/lib/logrotate/status ]; then + rm /var/state/logrotate/status + else + mkdir -m 755 -p /var/lib/logrotate + mv /var/state/logrotate/status /var/lib/logrotate/status + fi + rm -rf /var/state/logrotate + fi + + if [ -f /var/lib/logrotate.status ]; then + if [ -f /var/lib/logrotate/status ]; then + rm /var/lib/logrotate.status + else + mkdir -m 755 -p /var/lib/logrotate + mv /var/lib/logrotate.status /var/lib/logrotate/status + fi + fi + +fi + +#DEBHELPER# + +exit 0 --- logrotate-3.7.1.orig/debian/logrotate.postrm +++ logrotate-3.7.1/debian/logrotate.postrm @@ -0,0 +1,11 @@ +#!/bin/sh + +if [ "$1" = "purge" ]; then + rm -rf /var/lib/logrotate +fi + +#DEBHELPER# + +exit 0 + + --- logrotate-3.7.1.orig/debian/patches/man-lastaction.patch +++ logrotate-3.7.1/debian/patches/man-lastaction.patch @@ -0,0 +1,16 @@ +Fix typo in the lastaction section of the manpage. It refers to itself +rather than to firstaction. + +Index: logrotate-3.7.1/logrotate.8 +=================================================================== +--- logrotate-3.7.1.orig/logrotate.8 2006-04-08 21:11:37.760424103 +0100 ++++ logrotate-3.7.1/logrotate.8 2006-04-08 21:13:28.917607025 +0100 +@@ -359,7 +359,7 @@ + must appear on lines by themselves) are executed once after all log + files that match the wildcarded pattern are rotated, after postrotate script + is run and only if at least one log is rotated. These directives may only +-appear inside a log file definition. See also \fBlastaction\fR. ++appear inside a log file definition. See also \fBfirstaction\fR. + + .TP + \fBrotate \fIcount\fR --- logrotate-3.7.1.orig/debian/patches/globfix-277652 +++ logrotate-3.7.1/debian/patches/globfix-277652 @@ -0,0 +1,51 @@ +Index: logrotate-3.7.1/config.c +=================================================================== +--- logrotate-3.7.1.orig/config.c 2008-10-08 15:57:39.318679248 +0100 ++++ logrotate-3.7.1/config.c 2008-10-08 16:09:33.203414313 +0100 +@@ -370,6 +370,7 @@ + int createMode; + struct stat sb, sb2; + glob_t globResult; ++ int glob_failed; + const char ** argv; + int argc, argNum; + +@@ -422,6 +423,7 @@ + + message(MESS_DEBUG, "reading config file %s\n", configFile); + ++ glob_failed = 0; + start = buf; + while (*start) { + while (isblank(*start) && (*start)) start++; +@@ -968,7 +970,8 @@ + + message(MESS_ERROR, "%s:%d glob failed for %s\n", + configFile, lineNum, argv[argNum]); +- return 1; ++ glob_failed = 1; ++ continue; + } + + newlog->files = realloc(newlog->files, sizeof(*newlog->files) * +@@ -1011,6 +1014,12 @@ + message(MESS_ERROR, "%s:%d unxpected }\n", configFile, lineNum); + return 1; + } ++ ++ if (glob_failed && !(newlog->flags & LOG_FLAG_MISSINGOK)) { ++ message(MESS_ERROR, "%s:%d glob failure without missingok\n", ++ configFile, lineNum); ++ return 1; ++ } + + if (newlog->oldDir) { + for (i = 0; i < newlog->numFiles; i++) { +@@ -1046,6 +1055,7 @@ + } + + newlog = defConfig; ++ glob_failed = 0; + + start++; + while (isblank(*start)) start++; --- logrotate-3.7.1.orig/debian/patches/man-rh-1.patch +++ logrotate-3.7.1/debian/patches/man-rh-1.patch @@ -0,0 +1,26 @@ +Fixes from upstream 3.7.1-4: + * Typo and missing information in man page (#139346) + +Index: logrotate-3.7.1/logrotate.8 +=================================================================== +--- logrotate-3.7.1.orig/logrotate.8 2006-04-08 21:16:19.525257240 +0100 ++++ logrotate-3.7.1/logrotate.8 2006-04-08 21:17:39.954145340 +0100 +@@ -126,7 +126,8 @@ + Each is rotated whenever it grows over 100k is size, and the old log + files are mailed (uncompressed) to www@my.org after going through 5 + rotations, rather then being removed. The \fBsharedscripts\fR means that +-the \fBpostrotate\fR script will only be run once, not once for each ++the \fBpostrotate\fR script will only be run once (after the old logs ++have been compressed), not once for each + log which is rotated. Note that log file names may be enclosed in + quotes (and that quotes are required if the name contains spaces). + Normal shell quoting rules apply, with \fB'\fR, \fB"\fR, and \fB\\\fR +@@ -384,7 +385,7 @@ + are only run once, no matter how many logs match the wildcarded pattern. + However, if none of the logs in the pattern require rotating, the scripts + will not be run at all. This option overrides the \fBnosharedscripts\fR +-option. ++option and implies \fBcreate\fR option. + + .TP + \fBstart \fIcount\fR --- logrotate-3.7.1.orig/debian/patches/man-189243.patch +++ logrotate-3.7.1/debian/patches/man-189243.patch @@ -0,0 +1,22 @@ +Fix location of killall in the examples. (Closes: #189243) + +--- /home/pm/deb/logrotate/logrotate-3.7/logrotate.8 2004-02-11 21:18:23.000000000 +0000 ++++ logrotate-3.7/logrotate.8 2004-02-11 21:18:54.000000000 +0000 +@@ -83,7 +83,7 @@ + rotate 5 + weekly + postrotate +- /sbin/killall -HUP syslogd ++ /usr/bin/killall -HUP syslogd + endscript + } + +@@ -93,7 +93,7 @@ + size=100k + sharedscripts + postrotate +- /sbin/killall -HUP httpd ++ /usr/bin/killall -HUP httpd + endscript + } + --- logrotate-3.7.1.orig/debian/patches/taboo-to-debug.patch +++ logrotate-3.7.1/debian/patches/taboo-to-debug.patch @@ -0,0 +1,15 @@ +Quietens the taboo list from ERROR to a DEBUG (Closes: #249073) + +Index: logrotate-3.7.1/config.c +=================================================================== +--- logrotate-3.7.1.orig/config.c 2006-04-08 20:48:47.169764580 +0100 ++++ logrotate-3.7.1/config.c 2006-04-08 20:49:55.460798704 +0100 +@@ -149,7 +149,7 @@ + for (i = 0; i < tabooCount; i++) { + if (!strcmp(fname + strlen(fname) - strlen(tabooExts[i]), + tabooExts[i])) { +- message(MESS_ERROR, "Ignoring %s, because of %s " ++ message(MESS_DEBUG, "Ignoring %s, because of %s " + "ending\n", fname, tabooExts[i]); + + return 0; --- logrotate-3.7.1.orig/debian/patches/datehack.patch +++ logrotate-3.7.1/debian/patches/datehack.patch @@ -0,0 +1,16 @@ +No longer consider state file dates before 1996 as fatal errors. +(Closes: #65534) + +Index: logrotate-3.7.1/logrotate.c +=================================================================== +--- logrotate-3.7.1.orig/logrotate.c 2006-04-08 20:46:40.217463729 +0100 ++++ logrotate-3.7.1/logrotate.c 2006-04-08 20:52:51.770419373 +0100 +@@ -1145,7 +1145,7 @@ + } + + /* Hack to hide earlier bug */ +- if ((year != 1900) && (year < 1996 || year > 2100)) { ++ if ((year != 1900) && (year < 1970 || year > 2100)) { + message(MESS_ERROR, "bad year %d for file %s in state file %s\n", + year, argv[0], stateFilename); + fclose(f); --- logrotate-3.7.1.orig/debian/patches/man-overriden.patch +++ logrotate-3.7.1/debian/patches/man-overriden.patch @@ -0,0 +1,16 @@ +Fix manpage typo (Closes: #310337) + + +Index: logrotate-3.7.1/logrotate.8 +=================================================================== +--- logrotate-3.7.1.orig/logrotate.8 2006-04-08 21:13:28.917607025 +0100 ++++ logrotate-3.7.1/logrotate.8 2006-04-08 21:14:56.187543069 +0100 +@@ -329,7 +329,7 @@ + and is assumed to be relative to the directory holding the log file + unless an absolute path name is specified. When this option is used all + old versions of the log end up in \fIdirectory\fR. This option may be +-overriden by the \fBnoolddir\fR option. ++overridden by the \fBnoolddir\fR option. + + .TP + \fBpostrotate\fR/\fBendscript\fR --- logrotate-3.7.1.orig/debian/patches/deb-taboos.patch +++ logrotate-3.7.1/debian/patches/deb-taboos.patch @@ -0,0 +1,17 @@ +Fix the taboo list to avoid .dpkg-old, etc. + + + +Index: logrotate-3.7.1/config.c +=================================================================== +--- logrotate-3.7.1.orig/config.c 2006-04-08 20:46:40.147476352 +0100 ++++ logrotate-3.7.1/config.c 2006-04-08 20:48:26.323326011 +0100 +@@ -30,6 +30,8 @@ + #endif + + static char * defTabooExts[] = { ".rpmsave", ".rpmorig", "~", ",v", ++ ".disabled", ".dpkg-old", ".dpkg-dist", ++ ".dpkg-new", + ".rpmnew", ".swp" }; + static int defTabooCount = sizeof(defTabooExts) / sizeof(char *); + --- logrotate-3.7.1.orig/debian/patches/rh-maxage.patch +++ logrotate-3.7.1/debian/patches/rh-maxage.patch @@ -0,0 +1,108 @@ +Enhance logrotate with "maxage". +From upstream RedHat patch. + +Index: logrotate-3.7.1/logrotate.c +=================================================================== +--- logrotate-3.7.1.orig/logrotate.c 2006-04-08 20:38:58.277761983 +0100 ++++ logrotate-3.7.1/logrotate.c 2006-04-08 20:38:58.314755223 +0100 +@@ -640,7 +640,10 @@ + * the date in their name */ + for (i = 0; i < globResult.gl_pathc; i++) { + if( !stat((globResult.gl_pathv)[i],&fst_buf) ) { +- if (i <= ((int)globResult.gl_pathc - rotateCount)) { ++ if ((i <= ((int)globResult.gl_pathc - rotateCount)) ++ || ((log->rotateAge > 0) ++ && (((nowSecs - fst_buf.st_mtime)/60/60/24) ++ > log->rotateAge))) { + if ( mail_out != -1 ) { + if (!hasErrors && log->logAddress) { + char * mailFilename = (globResult.gl_pathv)[mail_out]; +@@ -670,6 +673,22 @@ + globfree(&globResult); + free(glob_pattern); + } else { ++ if ( log->rotateAge ) { ++ struct stat fst_buf; ++ for (i=1; i <= rotateCount; i++) { ++ sprintf(oldName, "%s/%s.%d%s%s", dirName, baseName, ++ rotateCount + 1, fileext, compext); ++ if(!stat(oldName,&fst_buf) ++ && (((nowSecs - fst_buf.st_mtime)/60/60/24) ++ > log->rotateAge)) { ++ char * mailFilename = (globResult.gl_pathv)[i]; ++ if (!hasErrors && log->logAddress) ++ hasErrors = mailLogWrapper(mailFilename, mailCommand, logNum, log); ++ if (!hasErrors) ++ hasErrors = removeLogFile(mailFilename); ++ } ++ } ++ } + + sprintf(oldName, "%s/%s.%d%s%s", dirName, baseName, + logStart + rotateCount, fileext, compext); +@@ -1188,7 +1207,9 @@ + + int main(int argc, const char ** argv) { + logInfo defConfig = { NULL, NULL, 0, NULL, ROT_SIZE, +- /* threshHold */ 1024 * 1024, 0, ++ /* threshHold */ 1024 * 1024, ++ /* rotateCount */ 0, ++ /* rotateAge */ 0, + /* log start */ -1, + /* pre, post */ NULL, NULL, + /* first, last */ NULL, NULL, +Index: logrotate-3.7.1/logrotate.h +=================================================================== +--- logrotate-3.7.1.orig/logrotate.h 2006-04-08 20:38:58.274762531 +0100 ++++ logrotate-3.7.1/logrotate.h 2006-04-08 20:38:58.315755040 +0100 +@@ -35,6 +35,7 @@ + enum { ROT_DAYS, ROT_WEEKLY, ROT_MONTHLY, ROT_SIZE, ROT_FORCE } criterium; + unsigned int threshhold; + int rotateCount; ++ int rotateAge; + int logStart; + char * pre, * post, * first, * last; + char * logAddress; +Index: logrotate-3.7.1/config.c +=================================================================== +--- logrotate-3.7.1.orig/config.c 2006-04-08 20:38:58.279761617 +0100 ++++ logrotate-3.7.1/config.c 2006-04-08 20:38:58.317754675 +0100 +@@ -678,6 +678,21 @@ + } + *endtag = oldchar, start = endtag; + } ++ } else if (!strcmp(start, "maxage")) { ++ *endtag = oldchar, start = endtag; ++ ++ if (!isolateValue(configFile, lineNum, "maxage count", &start, ++ &endtag)) { ++ oldchar = *endtag, *endtag = '\0'; ++ ++ newlog->rotateAge = strtoul(start, &chptr, 0); ++ if (*chptr || newlog->rotateAge < 0) { ++ message(MESS_ERROR, "%s:%d bad maximum age '%s'\n", ++ configFile, lineNum, start); ++ return 1; ++ } ++ *endtag = oldchar, start = endtag; ++ } + } else if (!strcmp(start, "errors")) { + message(MESS_DEBUG, "%s: %d: the errors directive is deprecated and no longer used.\n", + configFile, lineNum); +Index: logrotate-3.7.1/logrotate.8 +=================================================================== +--- logrotate-3.7.1.orig/logrotate.8 2006-04-08 20:38:58.280761435 +0100 ++++ logrotate-3.7.1/logrotate.8 2006-04-08 20:38:58.318754492 +0100 +@@ -251,6 +251,12 @@ + instead of the just-rotated file (this is the default). + + .TP ++\fBmaxage\fR \fIcount\fR ++Remove rotated logs older than days. The age is only checked ++if the logfile is to be rotated. The files are mailed to the ++configured address if \fBmaillast\fR and \fBmail\fR are configured. ++ ++.TP + \fBmissingok\fR + If the log file is missing, go on to the next one without issuing an error + message. See also \fBnomissingok\fR. --- logrotate-3.7.1.orig/debian/patches/man-sizetypo.patch +++ logrotate-3.7.1/debian/patches/man-sizetypo.patch @@ -0,0 +1,13 @@ +Fix manpage typo in the size example. + +--- /home/pm/deb/logrotate/logrotate-3.7/logrotate.8 2004-09-13 22:50:08.000000000 +0100 ++++ logrotate-3.7/logrotate.8 2004-09-13 22:50:25.000000000 +0100 +@@ -90,7 +90,7 @@ + "/var/log/httpd/access.log" /var/log/httpd/error.log { + rotate 5 + mail www@my.org +- size=100k ++ size 100k + sharedscripts + postrotate + /usr/bin/killall -HUP httpd --- logrotate-3.7.1.orig/debian/patches/man-startcount.patch +++ logrotate-3.7.1/debian/patches/man-startcount.patch @@ -0,0 +1,16 @@ +Inconsistency in manpage logrotate(8), start directive +(Closes: #290628) + +Index: logrotate-3.7.1/logrotate.8 +=================================================================== +--- logrotate-3.7.1.orig/logrotate.8 2006-04-08 21:09:24.530501346 +0100 ++++ logrotate-3.7.1/logrotate.8 2006-04-08 21:11:37.760424103 +0100 +@@ -392,7 +392,7 @@ + you specify 0, the logs will be created with a .0 extension as they are + rotated from the original log files. If you specify 9, log files will + be created with a .9, skipping 0-8. Files will still be rotated the +-number of times specified with the \fBcount\fR directive. ++number of times specified with the \fBrotate\fR directive. + + .TP + \fBtabooext\fR [+] \fIlist\fR --- logrotate-3.7.1.orig/debian/patches/cpp-crossbuild.patch +++ logrotate-3.7.1/debian/patches/cpp-crossbuild.patch @@ -0,0 +1,21 @@ +Closes: #284040 +Patch from: NIIBE Yutaka + +Cross-building logrotate with dpkg-cross, I encountered a problem. +dpkg-cross sets CPP variable, and compilation failures, because +the executable 'cpp' does not accept multiple input files. + + +Index: logrotate-3.7.1/Makefile +=================================================================== +--- logrotate-3.7.1.orig/Makefile 2003-10-09 21:05:07.000000000 +0100 ++++ logrotate-3.7.1/Makefile 2006-04-08 21:21:31.333853922 +0100 +@@ -88,7 +88,7 @@ + rm -f $(OBJS) $(PROG) core* .depend + + depend: +- $(CPP) $(CFLAGS) -M $(SOURCES) > .depend ++ $(CC) -E $(CFLAGS) -M $(SOURCES) > .depend + + .PHONY : test + test: $(TARGET) --- logrotate-3.7.1.orig/debian/patches/scripterrors.patch +++ logrotate-3.7.1/debian/patches/scripterrors.patch @@ -0,0 +1,28 @@ +Give error messages identifying log file on script errors +(Closes: #122691, #195790, #222050, #306020) + +Index: logrotate-3.7.1/logrotate.c +=================================================================== +--- logrotate-3.7.1.orig/logrotate.c 2006-04-08 21:03:38.961646055 +0100 ++++ logrotate-3.7.1/logrotate.c 2006-04-08 21:05:20.850933782 +0100 +@@ -770,8 +770,8 @@ + if (log->pre && !(log->flags & LOG_FLAG_SHAREDSCRIPTS)) { + message(MESS_DEBUG, "running prerotate script\n"); + if (runScript(log->files[logNum], log->pre)) { +- message(MESS_ERROR, "error running prerotate script, " +- "leaving old log in place\n"); ++ message(MESS_ERROR, "error running prerotate script for %s, " ++ "leaving old log in place\n", log->files[logNum]); + hasErrors = 1; + } + } +@@ -853,7 +853,8 @@ + !(log->flags & LOG_FLAG_SHAREDSCRIPTS)) { + message(MESS_DEBUG, "running postrotate script\n"); + if (runScript(log->files[logNum], log->post)) { +- message(MESS_ERROR, "error running postrotate script\n"); ++ message(MESS_ERROR, "error running postrotate script for %s\n", ++ log->files[logNum]); + hasErrors = 1; + } + } --- logrotate-3.7.1.orig/debian/patches/man-mailtypo.patch +++ logrotate-3.7.1/debian/patches/man-mailtypo.patch @@ -0,0 +1,16 @@ +Fix the markup on the "mail" part of the manpage (Closes: #300644) + + +Index: logrotate-3.7.1/logrotate.8 +=================================================================== +--- logrotate-3.7.1.orig/logrotate.8 2006-04-08 21:14:56.187543069 +0100 ++++ logrotate-3.7.1/logrotate.8 2006-04-08 21:16:19.525257240 +0100 +@@ -45,7 +45,7 @@ + correctly. + + .TP +-\fB-m\R, \B-\-mail \fR ++\fB-m\fR, \fB-\-mail \fR + Tells \fBlogrotate\fR which command to use when mailing logs. This + command should accept two arguments: 1) the subject of the message, and + 2) the recipient. The command must then read a message on standard input --- logrotate-3.7.1.orig/debian/patches/manpage.patch +++ logrotate-3.7.1/debian/patches/manpage.patch @@ -0,0 +1,399 @@ +Closes: #101272, #335060 +Patches from: J S Bygott + +General fixes to manpages. + + +Index: logrotate-3.7.1/logrotate.8 +=================================================================== +--- logrotate-3.7.1.orig/logrotate.8 2006-04-08 21:43:29.280038309 +0100 ++++ logrotate-3.7.1/logrotate.8 2006-04-08 21:45:53.721194620 +0100 +@@ -3,7 +3,8 @@ + .SH NAME + logrotate \- rotates, compresses, and mails system logs + .SH SYNOPSIS +-\fBlogrotate\fR [-dv] [-f|--force] [-s|--state \fIfile\fR] \fIconfig_file\fR+ ++\fBlogrotate\fR [\fB\-dv\fR] [\fB\-f\fR|\fB\-\-force\fR] ++[\fB\-s\fR|\fB-\-state\ \fIstatefile\fR] \fIconfig_file\fR .. + .SH DESCRIPTION + \fBlogrotate\fR is designed to ease administration of systems that generate + large numbers of log files. It allows automatic rotation, compression, +@@ -11,16 +12,16 @@ + weekly, monthly, or when it grows too large. + .P + Normally, \fBlogrotate\fR is run as a daily cron job. It will not modify +-a log multiple times in one day unless the criterium for that log is +-based on the log's size and \fBlogrotate\fR is being run multiple times +-each day, or unless the \fB-f\fR or \fB-force\fR option is used. ++a log more than once in one day unless the criterion for that log is ++based on the log's size and \fBlogrotate\fR is being run more than once ++each day, or unless the \fB-f\fR or \fB-\-force\fR option is used. + .P + Any number of config files may be given on the command line. Later config + files may override the options given in earlier files, so the order +-in which the \fBlogrotate\fR config files are listed in is important. ++in which the \fBlogrotate\fR config files are listed is important. + Normally, a single config file which includes any other config files + which are needed should be used. See below for more information on how +-to use the \fIinclude\fR directive to accomplish this. If a directory ++to use the \fBinclude\fR directive to accomplish this. If a directory + is given on the command line, every file in that directory is used as + a config file. + .P +@@ -36,37 +37,42 @@ + be made to the logs or to the \fBlogrotate\fR state file. + + .TP +-\fB-f, -\-force\fR ++\fB-f\fR, \fB-\-force\fR + Tells \fBlogrotate\fR to force the rotation, even if it doesn't think + this is necessary. Sometimes this is useful after adding new entries to +-\fBlogrotate\fR, or if old log files have been removed by hand, as the +-new files will be created, and logging will continue correctly. ++a \fBlogrotate\fR config file, or if old log files have been removed ++by hand, as the new files will be created, and logging will continue ++correctly. + + .TP +-\fB-m, -\-mail \fR ++\fB-m\R, \B-\-mail \fR + Tells \fBlogrotate\fR which command to use when mailing logs. This + command should accept two arguments: 1) the subject of the message, and + 2) the recipient. The command must then read a message on standard input +-and mail it to the recipient. The default mail command is \fB/bin/mail ++and mail it to the recipient. The default mail command is \fB/usr/bin/mail + -s\fR. + + .TP +-\fB-s, -\-state \fR ++\fB-s\fR, \fB-\-state \fR + Tells \fBlogrotate\fR to use an alternate state file. This is useful +-if logrotate is being run as a different user for various sets of ++if \fBlogrotate\fR is being run as a different user for various sets of + log files. The default state file is \fI/var/lib/logrotate/status\fR. + + .TP + \fB-\-usage\fR + Prints a short usage message. + ++.TP ++\fB-v\fR, \fB--verbose\fR ++Display messages during rotation. ++ + .SH CONFIGURATION FILE + + \fBlogrotate\fR reads everything about the log files it should be handling + from the series of configuration files specified on the command line. Each + configuration file can set global options (local definitions override + global ones, and later definitions override earlier ones) and specify +-a logfile to rotate. A simple configuration file looks like this: ++some logfiles to rotate. A simple configuration file looks like this: + + .nf + .ta +3i +@@ -77,7 +83,7 @@ + rotate 5 + weekly + postrotate +- /sbin/killall -HUP syslogd ++ /sbin/killall -HUP syslogd + endscript + } + +@@ -87,7 +93,7 @@ + size=100k + sharedscripts + postrotate +- /sbin/killall -HUP httpd ++ /sbin/killall -HUP httpd + endscript + } + +@@ -97,7 +103,7 @@ + olddir /var/log/news/old + missingok + postrotate +- kill -HUP `cat /var/run/inn.pid` ++ kill -HUP `cat /var/run/inn.pid` + endscript + nocompress + } +@@ -107,9 +113,9 @@ + The first few lines set global options; in the example, logs are + compressed after they are rotated. Note that comments may appear + anywhere in the config file as long as the first non-whitespace +-character on the line is a #. ++character on the line is a \fB#\fR. + +-The next section of the config files defined how to handle the log file ++The next section of the config file defines how to handle the log file + \fI/var/log/messages\fR. The log will go through five weekly rotations before + being removed. After the log file has been rotated (but before the old + version of the log has been compressed), the command +@@ -117,13 +123,13 @@ + + The next section defines the parameters for both + \fI/var/log/httpd/access.log\fR and \fI/var/log/httpd/error.log\fR. +-They are rotated whenever is grows over 100k is size, and the old logs ++Each is rotated whenever it grows over 100k in size, and the old log + files are mailed (uncompressed) to www@my.org after going through 5 + rotations, rather then being removed. The \fBsharedscripts\fR means that + the \fBpostrotate\fR script will only be run once, not once for each +-log which is rotated. Note that the double quotes around the first filename +-at the beginning of this section allows logrotate to rotate logs with +-spaces in the name. Normal shell quoting rules apply, with ', ", and \\ ++log which is rotated. Note that log file names may be enclosed in ++quotes (and that quotes are required if the name contains spaces). ++Normal shell quoting rules apply, with \fB'\fR, \fB"\fR, and \fB\\\fR + characters supported. + + The last section defines the parameters for all of the files in +@@ -135,29 +141,33 @@ + rotate all files, including previously rotated ones. A way around this + is to use the \fBolddir\fR directive or a more exact wildcard (such as *.log). + ++If the directory \fI/var/log/news\fR does not exist, this will cause ++\fBlogrotate\fR to report an error. This error cannot be stopped with ++the \fBmissingok\fR directive. ++ + Here is more information on the directives which may be included in + a \fBlogrotate\fR configuration file: + + .TP + \fBcompress\fR +-Old versions of log files are compressed with \fBgzip\fR by default. See also +-\fBnocompress\fR. ++Old versions of log files are compressed with \fBgzip\fR(1) by default. ++See also \fBnocompress\fR. + + .TP + \fBcompresscmd\fR + Specifies which command to use to compress log files. The default is +-\fBgzip\fR. See also \fBcompress\fR. ++\fBgzip\fR(1). See also \fBcompress\fR. + + .TP + \fBuncompresscmd\fR + Specifies which command to use to uncompress log files. The default is +-\fBgunzip\fR. ++\fBgunzip\fR(1). + + .TP + \fBcompressext\fR + Specifies which extension to use on compressed logfiles, if compression +-is enabled. The default follows that of the configured compression +-command. ++is enabled. The default follows that of the default compression ++command (.gz). + + .TP + \fBcompressoptions\fR +@@ -174,9 +184,9 @@ + + .TP + \fBcopytruncate\fR +-Truncate the original log file in place after creating a copy, +-instead of moving the old log file and optionally creating a new one, +-It can be used when some program can not be told to close its logfile ++Truncate the original log file to zero size in place after creating a copy, ++instead of moving the old log file and optionally creating a new one. ++It can be used when some program cannot be told to close its logfile + and thus might continue writing (appending) to the previous log file forever. + Note that there is a very small time slice between copying the file and + truncating it, so some logging data might be lost. +@@ -188,7 +198,7 @@ + Immediately after rotation (before the \fBpostrotate\fR script is run) + the log file is created (with the same name as the log file just rotated). + \fImode\fR specifies the mode for the log file in octal (the same +-as \fBchmod(2)\fR), \fIowner\fR specifies the user name who will own the ++as \fBchmod\fR(2)), \fIowner\fR specifies the user name who will own the + log file, and \fIgroup\fR specifies the group the log file will belong + to. Any of the log file attributes may be omitted, in which case those + attributes for the new file will use the same values as the original log +@@ -207,20 +217,20 @@ + .TP + \fBdelaycompress\fR + Postpone compression of the previous log file to the next rotation cycle. +-This has only effect when used in combination with \fBcompress\fR. +-It can be used when some program can not be told to close its logfile ++This only has effect when used in combination with \fBcompress\fR. ++It can be used when some program cannot be told to close its logfile + and thus might continue writing to the previous log file for some time. + + .TP + \fBextension \fIext\fR + Log files are given the final extension \fIext\fR after rotation. If +-compression is used, the compression extension (normally \fB.gz\fR) ++compression is used, the compression extension (normally \fI.gz\fR) + appears after \fIext\fR. + + .TP + \fBifempty\fR +-Rotate the log file even if it is empty, overiding the \fBnotifempty\fR +-option (ifempty is the default). ++Rotate the log file even if it is empty, overriding the \fBnotifempty\fR ++option (\fBifempty\fR is the default). + + .TP + \fBinclude \fIfile_or_directory\fR +@@ -231,12 +241,12 @@ + which are ignored are files which are not regular files (such as + directories and named pipes) and files whose names end with one of + the taboo extensions, as specified by the \fBtabooext\fR directive. +-The \fBinclude\fR directive may not appear inside of a log file ++The \fBinclude\fR directive may not appear inside a log file + definition. + + .TP + \fBmail \fIaddress\fR +-When a log is rotated out-of-existence, it is mailed to \fIaddress\fR. If ++When a log is rotated out of existence, it is mailed to \fIaddress\fR. If + no mail should be generated by a particular log, the \fBnomail\fR directive + may be used. + +@@ -268,8 +278,7 @@ + + .TP + \fBnocompress\fR +-Old versions of log files are not compressed with \fBgzip\fR. See also +-\fBcompress\fR. ++Old versions of log files are not compressed. See also \fBcompress\fR. + + .TP + \fBnocopy\fR +@@ -292,7 +301,7 @@ + + .TP + \fBnomail\fR +-Don't mail old log files to any address. ++Do not mail old log files to any address. + + .TP + \fBnomissingok\fR +@@ -300,12 +309,12 @@ + + .TP + \fBnoolddir\fR +-Logs are rotated in the same directory the log normally resides in (this ++Logs are rotated in the directory they normally reside in (this + overrides the \fBolddir\fR option). + + .TP + \fBnosharedscripts\fR +-Run \fBprerotate\fR and \fBpostrotate\fR scripts for every script which ++Run \fBprerotate\fR and \fBpostrotate\fR scripts for every log which + is rotated (this is the default, and overrides the \fBsharedscripts\fR + option). + +@@ -326,16 +335,15 @@ + \fBpostrotate\fR/\fBendscript\fR + The lines between \fBpostrotate\fR and \fBendscript\fR (both of which + must appear on lines by themselves) are executed after the log file is +-rotated. These directives may only appear inside of a log file definition. +-See \fBprerotate\fR as well. ++rotated. These directives may only appear inside a log file definition. ++See also \fBprerotate\fR. + + .TP + \fBprerotate\fR/\fBendscript\fR + The lines between \fBprerotate\fR and \fBendscript\fR (both of which + must appear on lines by themselves) are executed before the log file is + rotated and only if the log will actually be rotated. These directives +-may only appear inside of a log file definition. See \fBpostrotate\fR +-as well. ++may only appear inside a log file definition. See also \fBpostrotate\fR. + + .TP + \fBfirstaction\fR/\fBendscript\fR +@@ -351,33 +359,34 @@ + must appear on lines by themselves) are executed once after all log + files that match the wildcarded pattern are rotated, after postrotate script + is run and only if at least one log is rotated. These directives may only +-appear inside of a log file definition. See \fBlastaction\fR as well. ++appear inside a log file definition. See also \fBlastaction\fR. + + .TP + \fBrotate \fIcount\fR +-Log files are rotated times before being removed or mailed to the ++Log files are rotated \fIcount\fR times before being removed or mailed to the + address specified in a \fBmail\fR directive. If \fIcount\fR is 0, old versions + are removed rather then rotated. + + .TP +-\fBsize \fIsize\fR +-Log files are rotated when they grow bigger then \fIsize\fR bytes. If +-\fIsize\fR is followed by \fIM\fR, the size if assumed to be in megabytes. +-If the \fIk\fR is used, the size is in kilobytes. So \fBsize 100\fR, +-\fIsize 100k\fR, and \fIsize 100M\fR are all valid. +- +-.TP + \fBsharedscripts\fR +-Normally, \fBprescript\fR and \fBpostscript\fR scripts are run for each ++Normally, \fBprerotate\fR and \fBpostrotate\fR scripts are run for each + log which is rotated, meaning that a single script may be run multiple + times for log file entries which match multiple files (such as the +-/var/log/news/* example). If \fBsharedscript\fR is specified, the scripts ++\fI/var/log/news/*\fR example). If \fBsharedscripts\fR is specified, the scripts + are only run once, no matter how many logs match the wildcarded pattern. + However, if none of the logs in the pattern require rotating, the scripts +-will not be run at all. This option overrides the \fbnosharedscripts\fR ++will not be run at all. This option overrides the \fBnosharedscripts\fR + option. + + .TP ++\fBsize \fIsize\fR[\fBG\fR|\fBM\fR|\fBk\fR] ++Log files are rotated when they grow bigger then \fIsize\fR bytes. If ++\fIsize\fR is followed by \fIM\fR, the size if assumed to be in megabytes. ++If the \fIG\fR suffix is used, the size is in gigabytes. ++If the \fIk\fR suffix is used, the size is in kilobytes. So \fBsize 100\fR, ++\fIsize 100k\fR, \fIsize 100M\fR and \fIsize 1G\fR are all valid. ++ ++.TP + \fBstart \fIcount\fR + This is the number to use as the base for rotation. For example, if + you specify 0, the logs will be created with a .0 extension as they are +@@ -388,18 +397,21 @@ + .TP + \fBtabooext\fR [+] \fIlist\fR + The current taboo extension list is changed (see the \fBinclude\fR directive +-for information on the taboo extensions). If a + precedes the list of +-extensions, the current taboo extension list is augmented, otherwise it ++for information on the taboo extensions). If a \fB+\fR precedes \fIlist\fR, ++the current taboo extension list is augmented by \fIlist\fR, otherwise it + is replaced. At startup, the taboo extension list +-contains .rpmorig, .rpmsave, ,v, .swp, .rpmnew, and ~. ++contains .rpmorig, .rpmsave, .dpkg-dist, .dpkg-old, .dpkg-new, .disabled, ++,v, .swp, .rpmnew, and ~. The members of the list are separated by spaces, ++not commas. ++ + + .TP + \fBweekly\fR + Log files are rotated if the current weekday is less then the weekday + of the last rotation or if more then a week has passed since the last + rotation. This is normally the same as rotating logs on the first day +-of the week, but it works better if \fIlogrotate\fR is not run every +-night. ++of the week, but if \fBlogrotate\fR is not being run every night a log ++rotation will happen at the first valid opportunity. + + .SH FILES + .PD 0 +@@ -411,11 +423,16 @@ + Configuration options. + + .SH SEE ALSO +-.IR gzip (1) ++.BR gzip (1) ++ ++.SH NOTES ++The \fBkillall\fR(1) program in Debian is found in the \fIpsmisc\fR package. + + .SH AUTHORS + .nf + Erik Troan + .nf + Preston Brown ++.nf ++Corrections and changes for Debian by Paul Martin + .fi --- logrotate-3.7.1.orig/debian/patches/deb-config-h.patch +++ logrotate-3.7.1/debian/patches/deb-config-h.patch @@ -0,0 +1,24 @@ +Fix locations of STATEFILE and DEFAULT_MAIL_COMMAND for Debian. + + +Index: logrotate-3.7.1/config.h +=================================================================== +--- logrotate-3.7.1.orig/config.h 2006-04-08 20:26:13.052651364 +0100 ++++ logrotate-3.7.1/config.h 2006-04-08 20:51:24.180005096 +0100 +@@ -20,7 +20,7 @@ + * Default settings for Linux - leave these last. + */ + #ifndef DEFAULT_MAIL_COMMAND +- #define DEFAULT_MAIL_COMMAND "/bin/mail" ++ #define DEFAULT_MAIL_COMMAND "/usr/bin/mail" + #endif + + #ifndef COMPRESS_COMMAND +@@ -36,6 +36,6 @@ + #endif + + #ifndef STATEFILE +- #define STATEFILE "/var/lib/logrotate.status" ++ #define STATEFILE "/var/lib/logrotate/status" + #endif + --- logrotate-3.7.1.orig/debian/patches/compressutime.patch +++ logrotate-3.7.1/debian/patches/compressutime.patch @@ -0,0 +1,34 @@ +Preserve mtime/atime on compression. (Closes: #286957) + +--- ./logrotate.c 2005-09-03 14:07:42.000000000 +0100 ++++ /tmp/dpep-work.m2M7hf/logrotate-3.7.1/logrotate.c 2005-09-03 14:08:14.000000000 +0100 +@@ -12,6 +12,8 @@ + #include + #include + #include ++#include ++#include + + #ifdef WITH_SELINUX + #include +@@ -120,6 +122,7 @@ + static int compressLogFile(char * name, logInfo * log, struct stat *sb) { + char * compressedName; + const char ** fullCommand; ++ struct utimbuf utim; + int inFile; + int outFile; + int i; +@@ -190,6 +193,12 @@ + message(MESS_ERROR, "failed to compress log %s\n", name); + return 1; + } ++ ++ utim.actime = sb->st_atime; ++ utim.modtime = sb->st_mtime; ++ utime(compressedName,&utim); ++ /* If we can't change atime/mtime, it's not a disaster. ++ It might possibly fail under SELinux. */ + + unlink(name); + --- logrotate-3.7.1.orig/debian/patches/rh-noTMPDIR.patch +++ logrotate-3.7.1/debian/patches/rh-noTMPDIR.patch @@ -0,0 +1,58 @@ +Do not use tmpfile to run script anymore (Closes: #149270) +From RedHat patches. + +Index: logrotate-3.7.1/logrotate.c +=================================================================== +--- logrotate-3.7.1.orig/logrotate.c 2006-04-08 20:38:58.314755223 +0100 ++++ logrotate-3.7.1/logrotate.c 2006-04-08 20:42:11.628324134 +0100 +@@ -88,10 +88,7 @@ + } + + static int runScript(char * logfn, char * script) { +- int fd; +- char *filespec; + int rc; +- char buf[256]; + + if (debug) { + message(MESS_DEBUG, "running script with arg %s: \"%s\"\n", +@@ -99,38 +96,12 @@ + return 0; + } + +- filespec = buf; +- snprintf(buf, sizeof(buf), "%s/logrotate.XXXXXX", getenv("TMPDIR") ?: "/tmp"); +- fd = -1; +- if (!filespec || (fd = mkstemp(filespec)) < 0 || fchmod(fd, 0700)) { +- message(MESS_DEBUG, "error creating %s: %s\n", filespec, +- strerror(errno)); +- if (fd >= 0) { +- close(fd); +- unlink(filespec); +- } +- return -1; +- } +- +- if (write(fd, "#!/bin/sh\n\n", 11) != 11 || +- write(fd, script, strlen(script)) != strlen(script)) { +- message(MESS_DEBUG, "error writing %s\n", filespec); +- close(fd); +- unlink(filespec); +- return -1; +- } +- +- close(fd); +- + if (!fork()) { +- execlp(filespec, filespec, logfn, NULL); ++ execl("/bin/sh", "sh", "-c", script, NULL); + exit(1); + } + + wait(&rc); +- +- unlink(filespec); +- + return rc; + } + --- logrotate-3.7.1.orig/debian/patches/uncompressChild-warning.patch +++ logrotate-3.7.1/debian/patches/uncompressChild-warning.patch @@ -0,0 +1,13 @@ +Index: logrotate-3.7.1/logrotate.c +=================================================================== +--- logrotate-3.7.1.orig/logrotate.c 2006-04-08 22:58:51.000000000 +0100 ++++ logrotate-3.7.1/logrotate.c 2006-04-08 23:01:00.459602124 +0100 +@@ -209,7 +209,7 @@ + static int mailLog(char * logFile, char * mailCommand, char * uncompressCommand, + char * address, char * subject) { + int mailInput; +- pid_t mailChild, uncompressChild; ++ pid_t mailChild, uncompressChild=-1; + int mailStatus, uncompressStatus; + int uncompressPipe[2]; + char * mailArgv[] = { mailCommand, "-s", subject, address, NULL }; --- logrotate-3.7.1.orig/debian/patches/script-argument.patch +++ logrotate-3.7.1/debian/patches/script-argument.patch @@ -0,0 +1,18 @@ +Closes: #330783 + +Allow the use of $1 in scripts. + + +Index: logrotate-3.7.1/logrotate.c +=================================================================== +--- logrotate-3.7.1.orig/logrotate.c 2006-04-08 21:47:41.000000000 +0100 ++++ logrotate-3.7.1/logrotate.c 2006-04-08 22:01:23.722498089 +0100 +@@ -101,7 +101,7 @@ + } + + if (!fork()) { +- execl("/bin/sh", "sh", "-c", script, NULL); ++ execl("/bin/sh", "sh", "-c", script, "sh", logfn, NULL); + exit(1); + } + --- logrotate-3.7.1.orig/debian/patches/rh-selinux.patch +++ logrotate-3.7.1/debian/patches/rh-selinux.patch @@ -0,0 +1,173 @@ +Add selinux_getenforce() calls to work when not in enforcing mode +- use security_getenforce() instead of selinux_getenforcemode +From RedHat patches. + +Index: logrotate-3.7.1/logrotate.c +=================================================================== +--- logrotate-3.7.1.orig/logrotate.c 2006-04-08 20:42:37.114533654 +0100 ++++ logrotate-3.7.1/logrotate.c 2006-04-08 20:44:17.311634566 +0100 +@@ -17,6 +17,7 @@ + #include + static security_context_t prev_context=NULL; + int selinux_enabled=0; ++int selinux_enforce=0; + #endif + + #include "basenames.h" +@@ -293,38 +294,43 @@ + return 1; + } + #ifdef WITH_SELINUX +- if ((selinux_enabled=(is_selinux_enabled()>0))) +- { +- security_context_t oldContext; +- if (fgetfilecon(fdcurr, &oldContext) >=0) { +- if (getfscreatecon(&prev_context) < 0) { +- message(MESS_ERROR, "error getting default context: %s\n", +- strerror(errno)); +- freecon(oldContext); +- return 1; +- } +- if (setfscreatecon(oldContext) < 0) { +- message(MESS_ERROR, "error setting file context %s to %s: %s\n", +- saveLog, oldContext,strerror(errno)); +- freecon(oldContext); +- return 1; +- } +- freecon(oldContext); +- } else { +- message(MESS_ERROR, "error getting file context %s: %s\n", currLog, +- strerror(errno)); +- return 1; +- } +- } ++ if (selinux_enabled) { ++ security_context_t oldContext; ++ if (fgetfilecon(fdcurr, &oldContext) >=0) { ++ if (getfscreatecon(&prev_context) < 0) { ++ message(MESS_ERROR, "error getting default context: %s\n", ++ strerror(errno)); ++ if (selinux_enforce) { ++ freecon(oldContext); ++ return 1; ++ } ++ } ++ if (setfscreatecon(oldContext) < 0) { ++ message(MESS_ERROR, "error setting file context %s to %s: %s\n", ++ saveLog, oldContext,strerror(errno)); ++ if (selinux_enforce) { ++ freecon(oldContext); ++ return 1; ++ } ++ } ++ freecon(oldContext); ++ } else { ++ message(MESS_ERROR, "error getting file context %s: %s\n", currLog, ++ strerror(errno)); ++ if (selinux_enforce) { ++ return 1; ++ } ++ } ++ } + #endif + fdsave = open(saveLog, O_WRONLY | O_CREAT | O_TRUNC,sb->st_mode); + #ifdef WITH_SELINUX + if (selinux_enabled) { +- setfscreatecon(prev_context); +- if (prev_context!= NULL) { +- freecon(prev_context); +- prev_context=NULL; +- } ++ setfscreatecon(prev_context); ++ if (prev_context!= NULL) { ++ freecon(prev_context); ++ prev_context=NULL; ++ } + } + #endif + if (fdsave < 0) { +@@ -672,28 +678,34 @@ + (log->flags & LOG_FLAG_DELAYCOMPRESS) ? "" : compext); + + #ifdef WITH_SELINUX +- if ((selinux_enabled=(is_selinux_enabled()>0))) { +- security_context_t oldContext=NULL; +- if (getfilecon(log->files[logNum], &oldContext)>0) { +- if (getfscreatecon(&prev_context) < 0) { +- message(MESS_ERROR, "error getting default context: %s\n", +- strerror(errno)); +- freecon(oldContext); +- return 1; +- } +- if (setfscreatecon(oldContext) < 0) { +- message(MESS_ERROR, "error setting file context %s to %s: %s\n", +- log->files[logNum], oldContext,strerror(errno)); +- freecon(oldContext); +- return 1; +- } +- freecon(oldContext); +- } else { +- message(MESS_ERROR, "error getting file context %s: %s\n", +- log->files[logNum], +- strerror(errno)); +- return 1; +- } ++ if (selinux_enabled) { ++ security_context_t oldContext=NULL; ++ if (getfilecon(log->files[logNum], &oldContext)>0) { ++ if (getfscreatecon(&prev_context) < 0) { ++ message(MESS_ERROR, "error getting default context: %s\n", ++ strerror(errno)); ++ if (selinux_enforce) { ++ freecon(oldContext); ++ return 1; ++ } ++ } ++ if (setfscreatecon(oldContext) < 0) { ++ message(MESS_ERROR, "error setting file context %s to %s: %s\n", ++ log->files[logNum], oldContext,strerror(errno)); ++ if (selinux_enforce) { ++ freecon(oldContext); ++ return 1; ++ } ++ } ++ freecon(oldContext); ++ } else { ++ message(MESS_ERROR, "error getting file context %s: %s\n", ++ log->files[logNum], ++ strerror(errno)); ++ if (selinux_enforce) { ++ return 1; ++ } ++ } + } + #endif + for (i = rotateCount + logStart - 1; (i >= 0) && !hasErrors; i--) { +@@ -883,11 +895,11 @@ + + #ifdef WITH_SELINUX + if (selinux_enabled) { +- setfscreatecon(prev_context); +- if (prev_context!= NULL) { +- freecon(prev_context); +- prev_context=NULL; +- } ++ setfscreatecon(prev_context); ++ if (prev_context!= NULL) { ++ freecon(prev_context); ++ prev_context=NULL; ++ } + } + #endif + free(dirName); +@@ -1249,6 +1261,10 @@ + exit(1); + } + ++#ifdef WITH_SELINUX ++ selinux_enabled=(is_selinux_enabled()>0); ++ selinux_enforce=security_getenforce(); ++#endif + for (file = files; *file; file++) { + if (readConfigPath(*file, &defConfig, &logs, &numLogs)) { + exit(1); --- logrotate-3.7.1.orig/debian/patches/dst.patch +++ logrotate-3.7.1/debian/patches/dst.patch @@ -0,0 +1,32 @@ +Closes: #278591 +Patch from: Holger Weiss + +If you call logrotate once a week between 00:00 and 01:00 AM and +daylight saving time is in effect, "weekly" rotations will be done only +once in two weeks. E.g., the following crontab won't work as expected: + +12 0 * * 1 /usr/sbin/logrotate + +logrotate uses the tm struct "lastRotated" in order to find out whether +a logfile needs rotating. "lastRotated" is filled by first setting +everything to zero, then setting the mday, month and year of the last +rotation and then calling mktime(3) in order to normalize the rest of +the struct. The problem is that if daylight saving time is in effect, +mktime() will increment "lastRotated.tm_isdst" from 0 to 1 and push +"lastRotated" by one hour. Hence, the current time will be compared +with the day of the last rotation, 01:00 AM. This can be solved by +setting lastRotated.tm_isdst correctly prior to the mktime() call. + + +Index: logrotate-3.7.1/logrotate.c +=================================================================== +--- logrotate-3.7.1.orig/logrotate.c 2006-04-08 21:36:03.268110593 +0100 ++++ logrotate-3.7.1/logrotate.c 2006-04-08 21:36:11.342764986 +0100 +@@ -78,6 +78,7 @@ + states[i].lastRotated.tm_mon = now.tm_mon; + states[i].lastRotated.tm_mday = now.tm_mday; + states[i].lastRotated.tm_year = now.tm_year; ++ states[i].lastRotated.tm_isdst = now.tm_isdst; + + /* fill in the rest of the st->lastRotated fields */ + lr_time = mktime(&states[i].lastRotated); --- logrotate-3.7.1.orig/debian/patches/series +++ logrotate-3.7.1/debian/patches/series @@ -0,0 +1,25 @@ +rh-dateext.patch +rh-maxage.patch +rh-noTMPDIR.patch +rh-selinux.patch +deb-taboos.patch +configparse.patch +taboo-to-debug.patch +deb-config-h.patch +datehack.patch +compressutime.patch +scripterrors.patch +manpage.patch +man-189243.patch +man-sizetypo.patch +man-startcount.patch +man-lastaction.patch +man-overriden.patch +man-mailtypo.patch +man-rh-1.patch +cpp-crossbuild.patch +dst.patch +man-333996.patch +script-argument.patch +uncompressChild-warning.patch +globfix-277652 --- logrotate-3.7.1.orig/debian/patches/man-333996.patch +++ logrotate-3.7.1/debian/patches/man-333996.patch @@ -0,0 +1,58 @@ +Closes: #333996 +Patch from: Adrian Knoth + +The manpage contains several sentences with the same mistake: +the use of "then" instead of "than". + + +Index: logrotate-3.7.1/logrotate.8 +=================================================================== +--- logrotate-3.7.1.orig/logrotate.8 2006-04-08 21:47:40.000000000 +0100 ++++ logrotate-3.7.1/logrotate.8 2006-04-08 21:48:43.456864197 +0100 +@@ -125,7 +125,7 @@ + \fI/var/log/httpd/access.log\fR and \fI/var/log/httpd/error.log\fR. + Each is rotated whenever it grows over 100k in size, and the old log + files are mailed (uncompressed) to www@my.org after going through 5 +-rotations, rather then being removed. The \fBsharedscripts\fR means that ++rotations, rather than being removed. The \fBsharedscripts\fR means that + the \fBpostrotate\fR script will only be run once (after the old logs + have been compressed), not once for each + log which is rotated. Note that log file names may be enclosed in +@@ -135,7 +135,7 @@ + + The last section defines the parameters for all of the files in + \fI/var/log/news\fR. Each file is rotated on a monthly basis. This is +-considered a single rotation directive and if errors occur for more then ++considered a single rotation directive and if errors occur for more than + one file, the log files are not compressed. + + Please use wildcards with caution. If you specify *, \fBlogrotate\fR will +@@ -366,7 +366,7 @@ + \fBrotate \fIcount\fR + Log files are rotated \fIcount\fR times before being removed or mailed to the + address specified in a \fBmail\fR directive. If \fIcount\fR is 0, old versions +-are removed rather then rotated. ++are removed rather than rotated. + + .TP + \fBsharedscripts\fR +@@ -381,7 +381,7 @@ + + .TP + \fBsize \fIsize\fR[\fBG\fR|\fBM\fR|\fBk\fR] +-Log files are rotated when they grow bigger then \fIsize\fR bytes. If ++Log files are rotated when they grow bigger than \fIsize\fR bytes. If + \fIsize\fR is followed by \fIM\fR, the size if assumed to be in megabytes. + If the \fIG\fR suffix is used, the size is in gigabytes. + If the \fIk\fR suffix is used, the size is in kilobytes. So \fBsize 100\fR, +@@ -408,8 +408,8 @@ + + .TP + \fBweekly\fR +-Log files are rotated if the current weekday is less then the weekday +-of the last rotation or if more then a week has passed since the last ++Log files are rotated if the current weekday is less than the weekday ++of the last rotation or if more than a week has passed since the last + rotation. This is normally the same as rotating logs on the first day + of the week, but if \fBlogrotate\fR is not being run every night a log + rotation will happen at the first valid opportunity. --- logrotate-3.7.1.orig/debian/patches/rh-dateext.patch +++ logrotate-3.7.1/debian/patches/rh-dateext.patch @@ -0,0 +1,319 @@ +Enhance logrotate with "dateext". +From RedHat patches + +Index: logrotate-3.7.1/logrotate.h +=================================================================== +--- logrotate-3.7.1.orig/logrotate.h 2006-04-08 20:32:36.772133783 +0100 ++++ logrotate-3.7.1/logrotate.h 2006-04-08 20:36:00.250859767 +0100 +@@ -15,6 +15,7 @@ + #define LOG_FLAG_MAILFIRST (1 << 6) + #define LOG_FLAG_SHAREDSCRIPTS (1 << 7) + #define LOG_FLAG_COPY (1 << 8) ++#define LOG_FLAG_DATEEXT (1 << 9) + + #define NO_FORCE_ROTATE 0 + #define FORCE_ROTATE 1 +Index: logrotate-3.7.1/logrotate.c +=================================================================== +--- logrotate-3.7.1.orig/logrotate.c 2006-04-08 20:32:36.773133590 +0100 ++++ logrotate-3.7.1/logrotate.c 2006-04-08 20:36:00.254859022 +0100 +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + + #ifdef WITH_SELINUX + #include +@@ -22,6 +23,10 @@ + #include "log.h" + #include "logrotate.h" + ++#if !defined(GLOB_ABORTED) && defined(GLOB_ABEND) ++#define GLOB_ABORTED GLOB_ABEND ++#endif ++ + typedef struct { + char * fn; + struct tm lastRotated; /* only tm.mon, tm_mday, tm_year are good! */ +@@ -42,6 +47,14 @@ + char * mailCommand = DEFAULT_MAIL_COMMAND; + time_t nowSecs = 0; + ++static int globerr(const char * pathname, int theerr) { ++ message(MESS_ERROR, "error accessing %s: %s\n", pathname, ++ strerror(theerr)); ++ ++ /* We want the glob operation to continue, so return 0 */ ++ return 1; ++} ++ + static logState * findState(const char * fn, struct stateSet * sip) { + int i; + logState * states = sip->states; +@@ -121,6 +134,17 @@ + return rc; + } + ++static int removeLogFile(char * name) { ++ message(MESS_DEBUG, "removing old log %s\n", name); ++ ++ if (!debug && unlink(name)) { ++ message(MESS_ERROR, "Failed to remove old log %s: %s\n", ++ name, strerror(errno)); ++ return 1; ++ } ++ return 0; ++} ++ + static int compressLogFile(char * name, logInfo * log, struct stat *sb) { + char * compressedName; + const char ** fullCommand; +@@ -265,6 +289,25 @@ + return rc; + } + ++static int mailLogWrapper (char * mailFilename, char * mailCommand, int logNum, logInfo * log) { ++ /* if the log is compressed (and we're not mailing a ++ * file whose compression has been delayed), we need ++ * to uncompress it */ ++ if ((log->flags & LOG_FLAG_COMPRESS) && ++ !((log->flags & LOG_FLAG_DELAYCOMPRESS) && ++ (log->flags & LOG_FLAG_MAILFIRST))) { ++ if (mailLog(mailFilename, mailCommand, ++ log->uncompress_prog, log->logAddress, ++ log->files[logNum])) ++ return 1; ++ } else { ++ if (mailLog(mailFilename, mailCommand, NULL, ++ log->logAddress, mailFilename)) ++ return 1; ++ } ++ return 0; ++} ++ + static int copyTruncate(char * currLog, char * saveLog, struct stat * sb, int flags) { + char buf[BUFSIZ]; + int fdcurr = -1, fdsave = -1; +@@ -479,6 +522,9 @@ + char * baseName; + char * dirName; + char * firstRotated; ++ char * glob_pattern; ++ glob_t globResult; ++ int rc; + size_t alloc_size; + int rotateCount = log->rotateCount ? log->rotateCount : 1; + int logStart = (log->logStart == -1) ? 1 : log->logStart; +@@ -509,7 +555,7 @@ + + alloc_size = strlen(dirName) + strlen(baseName) + + strlen(log->files[logNum]) + strlen(fileext) + +- strlen(compext) + 10; ++ strlen(compext) + 18; + + oldName = alloca(alloc_size); + newName = alloca(alloc_size); +@@ -531,25 +577,106 @@ + /* First compress the previous log when necessary */ + if (log->flags & LOG_FLAG_COMPRESS && + log->flags & LOG_FLAG_DELAYCOMPRESS) { +- struct stat sbprev; +- +- sprintf(oldName, "%s/%s.%d%s", dirName, baseName, logStart, fileext); +- if (stat(oldName, &sbprev)) { +- message(MESS_DEBUG, "previous log %s does not exist\n", +- oldName); +- } else { +- hasErrors = compressLogFile(oldName, log, &sbprev); ++ if (log->flags & LOG_FLAG_DATEEXT) { ++ /* glob for uncompressed files with our pattern */ ++ glob_pattern = malloc(strlen(dirName) + strlen(baseName) ++ + strlen(fileext) + 44 ); ++ sprintf(glob_pattern, ++ "%s/%s-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]%s", ++ dirName, baseName, fileext); ++ rc = glob(glob_pattern, 0, globerr, &globResult); ++ if (!rc && globResult.gl_pathc > 0) { ++ for (i = 0; i < globResult.gl_pathc && !hasErrors; i++) { ++ struct stat sbprev; ++ ++ sprintf(oldName,"%s",(globResult.gl_pathv)[i]); ++ if (stat(oldName, &sbprev)) { ++ message(MESS_DEBUG, "previous log %s does not exist\n", ++ oldName); ++ } else { ++ hasErrors = compressLogFile(oldName, log, &sbprev); ++ } ++ } ++ } else { ++ message (MESS_DEBUG, "glob finding logs to compress failed\n"); ++ /* fallback to old behaviour */ ++ sprintf(oldName, "%s/%s.%d%s", dirName, baseName, logStart, fileext); ++ } ++ globfree(&globResult); ++ free(glob_pattern); ++ } else { ++ struct stat sbprev; ++ ++ sprintf(oldName, "%s/%s.%d%s", dirName, baseName, logStart, fileext); ++ if (stat(oldName, &sbprev)) { ++ message(MESS_DEBUG, "previous log %s does not exist\n", ++ oldName); ++ } else { ++ hasErrors = compressLogFile(oldName, log, &sbprev); ++ } + } + } + ++ firstRotated = alloca(strlen(dirName) + strlen(baseName) + ++ strlen(fileext) + strlen(compext) + 30); ++ ++ if(log->flags & LOG_FLAG_DATEEXT) { ++ /* glob for compressed files with our pattern ++ * and compress ext */ ++ glob_pattern = malloc(strlen(dirName)+strlen(baseName) ++ +strlen(fileext)+strlen(compext)+44); ++ sprintf(glob_pattern, ++ "%s/%s-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]%s%s", ++ dirName, baseName, fileext, compext); ++ rc = glob(glob_pattern, 0, globerr, &globResult); ++ if (!rc) { ++ /* search for files to drop, if we find one remember it, ++ * if we find another one mail and remove the first and ++ * remember the second and so on */ ++ struct stat fst_buf; ++ int mail_out = -1; ++ /* remove the first (n - rotateCount) matches ++ * no real rotation needed, since the files have ++ * the date in their name */ ++ for (i = 0; i < globResult.gl_pathc; i++) { ++ if( !stat((globResult.gl_pathv)[i],&fst_buf) ) { ++ if (i <= ((int)globResult.gl_pathc - rotateCount)) { ++ if ( mail_out != -1 ) { ++ if (!hasErrors && log->logAddress) { ++ char * mailFilename = (globResult.gl_pathv)[mail_out]; ++ hasErrors = mailLogWrapper(mailFilename, mailCommand, logNum, log); ++ if (!hasErrors) ++ hasErrors = removeLogFile(mailFilename); ++ } ++ } ++ mail_out = i; ++ } ++ } ++ } ++ if ( mail_out != -1 ) { ++ /* oldName is oldest Backup found (for unlink later) */ ++ sprintf(oldName, "%s", (globResult.gl_pathv)[mail_out]); ++ strcpy(disposeName, oldName); ++ } else ++ disposeName = NULL; ++ } else { ++ message (MESS_DEBUG, "glob finding old rotated logs failed\n"); ++ disposeName = NULL; ++ } ++ /* firstRotated is most recently created/compressed rotated log */ ++ sprintf(firstRotated, "%s/%s-%04d%02d%02d%s%s", ++ dirName, baseName, now.tm_year+1900, ++ now.tm_mon+1, now.tm_mday, fileext, compext); ++ globfree(&globResult); ++ free(glob_pattern); ++ } else { ++ + sprintf(oldName, "%s/%s.%d%s%s", dirName, baseName, + logStart + rotateCount, fileext, compext); + strcpy(newName, oldName); + + strcpy(disposeName, oldName); + +- firstRotated = alloca(strlen(dirName) + strlen(baseName) + +- strlen(fileext) + strlen(compext) + 30); + sprintf(firstRotated, "%s/%s.%d%s%s", dirName, baseName, + logStart, fileext, + (log->flags & LOG_FLAG_DELAYCOMPRESS) ? "" : compext); +@@ -599,12 +726,27 @@ + hasErrors = 1; + } + } +- } +- ++ } ++ } /* !LOG_FLAG_DATEEXT */ ++ + finalName = oldName; + +- /* note: the gzip extension is *not* used here! */ +- sprintf(finalName, "%s/%s.%d%s", dirName, baseName, logStart, fileext); ++ if(log->flags & LOG_FLAG_DATEEXT) { ++ char * destFile = alloca(strlen(dirName) + strlen(baseName) + ++ strlen(fileext) + strlen(compext) + 30); ++ struct stat fst_buf; ++ sprintf(finalName, "%s/%s-%04d%02d%02d%s", ++ dirName, baseName, now.tm_year+1900, ++ now.tm_mon+1, now.tm_mday, fileext); ++ sprintf(destFile, "%s%s", finalName, compext); ++ if(!stat(destFile,&fst_buf)) { ++ message (MESS_DEBUG, "destination %s already exists, skipping rotation\n", firstRotated); ++ hasErrors = 1; ++ } ++ } else { ++ /* note: the gzip extension is *not* used here! */ ++ sprintf(finalName, "%s/%s.%d%s", dirName, baseName, logStart, fileext); ++ } + + /* if the last rotation doesn't exist, that's okay */ + if (!debug && access(disposeName, F_OK)) { +@@ -613,9 +755,6 @@ + disposeName = NULL; + } + +- free(dirName); +- free(baseName); +- + if (!hasErrors) { + if (log->pre && !(log->flags & LOG_FLAG_SHAREDSCRIPTS)) { + message(MESS_DEBUG, "running prerotate script\n"); +@@ -761,6 +900,8 @@ + } + } + #endif ++ free(dirName); ++ free(baseName); + return hasErrors; + } + +Index: logrotate-3.7.1/config.c +=================================================================== +--- logrotate-3.7.1.orig/config.c 2006-04-08 20:32:36.774133397 +0100 ++++ logrotate-3.7.1/config.c 2006-04-08 20:36:00.256858650 +0100 +@@ -511,6 +511,14 @@ + newlog->flags &= ~LOG_FLAG_IFEMPTY; + + *endtag = oldchar, start = endtag; ++ } else if (!strcmp(start, "dateext")) { ++ newlog->flags |= LOG_FLAG_DATEEXT; ++ ++ *endtag = oldchar, start = endtag; ++ } else if (!strcmp(start, "nodateext")) { ++ newlog->flags &= ~LOG_FLAG_DATEEXT; ++ ++ *endtag = oldchar, start = endtag; + } else if (!strcmp(start, "noolddir")) { + newlog->oldDir = NULL; + +Index: logrotate-3.7.1/logrotate.8 +=================================================================== +--- logrotate-3.7.1.orig/logrotate.8 2006-04-08 20:32:36.775133204 +0100 ++++ logrotate-3.7.1/logrotate.8 2006-04-08 20:36:00.257858464 +0100 +@@ -200,6 +200,11 @@ + Log files are rotated every day. + + .TP ++\fBdateext\fR ++Archive old versions of log files adding a daily extension like YYYYMMDD ++instead of simply adding a number. ++ ++.TP + \fBdelaycompress\fR + Postpone compression of the previous log file to the next rotation cycle. + This has only effect when used in combination with \fBcompress\fR. --- logrotate-3.7.1.orig/debian/patches/configparse.patch +++ logrotate-3.7.1/debian/patches/configparse.patch @@ -0,0 +1,25 @@ +# Loosens the config syntax checking to allow more flexibility. +# (Closes: #95617,#95630) + +Index: logrotate-3.7.1/config.c +=================================================================== +--- logrotate-3.7.1.orig/config.c 2006-04-08 20:46:40.250457779 +0100 ++++ logrotate-3.7.1/config.c 2006-04-08 20:48:15.188228344 +0100 +@@ -768,7 +768,7 @@ + + while (*start) { + chptr = start; +- while (!isspace(*chptr) && *chptr != ',' && *chptr) ++ while (!isspace(*chptr) && /* *chptr != ',' && */ *chptr) + chptr++; + + tabooExts = realloc(tabooExts, sizeof(*tabooExts) * +@@ -780,7 +780,7 @@ + tabooCount++; + + start = chptr; +- if (*start == ',') start++; ++ /* if (*start == ',') start++; */ + while (isspace(*start) && *start) start++; + } +