Hello community, here is the log from the commit of package logrotate.1893 for openSUSE:12.2:Update checked in at 2013-08-05 10:58:32 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:12.2:Update/logrotate.1893 (Old) and /work/SRC/openSUSE:12.2:Update/.logrotate.1893.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "logrotate.1893" Changes: -------- New Changes file: --- /dev/null 2013-07-23 23:44:04.804033756 +0200 +++ /work/SRC/openSUSE:12.2:Update/.logrotate.1893.new/logrotate.changes 2013-08-05 10:58:33.000000000 +0200 @@ -0,0 +1,464 @@ +------------------------------------------------------------------- +Fri Jul 26 09:26:39 UTC 2013 - vci...@suse.com + +- Call prerotate/postrotate script only for really rotated files in + nosharedscripts mode (bnc#831057) + * added logrotate-fix_nosharedscripts_mode.patch + +------------------------------------------------------------------- +Fri Sep 30 15:34:40 UTC 2011 - u...@suse.com + +- cross-build fix: use %__cc macro + +------------------------------------------------------------------- +Wed Sep 7 14:30:29 UTC 2011 - vci...@suse.com + +- update to 3.8.1 +- dropped CVE patches as they were merged to upstream +- changelog + - fixed 1 memory leak in prerotateSingleLog + - do not redirect logrotate errors to /dev/null in cron script + - fixed "size" directive parsing + - handle situation when acl_get_fd is supported, but acl_set_fd is not + - added "maxsize" directive (see man page) + - added "dateyesterday" option (see man page) + - fixed crash when config file had exactly 4096*N bytes + - added WITH_ACL make option to link against -lacl and preserve ACLs + during rotation + - added "su" option to define user/group for rotation. Logrotate now + skips directories which are world writable or writable by group + which is not "root" unless "su" directive is used. + - fixed CVE-2011-1098: race condition by creation of new files + - fixed possible shell injection when using "shred" directive (CVE-2011-1154) + - fixed escaping of file names within 'write state' action (CVE-2011-1155) + - better 'size' directive description + - fixed possible buffer-overflow when reading config files + +------------------------------------------------------------------- +Wed Sep 7 12:51:41 UTC 2011 - vci...@suse.com + +- allow whitespace separated options in compressoptions (bnc#711780) + +------------------------------------------------------------------- +Mon Jul 25 10:25:56 UTC 2011 - jeng...@medozas.de + +- Change compression scheme to xz + +------------------------------------------------------------------- +Tue May 10 14:23:08 UTC 2011 - pu...@novell.com + +- add logrotate-CVE-2011-1098.patch (bnc#677336) +- add logrotate-shred-CVE-2011-1154.patch (bnc#679661) +- add logrotate-CVE-2011-1155.patch (bnc#679662) +- use spec-cleaner + +------------------------------------------------------------------- +Thu Nov 18 12:44:55 UTC 2010 - lnus...@suse.de + +- also rotate /var/log/btmp + +------------------------------------------------------------------- +Tue Sep 14 13:01:46 UTC 2010 - pu...@novell.com + +- use proper syslog facility/priority in logrotate cron + script (bnc#636236) + +------------------------------------------------------------------- +Tue Aug 17 15:29:49 UTC 2010 - pu...@novell.com + +- update to logrotate-3.7.9 + - don't copy config files on the stack -- mmap them instead + (fixes segfaults with too large/invalid config files) + - symlinked conf file man page as requested by Fedora guidelines + - added rotating (copying) non-writable, readable files + - fixed missingok problem with globs + - fixed bug when log files could be removed even there was + some error in rotation process. + - allow setting size greater than 4.2GB in configuration file + - pass currently rotated file to postrotate/prerotate script + in nosharedscripts mode + - added new TabooExts: ".disabled", ".dpkg-old", ".dpkg-dist", + ".dpkg-new", ".cfsaved", ".ucf-old", ".ucf-dist", ".ucf-new" + - Don't change utime atime/mtime when compressing files + - Better *rotate scripts parser. + - Allow 'include' directive in log file definitions +- merge logrotate-3.7.8-cron-check-for-another-instance.patch into + logrotate-3.7.8-suse.patch +- add logrotate-rpmlintrc: suppress false-positive rpmlint warning + +------------------------------------------------------------------- +Sun Dec 20 16:30:04 CET 2009 - jeng...@medozas.de + +- enable parallel build + +------------------------------------------------------------------- +Fri Mar 6 15:31:04 CET 2009 - pu...@suse.cz + +- update to 3.7.8 + - do not exit on status file errors + - limit config file inclusion nesting + - use hashes for status file handling + - dateformat to allow unixtime + - manual page corrections +- drop hashes patch (upstream) + +------------------------------------------------------------------- +Wed Dec 10 19:48:49 CET 2008 - sch...@suse.de + +- Fix compresscmd default. + +------------------------------------------------------------------- +Tue Oct 21 15:16:03 CEST 2008 - pu...@suse.cz + +- logrotate-3.7.7-hashes.patch (bnc#415072) + +------------------------------------------------------------------- +Tue Sep 30 13:17:04 CEST 2008 - pu...@suse.cz + +- use chekcproc in logrotate.cron script instead of pgrep (bnc#426162) + +------------------------------------------------------------------- +Wed Sep 3 11:20:54 CEST 2008 - pu...@suse.cz + +- update to 3.7.7 + - dateformat + - fix possible buffer overflows in strings handling + - change logInfo handling + - fix compile warnings + - tabooext honor wildcards + - fix selinux support with dateext + - various minor bugfixes +- removed logrotate-3.7.5-errorHandling.patch, logrotate-3.7.5-shred.patch, + logrotate-3.7.5-cfengine.patch, logrotate-3.7.5-date.patch, + logrotate-3.7.5-logfn.patch + - merged to upstream + +------------------------------------------------------------------- +Mon Aug 25 15:08:14 CEST 2008 - prus...@suse.cz + +- enabled SELinux support [Fate#303662] + +------------------------------------------------------------------- +Wed Aug 20 11:05:19 CEST 2008 - pu...@suse.cz + +- added logrotate-3.7.5-cron-check-for-another-instance.patch + - cronjob exits immediately if there is another logrotate instance + running + - fixes (bnc#415072) + +------------------------------------------------------------------- +Thu Aug 14 17:36:08 CEST 2008 - pu...@suse.cz + +- fix rpmlint warnings: + - make test moved to %check section + - require cron + +------------------------------------------------------------------- +Thu Jan 31 14:08:47 CET 2008 - r...@suse.de + +- log error if target file already exists + (upgrade from MESS_DEBUG to MESS_ERROR) + +------------------------------------------------------------------- +Wed Oct 31 18:01:58 CET 2007 - r...@suse.de + +- added bzip2 as dependency since it's used as default compressor + (#334555) + +------------------------------------------------------------------- +Thu Aug 16 15:33:29 CEST 2007 - r...@suse.de + +- update to 3.7.5 with some bugfixes containing: + - 251040 config option size not handled correctly +- added the current fedora patchkit which adds shred support + +------------------------------------------------------------------- +Mon Aug 7 18:07:58 CEST 2006 - r...@suse.de + +- try adding new option "addextension" which provides what + some users expected the old "extension" keyword to do + +------------------------------------------------------------------- +Wed Jun 21 12:40:30 CEST 2006 - r...@suse.de + +- update to 3.7.4 + - adds the "minsize" option +- clean up comments in sample logrotate.conf (#183440) + +------------------------------------------------------------------- +Wed Jan 25 21:37:59 CET 2006 - m...@suse.de + +- converted neededforbuild to BuildRequires + +------------------------------------------------------------------- +Wed Jan 11 19:05:18 CET 2006 - r...@suse.de + +- fixed segfault in autoext patch (#142021) + ++++ 267 more lines (skipped) ++++ between /dev/null ++++ and /work/SRC/openSUSE:12.2:Update/.logrotate.1893.new/logrotate.changes New: ---- logrotate-3.7.8-addextension.patch logrotate-3.7.8-autoext.patch logrotate-3.7.8-conf.patch logrotate-3.7.8-mess_err.patch logrotate-3.7.8-suse.patch logrotate-3.7.9-compressoptions.patch logrotate-3.8.1.tar.gz logrotate-fix_nosharedscripts_mode.patch logrotate-rpmlintrc logrotate.changes logrotate.spec ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ logrotate.spec ++++++ # # spec file for package logrotate # # Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # Url: https://fedorahosted.org/releases/l/o/logrotate Name: logrotate Version: 3.8.1 Release: 0 Summary: Rotate, compress, remove, and mail system log files License: GPL-2.0+ Group: System/Base Source: %{name}-%{version}.tar.gz Source100: %{name}-rpmlintrc Patch0: logrotate-3.7.8-suse.patch Patch1: logrotate-3.7.8-conf.patch Patch2: logrotate-3.7.8-autoext.patch Patch3: logrotate-3.7.8-addextension.patch Patch4: logrotate-3.7.8-mess_err.patch # PATCH-FIX-UPSTREAM allow separated compressoptions (bnc#711780) Patch8: logrotate-3.7.9-compressoptions.patch Patch9: logrotate-fix_nosharedscripts_mode.patch BuildRequires: libselinux-devel BuildRequires: popt-devel PreReq: %fillup_prereq PreReq: /bin/mv PreReq: /bin/rm Requires: cron Requires: xz BuildRoot: %{_tmppath}/%{name}-%{version}-build %description The logrotate utility is designed to simplify the administration of log files on a system that generates a lot of log files. Logrotate allows 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 reaches a certain size. Normally, logrotate runs as a daily cron job. %prep %setup -q %patch0 %patch1 %patch2 %patch3 %patch4 %patch8 -p1 %patch9 -p1 %build make %{?_smp_mflags} CC="%__cc" RPM_OPT_FLAGS="%{optflags}" WITH_SELINUX=yes %check make test %install make PREFIX=%{buildroot} install mkdir -p %{buildroot}%{_sysconfdir}/{logrotate.d,cron.daily} mkdir -p %{buildroot}%{_prefix}/sbin install -m 644 examples/logrotate-default %{buildroot}%{_sysconfdir}/logrotate.conf install -m 755 examples/logrotate.cron %{buildroot}%{_sysconfdir}/cron.daily/logrotate install -m 644 examples/logrotate.wtmp %{buildroot}%{_sysconfdir}/logrotate.d/wtmp %post %{remove_and_set MAX_DAYS_FOR_LOG_FILES} if [ -f /etc/logrotate.d/aaa_base ] ; then echo "Saving old logrotate system configuration" mv -v /etc/logrotate.d/aaa_base /etc/logrotate.d.aaa_base.save fi %clean rm -rf %{buildroot} %files %defattr(-,root,root) %doc CHANGES %{_sbindir}/logrotate %{_mandir}/man8/logrotate.8* %{_mandir}/man5/logrotate.conf.5* %{_sysconfdir}/cron.daily/logrotate %config %{_sysconfdir}/logrotate.conf %config(noreplace)/etc/logrotate.d/wtmp %changelog ++++++ logrotate-3.7.8-addextension.patch ++++++ Index: test/test =================================================================== --- test/test.orig +++ test/test @@ -427,4 +427,26 @@ test.log 0 test.log.1 0 zero EOF +# check rotation with extension appended to the filename +cleanup 17 + +preptest test.log 17 1 0 +$RLR test-config.17 --force + +checkoutput <<EOF +test.log 0 +test.log.1.newext 0 zero +EOF + +# check rotation with extension moved after the number +cleanup 18 + +preptest test.log 18 1 0 +$RLR test-config.18 --force + +checkoutput <<EOF +test.log 0 +test.1.log 0 zero +EOF + # cleanup Index: config.c =================================================================== --- config.c.orig +++ config.c @@ -519,6 +519,7 @@ int readAllConfigPaths(const char **path .last = NULL, .logAddress = NULL, .extension = NULL, + .addextension = NULL, .compress_prog = NULL, .uncompress_prog = NULL, .compress_ext = NULL, @@ -1177,6 +1178,19 @@ static int readConfigFile(const char *co message(MESS_DEBUG, "extension is now %s\n", newlog->extension); + } else if (!strcmp(key, "addextension")) { + if ((key = isolateValue + (configFile, lineNum, "addextension name", &start, + &buf, length)) != NULL) { + freeLogItem (addextension); + newlog->addextension = key; + key = NULL; + } + else continue; + + message(MESS_DEBUG, "addextension is now %s\n", + newlog->addextension); + } else if (!strcmp(key, "compresscmd")) { freeLogItem (compress_prog); Index: logrotate.8 =================================================================== --- logrotate.8.orig +++ logrotate.8 @@ -248,6 +248,15 @@ appears after \fIext\fR. For example you and want to rotate it to mylog.1.foo.gz instead of mylog.foo.1.gz. .TP +\fBaddextension \fIext\fR +Log files are given the final extension \fIext\fR after rotation. If +the original file already ends with \fIext\fR, the extension is not +duplicated, but merely moved to the end, i.e. both \fBfilename\fR and +\fBfilename\fIext\fR would get rotated to filename.1\fIext\fR. If +compression is used, the compression extension (normally \fB.gz\fR) +appears after \fIext\fR. + +.TP \fBifempty\fR Rotate the log file even if it is empty, overriding the \fBnotifempty\fR option (\fBifempty\fR is the default). Index: logrotate.c =================================================================== --- logrotate.c.orig +++ logrotate.c @@ -867,6 +867,24 @@ int prerotateSingleLog(struct logInfo *l rotNames->baseName = strdup(ourBaseName(log->files[logNum])); + if (log->addextension) { + size_t baseLen = strlen(rotNames->baseName); + size_t extLen = strlen(log->addextension); + if (baseLen >= extLen && + strncmp(&(rotNames->baseName[baseLen - extLen]), + log->addextension, extLen) == 0) { + char *tempstr; + + fileext = log->addextension; + tempstr = calloc(baseLen - extLen + 1, sizeof(char)); + strncat(tempstr, rotNames->baseName, baseLen - extLen); + free(rotNames->baseName); + rotNames->baseName = tempstr; + } else { + fileext = log->addextension; + } + } + if (log->extension && strncmp(& (rotNames-> Index: logrotate.h =================================================================== --- logrotate.h.orig +++ logrotate.h @@ -44,6 +44,7 @@ struct logInfo { char *pre, *post, *first, *last; char *logAddress; char *extension; + char *addextension; char *compress_prog; char *uncompress_prog; char *compress_ext; Index: test/test-config.17.in =================================================================== --- /dev/null +++ test/test-config.17.in @@ -0,0 +1,7 @@ +create + +&DIR&/test.log { + monthly + rotate 1 + addextension .newext +} Index: test/test-config.18.in =================================================================== --- /dev/null +++ test/test-config.18.in @@ -0,0 +1,7 @@ +create + +&DIR&/test.log { + monthly + rotate 1 + addextension .log +} ++++++ logrotate-3.7.8-autoext.patch ++++++ Index: config.c =================================================================== --- config.c.orig +++ config.c @@ -583,6 +583,7 @@ static int readConfigFile(const char *co char **scriptDest = NULL; struct logInfo *newlog = defConfig; char *start, *chptr; + char *compresscmd_base; char *dirName; struct group *group; struct passwd *pw = NULL; @@ -1205,6 +1206,18 @@ static int readConfigFile(const char *co message(MESS_DEBUG, "compress_prog is now %s\n", newlog->compress_prog); + compresscmd_base=strdup(basename(newlog->compress_prog)); + i=0; /* have to check whether we may do this! */ + /* we check whether we changed the compress_cmd. In case we use the apropriate extension + as listed in compress_cmd_list */ + while ((i>=0)&&(strcmp(compress_cmd_list[i][0], "EOLIST"))){ + if (0==strcmp(compress_cmd_list[i][0], compresscmd_base)){ + newlog->compress_ext=strdup((char *)compress_cmd_list[i][1]); + message(MESS_DEBUG, "compress_ext was changed to %s\n", newlog->compress_ext); + i=-10; /* terminate loop! */ + } + i++; + } } else if (!strcmp(key, "uncompresscmd")) { freeLogItem (uncompress_prog); Index: logrotate.c =================================================================== --- logrotate.c.orig +++ logrotate.c @@ -76,6 +76,16 @@ unsigned int hashSize; int numLogs = 0; int debug = 0; char *mailCommand = DEFAULT_MAIL_COMMAND; +/* This is the declaration. Note the "2" is needed in the definition (logrotate.h), too! */ +const char * compress_cmd_list[][2] = { + {"gzip", ".gz"}, + {"bzip2", ".bz2"}, + {"xz", ".xz"}, + {"compress", ".Z"}, + {"zip", "zip"}, + {"EOLIST", "EOLIST"} /* end-marker */ +}; + time_t nowSecs = 0; static uid_t save_euid; static gid_t save_egid; Index: logrotate.h =================================================================== --- logrotate.h.orig +++ logrotate.h @@ -66,6 +66,9 @@ TAILQ_HEAD(logInfoHead, logInfo) logs; extern int numLogs; extern int debug; +/* This is the definition. Note we have to carry the "2" within the declaration (logrotate.c), too! */ +extern const char * compress_cmd_list[][2]; + int readAllConfigPaths(const char **paths); #if !defined(asprintf) int asprintf(char **string_ptr, const char *format, ...); ++++++ logrotate-3.7.8-conf.patch ++++++ Index: examples/logrotate-default =================================================================== --- examples/logrotate-default.orig +++ examples/logrotate-default @@ -14,22 +14,13 @@ dateext # uncomment this if you want your log files compressed #compress -# RPM packages drop log rotation information into this directory -include /etc/logrotate.d - -# no packages own wtmp and btmp -- we'll rotate them here -/var/log/wtmp { - monthly - create 0664 root utmp - minsize 1M - rotate 1 -} +# comment these to switch compression to use gzip or another +# compression scheme +compresscmd /usr/bin/xz +uncompresscmd /usr/bin/xzdec -/var/log/btmp { - missingok - monthly - create 0600 root utmp - rotate 1 -} +# former versions had to have the compressext set accordingly +#compressext .xz -# system-specific logs may be also be configured here. +# RPM packages drop log rotation information into this directory +include /etc/logrotate.d Index: examples/logrotate.wtmp =================================================================== --- /dev/null +++ examples/logrotate.wtmp @@ -0,0 +1,11 @@ +/var/log/wtmp /var/log/btmp { + compress + dateext + maxage 365 + rotate 99 + size=+400k + notifempty + missingok + copytruncate +} + ++++++ logrotate-3.7.8-mess_err.patch ++++++ Index: logrotate.c =================================================================== --- logrotate.c.orig +++ logrotate.c @@ -1206,7 +1206,7 @@ int prerotateSingleLog(struct logInfo *l } asprintf(&destFile, "%s%s", rotNames->finalName, compext); if (!stat(destFile, &fst_buf)) { - message(MESS_DEBUG, + message(MESS_ERROR, "destination %s already exists, skipping rotation\n", rotNames->firstRotated); hasErrors = 1; ++++++ logrotate-3.7.8-suse.patch ++++++ Index: Makefile =================================================================== --- Makefile.orig +++ Makefile @@ -81,7 +81,7 @@ ifneq ($(STATEFILE),) endif BINDIR = $(BASEDIR)/sbin -MANDIR ?= $(BASEDIR)/man +MANDIR ?= $(BASEDIR)/share/man #-------------------------------------------------------------------------- Index: examples/logrotate.cron =================================================================== --- examples/logrotate.cron.orig +++ examples/logrotate.cron @@ -1,8 +1,23 @@ #!/bin/sh -/usr/sbin/logrotate /etc/logrotate.conf -EXITVALUE=$? -if [ $EXITVALUE != 0 ]; then - /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]" +# exit immediately if there is another instance running +if checkproc /usr/sbin/logrotate; then + /bin/logger -p cron.warning -t logrotate "ALERT another instance of logrotate is running - exiting" + exit 1 fi + +TMPF=`mktemp /tmp/logrotate.XXXXXXXXXX` + +/usr/sbin/logrotate /etc/logrotate.conf 2>&1 | tee $TMPF +EXITVALUE=${PIPESTATUS[0]} + +if [ $EXITVALUE != 0 ]; then + # wait a sec, we might just have restarted syslog + sleep 1 + # tell what went wrong + /bin/logger -p cron.warning -t logrotate "ALERT exited abnormally with [$EXITVALUE]" + /bin/logger -p cron.warning -t logrotate -f $TMPF + fi + +rm -f $TMPF exit 0 ++++++ logrotate-3.7.9-compressoptions.patch ++++++ Index: logrotate-3.8.1/config.c =================================================================== --- logrotate-3.8.1.orig/config.c +++ logrotate-3.8.1/config.c @@ -192,7 +192,9 @@ static char *readPath(const char *config chptr = start; while( (len = mbrtowc(&pwc, chptr, strlen(chptr), NULL)) != 0 ) { - if( len == (size_t)(-1) || len == (size_t)(-2) || !iswprint(pwc) || iswblank(pwc) ) { + if( len == (size_t)(-1) || len == (size_t)(-2) || !iswprint(pwc) || + /* allow more compress options separated by whitespace */ + ( strcmp(key, "compressoptions") && iswblank(pwc) ) ) { message(MESS_ERROR, "%s:%d bad %s path %s\n", configFile, lineNum, key, start); return NULL; ++++++ logrotate-fix_nosharedscripts_mode.patch ++++++ Index: logrotate-3.8.1/test/test-config.41.in =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ logrotate-3.8.1/test/test-config.41.in 2013-07-26 11:23:58.365212701 +0200 @@ -0,0 +1,17 @@ +create + +&DIR&/test*.log { + size 5 + rotate 1 + nosharedscripts + prerotate + touch scriptout + echo -n $(basename $1) >> scriptout + echo -n ";" >> scriptout + endscript + postrotate + touch scriptout + echo -n $(basename $1) >> scriptout + echo -n ";" >> scriptout + endscript +} Index: logrotate-3.8.1/test/test-config.43.in =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ logrotate-3.8.1/test/test-config.43.in 2013-07-26 11:23:58.365212701 +0200 @@ -0,0 +1,17 @@ +create + +&DIR&/test*.log { + size 5 + rotate 1 + nosharedscripts + prerotate + touch scriptout + echo -n $(basename $1) >> scriptout + echo -n ";" >> scriptout + endscript + postrotate + touch scriptout + echo -n $(basename $1) >> scriptout + echo -n ";" >> scriptout + endscript +} Index: logrotate-3.8.1/test/test-config.45.in =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ logrotate-3.8.1/test/test-config.45.in 2013-07-26 11:23:58.365212701 +0200 @@ -0,0 +1,27 @@ +create + +&DIR&/test.log &DIR&/test2.log { + size 5 + rotate 1 + sharedscripts + prerotate + touch scriptout + IFS=$(echo -en "\n\b") + echo -n "\"" >> scriptout + for f in "$1" + do + echo -n $(basename $f) >> scriptout + echo -n ";" >> scriptout + done + endscript + postrotate + touch scriptout + IFS=$(echo -en "\n\b") + for f in "$1" + do + echo -n $(basename $f) >> scriptout + echo -n ";" >> scriptout + done + echo -n "\"" >> scriptout + endscript +} Index: logrotate-3.8.1/test/test =================================================================== --- logrotate-3.8.1.orig/test/test 2013-07-26 11:23:58.343212438 +0200 +++ logrotate-3.8.1/test/test 2013-07-26 11:23:58.372212785 +0200 @@ -450,3 +450,129 @@ test.1.log 0 zero EOF # cleanup + +cleanup 41 + +# ------------------------------- Test 41 ------------------------------------ +# Test that prerotate and postrotate scripts are called only when the log files +# are actually rotated +preptest test.log 41 1 +echo x > test2.log + +$RLR test-config.41 + +checkoutput <<EOF +test.log 0 +test.log.1 0 zero +test2.log 0 x +scriptout 0 test.log;test.log; +EOF + +cleanup 42 + +# ------------------------------- Test 42 ------------------------------------ +# Test that script is called only once when sharedscripts is defined +preptest test.log 42 1 +echo number2 > test2.log + +$RLR test-config.42 + +checkoutput <<EOF +test.log 0 +test.log.1 0 zero +test2.log 0 +test2.log.1 0 number2 +scriptout 0 "test*.log ;test*.log ;" +EOF + +cleanup 43 + +# ------------------------------- Test 43 ------------------------------------ +# Test that prerotate and postrotate scripts are called twice for two files +# when sharedscripts defined +preptest test.log 43 1 +echo number2 > test2.log + +$RLR test-config.43 + +# Check both possible orders +grep "test2.log;test2.log;test.log;test.log;" scriptout >/dev/null +if [ $? != 0 ]; then + grep "test.log;test.log;test2.log;test2.log;" scriptout >/dev/null + if [ $? != 0 ]; then + echo "ERROR: scriptout should contain 'test2.log;test2.log;test.log;test.log;' or 'test.log;test.log;test2.log;test2.log;'" + exit 3 + fi +fi + +rm -f scriptout + +checkoutput <<EOF +test.log 0 +test.log.1 0 zero +test2.log 0 +test2.log.1 0 number2 +EOF + +cleanup 44 + +# ------------------------------- Test 44 ------------------------------------ +# Test that prerotate and postrotate scripts are called once when nosharedscripts +# is defined and one rotation fails +preptest test.log 44 1 + +$RLR test-config.44 2>error.log + +grep "error: stat of" error.log >/dev/null +if [ $? != 0 ]; then + echo "No error printed, but there should be one." + exit 3 +fi + +rm -f error.log + +checkoutput <<EOF +test.log 0 +test.log.1 0 zero +scriptout 0 "test.log;test.log;" +EOF + +cleanup 45 + +# ------------------------------- Test 44 ------------------------------------ +# Test that prerotate and postrotate scripts are not called when sharedscripts +# is defined and one rotation fails +preptest test.log 45 1 + +touch scriptout +$RLR test-config.45 2>error.log + +grep "error: stat of" error.log >/dev/null +if [ $? != 0 ]; then + echo "No error printed, but there should be one." + exit 3 +fi + +rm -f error.log + +checkoutput <<EOF +test.log 0 zero +scriptout 0 +EOF + + +cleanup 52 + +# ------------------------------- Test 52 ------------------------------------ +# sharedscripts are not run if the first log file does not exist +preptest test.log 52 1 0 + +$RLR test-config.52 + +checkoutput <<EOF +test.log 0 +test.log.1 0 zero +scriptout 0 foo +EOF + +cleanup Index: logrotate-3.8.1/test/test-config.42.in =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ logrotate-3.8.1/test/test-config.42.in 2013-07-26 11:23:58.366212713 +0200 @@ -0,0 +1,27 @@ +create + +&DIR&/test*.log { + size 5 + rotate 1 + sharedscripts + prerotate + touch scriptout + IFS=$(echo -en "\n\b") + echo -n "\"" >> scriptout + for f in "$1" + do + echo -n $(basename $f) >> scriptout + echo -n ";" >> scriptout + done + endscript + postrotate + touch scriptout + IFS=$(echo -en "\n\b") + for f in "$1" + do + echo -n $(basename $f) >> scriptout + echo -n ";" >> scriptout + done + echo -n "\"" >> scriptout + endscript +} Index: logrotate-3.8.1/test/test-config.44.in =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ logrotate-3.8.1/test/test-config.44.in 2013-07-26 11:23:58.366212713 +0200 @@ -0,0 +1,27 @@ +create + +&DIR&/test.log &DIR&/test2.log { + size 5 + rotate 1 + nosharedscripts + prerotate + touch scriptout + IFS=$(echo -en "\n\b") + echo -n "\"" >> scriptout + for f in "$1" + do + echo -n $(basename $f) >> scriptout + echo -n ";" >> scriptout + done + endscript + postrotate + touch scriptout + IFS=$(echo -en "\n\b") + for f in "$1" + do + echo -n $(basename $f) >> scriptout + echo -n ";" >> scriptout + done + echo -n "\"" >> scriptout + endscript +} Index: logrotate-3.8.1/logrotate.c =================================================================== --- logrotate-3.8.1.orig/logrotate.c 2013-07-26 11:23:58.351212533 +0200 +++ logrotate-3.8.1/logrotate.c 2013-07-26 11:23:58.366212713 +0200 @@ -1565,9 +1565,11 @@ int rotateLogSet(struct logInfo *log, in hasErrors |= logHasErrors[i]; } + /* (nemam chyby nebo shared) a (nemam chyby nebo nonshared) */ if (log->pre - && (! ( (logHasErrors[j] && !(log->flags & LOG_FLAG_SHAREDSCRIPTS)) - || (hasErrors && (log->flags & LOG_FLAG_SHAREDSCRIPTS)) ) )) { + && (! ( (logHasErrors[j] && !(log->flags & LOG_FLAG_SHAREDSCRIPTS)) + || (hasErrors && (log->flags & LOG_FLAG_SHAREDSCRIPTS)) ) ) + && ((log->flags & LOG_FLAG_SHAREDSCRIPTS) || state[j]->doRotate)) { if (!numRotated) { message(MESS_DEBUG, "not running prerotate script, " "since no logs will be rotated\n"); @@ -1601,8 +1603,10 @@ int rotateLogSet(struct logInfo *log, in } if (log->post - && (! ( (logHasErrors[j] && !(log->flags & LOG_FLAG_SHAREDSCRIPTS)) - || (hasErrors && (log->flags & LOG_FLAG_SHAREDSCRIPTS)) ) )) { + && (! ( (logHasErrors[j] && !(log->flags & LOG_FLAG_SHAREDSCRIPTS)) + || (hasErrors && (log->flags & LOG_FLAG_SHAREDSCRIPTS)) ) ) + && ((log->flags & LOG_FLAG_SHAREDSCRIPTS) || state[j]->doRotate)) { + if (!numRotated) { message(MESS_DEBUG, "not running postrotate script, " "since no logs were rotated\n"); Index: logrotate-3.8.1/test/test-config.52.in =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ logrotate-3.8.1/test/test-config.52.in 2013-07-26 11:23:58.366212713 +0200 @@ -0,0 +1,13 @@ +create + +/var/log/does_not_exist.log &DIR&/test.log { + rotate 14 + size 2 + missingok + sharedscripts + postrotate + touch scriptout + echo $(cat scriptout) foo > foo + mv foo scriptout + endscript +} \ No newline at end of file ++++++ logrotate-rpmlintrc ++++++ addFilter(".*incoherent-logrotate-file /etc/logrotate.d/wtmp") -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org