Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package logrotate for openSUSE:Factory checked in at 2023-01-26 13:56:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/logrotate (Old) and /work/SRC/openSUSE:Factory/.logrotate.new.32243 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "logrotate" Thu Jan 26 13:56:49 2023 rev:75 rq:1060789 version:3.21.0 Changes: -------- --- /work/SRC/openSUSE:Factory/logrotate/logrotate.changes 2022-09-23 14:15:13.709981952 +0200 +++ /work/SRC/openSUSE:Factory/.logrotate.new.32243/logrotate.changes 2023-01-26 14:03:06.717799588 +0100 @@ -1,0 +2,24 @@ +Tue Jan 24 07:53:00 UTC 2023 - Fabian Vogt <fv...@suse.com> + +- Update to 3.21.0: + * add ignoreduplicates directive to allow duplicate file matches + * add --wait-for-state-lock option to wait for lock on the state file + * avoid failure when an anonymous non-privileged user runs logrotate + * support home dir expansion in olddir + * reduce unnecessary rename operations with start N where N > 1 + * unify handling of log levels + * do not print error: when exit code is unaffected + +------------------------------------------------------------------- +Mon Jan 23 13:21:08 UTC 2023 - Fabian Vogt <fv...@suse.com> + +- Replace the vendor config logic: + * Remove logrotate-vendor-dir.patch and the code from logrotate.service + (also addresses boo#1202406) + * Add a wrapper script which collects all config files in the right + order +- Create logrotate.keyring with kdudka's public key +- Drop logrotate-rpmlintrc: rpmlint doesn't look at /usr/etc/logrotate.d/, + so the false positive doesn't trigger. + +------------------------------------------------------------------- Old: ---- logrotate-3.20.1.tar.xz logrotate-3.20.1.tar.xz.asc logrotate-rpmlintrc logrotate-vendor-dir.patch New: ---- logrotate-3.21.0.tar.xz logrotate-3.21.0.tar.xz.asc logrotate-all logrotate.keyring ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ logrotate.spec ++++++ --- /var/tmp/diff_new_pack.oTLLpc/_old 2023-01-26 14:03:07.305803385 +0100 +++ /var/tmp/diff_new_pack.oTLLpc/_new 2023-01-26 14:03:07.313803436 +0100 @@ -1,7 +1,7 @@ # # spec file for package logrotate # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %{!?_distconfdir: %global _distconfdir %{_prefix}%{_sysconfdir}} Name: logrotate -Version: 3.20.1 +Version: 3.21.0 Release: 0 Summary: Cron service for rotating, compressing, mailing and removing system log files License: GPL-2.0-or-later @@ -30,9 +30,9 @@ Source1: logrotate.wtmp Source2: logrotate.default Source3: logrotate.service +Source4: logrotate-all Source10: https://github.com/%{name}/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz.asc -Source100: %{name}-rpmlintrc -Patch0: logrotate-vendor-dir.patch +Source11: logrotate.keyring BuildRequires: acl BuildRequires: automake BuildRequires: libacl-devel @@ -52,16 +52,14 @@ It manages plain files only and is not involved in systemd's journal rotation. %prep -%setup -q -%autopatch -p1 +%autosetup -p1 %build autoreconf -f -i %configure \ --disable-silent-rules \ --with-state-file-path=%{_localstatedir}/lib/misc/logrotate.status \ - --disable-werror \ - --enable-vendordir + --disable-werror %make_build %check @@ -73,6 +71,7 @@ install -m 644 %{SOURCE1} %{buildroot}%{_distconfdir}/logrotate.d/wtmp install -m 644 %{SOURCE2} %{buildroot}%{_distconfdir}/logrotate.conf install -D -m 644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service +install -D -m 755 %{SOURCE4} %{buildroot}%{_sbindir}/logrotate-all install -D -m 0644 examples/%{name}.timer %{buildroot}%{_unitdir}/%{name}.timer ln -s service %{buildroot}%{_sbindir}/rc%{name} @@ -102,6 +101,7 @@ %license COPYING %doc ChangeLog.md README.md %{_sbindir}/logrotate +%{_sbindir}/logrotate-all %{_sbindir}/rc%{name} %{_mandir}/man8/logrotate.8%{?ext_man} %{_mandir}/man5/logrotate.conf.5%{?ext_man} ++++++ logrotate-3.20.1.tar.xz -> logrotate-3.21.0.tar.xz ++++++ ++++ 3694 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/.tarball-version new/logrotate-3.21.0/.tarball-version --- old/logrotate-3.20.1/.tarball-version 2022-05-25 17:28:25.000000000 +0200 +++ new/logrotate-3.21.0/.tarball-version 2022-12-13 18:33:57.000000000 +0100 @@ -1 +1 @@ -3.20.1 +3.21.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/.version new/logrotate-3.21.0/.version --- old/logrotate-3.20.1/.version 2022-05-25 17:28:25.000000000 +0200 +++ new/logrotate-3.21.0/.version 2022-12-13 18:33:57.000000000 +0100 @@ -1 +1 @@ -3.20.1 +3.21.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/ChangeLog.md new/logrotate-3.21.0/ChangeLog.md --- old/logrotate-3.20.1/ChangeLog.md 2022-05-25 17:22:59.000000000 +0200 +++ new/logrotate-3.21.0/ChangeLog.md 2022-12-13 18:29:43.000000000 +0100 @@ -4,7 +4,18 @@ ## [UNRELEASED] -[UNRELEASED]: https://github.com/logrotate/logrotate/compare/3.20.1...master +[UNRELEASED]: https://github.com/logrotate/logrotate/compare/3.21.0...master + +## [3.21.0] - 2022-12-13 + - add `ignoreduplicates` directive to allow duplicate file matches (#473) + - add `--wait-for-state-lock` option to wait for lock on the state file (#457) + - avoid failure when an anonymous non-privileged user runs logrotate (#463) + - support home dir expansion in `olddir` (#454) + - reduce unnecessary rename operations with `start N` where `N > 1` (#450) + - unify handling of log levels (#239 #449) + - do not print `error:` when exit code is unaffected (#448) + +[3.21.0]: https://github.com/logrotate/logrotate/compare/3.20.1...3.21.0 ## [3.20.1] - 2022-05-25 - drop world-readable permission on state file even when ACLs are enabled (#446) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/README.md new/logrotate-3.21.0/README.md --- old/logrotate-3.20.1/README.md 2022-05-25 17:21:10.000000000 +0200 +++ new/logrotate-3.21.0/README.md 2022-12-13 18:29:43.000000000 +0100 @@ -6,10 +6,11 @@ The latest release is: -* [logrotate-3.20.1](https://github.com/logrotate/logrotate/releases/download/3.20.1/logrotate-3.20.1.tar.xz) ([sig](https://github.com/logrotate/logrotate/releases/download/3.20.1/logrotate-3.20.1.tar.xz.asc)) ([Changelog](https://github.com/logrotate/logrotate/releases/tag/3.20.1)) +* [logrotate-3.21.0](https://github.com/logrotate/logrotate/releases/download/3.21.0/logrotate-3.21.0.tar.xz) ([sig](https://github.com/logrotate/logrotate/releases/download/3.21.0/logrotate-3.21.0.tar.xz.asc)) ([Changelog](https://github.com/logrotate/logrotate/releases/tag/3.21.0)) Previous releases: +* [logrotate-3.20.1](https://github.com/logrotate/logrotate/releases/download/3.20.1/logrotate-3.20.1.tar.xz) ([sig](https://github.com/logrotate/logrotate/releases/download/3.20.1/logrotate-3.20.1.tar.xz.asc)) ([Changelog](https://github.com/logrotate/logrotate/releases/tag/3.20.1)) * [logrotate-3.20.0](https://github.com/logrotate/logrotate/releases/download/3.20.0/logrotate-3.20.0.tar.xz) ([sig](https://github.com/logrotate/logrotate/releases/download/3.20.0/logrotate-3.20.0.tar.xz.asc)) ([Changelog](https://github.com/logrotate/logrotate/releases/tag/3.20.0)) * [logrotate-3.19.0](https://github.com/logrotate/logrotate/releases/download/3.19.0/logrotate-3.19.0.tar.xz) ([sig](https://github.com/logrotate/logrotate/releases/download/3.19.0/logrotate-3.19.0.tar.xz.asc)) ([Changelog](https://github.com/logrotate/logrotate/releases/tag/3.19.0)) * [logrotate-3.18.1](https://github.com/logrotate/logrotate/releases/download/3.18.1/logrotate-3.18.1.tar.xz) ([sig](https://github.com/logrotate/logrotate/releases/download/3.18.1/logrotate-3.18.1.tar.xz.asc)) ([Changelog](https://github.com/logrotate/logrotate/releases/tag/3.18.1)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/config.c new/logrotate-3.21.0/config.c --- old/logrotate-3.20.1/config.c 2022-05-24 17:20:14.000000000 +0200 +++ new/logrotate-3.21.0/config.c 2022-12-13 18:29:43.000000000 +0100 @@ -643,7 +643,7 @@ { if (*pSet && (*pDst != src)) { /* we are overriding a previously set criterium */ - message(MESS_VERBOSE, "warning: '%s' overrides previously specified '%s'\n", + message(MESS_DEBUG, "note: '%s' overrides previously specified '%s'\n", crit_to_string(src), crit_to_string(*pDst)); } *pDst = src; @@ -787,7 +787,7 @@ .rotateCount = 0, .rotateMinAge = 0, .rotateAge = 0, - .logStart = -1, + .logStart = 1, .pre = NULL, .post = NULL, .first = NULL, @@ -942,6 +942,45 @@ return 1; } +static int expand_home_relative_path(char **path) +{ + const char *env_home; + char *new_path = NULL; + + if (!*path || (*path)[0] != '~' || (*path)[1] != '/') + return 0; + + env_home = secure_getenv("HOME"); + if (!env_home) { + const struct passwd *pwd; + + message(MESS_DEBUG, + "cannot get HOME directory from environment " + "to replace ~/, trying password database...\n"); + + pwd = getpwuid(getuid()); + if (!pwd) { + message(MESS_ERROR, "cannot get passwd entry for " + "running user %u: %s\n", + getuid(), strerror(errno)); + return 1; + } + env_home = pwd->pw_dir; + } + + if (asprintf(&new_path, "%s/%s", env_home, *path + 2) < 0) { + message_OOM(); + return 1; + } + + message(MESS_DEBUG, "replaced '%s' with '%s'\n", + *path, new_path); + + free(*path); + *path = new_path; + return 0; +} + #define freeLogItem(what) \ do { \ free(newlog->what); \ @@ -1012,16 +1051,9 @@ return 0; } - if (!getpwuid(getuid())) { - message(MESS_ERROR, "Cannot find logrotate UID (%d) in passwd file: %s\n", - getuid(), strerror(errno)); - close(fd); - return 1; - } - if (getuid() == ROOT_UID) { if ((sb_config.st_mode & 07533) != 0400) { - message(MESS_NORMAL, + message(MESS_WARN, "Potentially dangerous mode on %s: 0%o\n", configFile, (unsigned) (sb_config.st_mode & 07777)); } @@ -1386,7 +1418,7 @@ RAISE_ERROR(); } } else if (!strcmp(key, "errors")) { - message(MESS_NORMAL, + message(MESS_WARN, "%s: %d: the errors directive is deprecated and no longer used.\n", configFile, lineNum); } else if (!strcmp(key, "mail")) { @@ -1401,6 +1433,8 @@ newlog->flags |= LOG_FLAG_MISSINGOK; } else if (!strcmp(key, "nomissingok")) { newlog->flags &= ~LOG_FLAG_MISSINGOK; + } else if (!strcmp(key, "ignoreduplicates")) { + newlog->flags |= LOG_FLAG_IGNOREDUPLICATES; } else if (!strcmp(key, "prerotate")) { freeLogItem (pre); scriptStart = start; @@ -1553,36 +1587,11 @@ RAISE_ERROR(); } - if (key[0] == '~' && key[1] == '/') { - /* replace '~' with content of $HOME cause low-level functions - * like stat() do not support the glob ~ - */ - const char *env_home = secure_getenv("HOME"); - char *new_key = NULL; - - if (!env_home) { - const struct passwd *pwd = getpwuid(getuid()); - message(MESS_DEBUG, - "%s:%d cannot get HOME directory from environment " - "to replace ~/ in include directive\n", - configFile, lineNum); - if (!pwd) { - message(MESS_ERROR, "%s:%d cannot get passwd entry for " - "running user %u: %s\n", - configFile, lineNum, getuid(), strerror(errno)); - RAISE_ERROR(); - } - env_home = pwd->pw_dir; - } - - if (asprintf(&new_key, "%s/%s", env_home, key + 2) < 0) { - message_OOM(); - RAISE_ERROR(); - } - message(MESS_DEBUG, "%s:%d replaced %s with '%s' for include directive\n", - configFile, lineNum, key, env_home); - free(key); - key = new_key; + /* replace '~' with content of $HOME cause low-level functions + * like stat() do not support the glob ~ + */ + if (expand_home_relative_path(&key)) { + RAISE_ERROR(); } message(MESS_DEBUG, "including %s\n", key); @@ -1608,6 +1617,14 @@ "olddir", &start, &buf, length))) { RAISE_ERROR(); } + + /* replace '~' with content of $HOME cause low-level functions + * like stat() do not support the glob ~ + */ + if (expand_home_relative_path(&newlog->oldDir)) { + RAISE_ERROR(); + } + message(MESS_DEBUG, "olddir is now %s\n", newlog->oldDir); } else if (!strcmp(key, "extension")) { free(key); @@ -1832,8 +1849,9 @@ newlog->files = tmp; for (glob_count = 0; glob_count < globResult.gl_pathc; glob_count++) { - struct logInfo *log; + const struct logInfo *log; struct stat sb_glob; + int add_file = 1; /* if we glob directories we can get false matches */ if (!lstat(globResult.gl_pathv[glob_count], &sb_glob) && @@ -1847,24 +1865,34 @@ for (k = 0; k < log->numFiles; k++) { if (!strcmp(log->files[k], globResult.gl_pathv[glob_count])) { - message(MESS_ERROR, - "%s:%d duplicate log entry for %s\n", - configFile, lineNum, - globResult.gl_pathv[glob_count]); - logerror = 1; - goto duperror; + if (log->flags & LOG_FLAG_IGNOREDUPLICATES) { + add_file = 0; + message(MESS_DEBUG, + "%s:%d ignore duplicate log entry for %s\n", + configFile, lineNum, + globResult.gl_pathv[glob_count]); + } else { + message(MESS_ERROR, + "%s:%d duplicate log entry for %s\n", + configFile, lineNum, + globResult.gl_pathv[glob_count]); + logerror = 1; + goto duperror; + } } } } - newlog->files[newlog->numFiles] = - strdup(globResult.gl_pathv[glob_count]); - if (newlog->files[newlog->numFiles] == NULL) { - message_OOM(); - logerror = 1; - goto duperror; + if (add_file) { + newlog->files[newlog->numFiles] = + strdup(globResult.gl_pathv[glob_count]); + if (newlog->files[newlog->numFiles] == NULL) { + message_OOM(); + logerror = 1; + goto duperror; + } + newlog->numFiles++; } - newlog->numFiles++; } duperror: globfree(&globResult); @@ -1898,7 +1926,7 @@ if (newlog->oldDir) { unsigned j; for (j = 0; j < newlog->numFiles; j++) { - char *ld; + char *ld = NULL; char *dirpath; const char *dirName; struct stat sb_logdir; @@ -1931,21 +1959,21 @@ continue; } } - if (asprintf(&ld, "%s/%s", dirName, newlog->oldDir) < 0) { - message_OOM(); - free(dirpath); - goto error; - } - - free(dirpath); if (newlog->oldDir[0] != '/') { + if (asprintf(&ld, "%s/%s", dirName, newlog->oldDir) < 0) { + message_OOM(); + free(dirpath); + goto error; + } dirName = ld; } else { dirName = newlog->oldDir; } + free(dirpath); + if (stat(dirName, &sb_olddir)) { if (errno == ENOENT && (newlog->flags & LOG_FLAG_OLDDIRCREATE)) { int ret; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/config.h.in new/logrotate-3.21.0/config.h.in --- old/logrotate-3.20.1/config.h.in 2022-05-25 17:28:14.000000000 +0200 +++ new/logrotate-3.21.0/config.h.in 2022-12-13 18:33:48.000000000 +0100 @@ -12,6 +12,9 @@ /* Define to 1 if you have the `asprintf' function. */ #undef HAVE_ASPRINTF +/* Define to 1 if you have the `futimens' function. */ +#undef HAVE_FUTIMENS + /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H @@ -54,12 +57,18 @@ /* Define to 1 if you have the `strndup' function. */ #undef HAVE_STRNDUP +/* Define to 1 if `st_atim' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_ATIM + /* Define to 1 if `st_blksize' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BLKSIZE /* Define to 1 if `st_blocks' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BLOCKS +/* Define to 1 if `st_mtim' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_MTIM + /* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ #undef HAVE_ST_BLOCKS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/configure.ac new/logrotate-3.21.0/configure.ac --- old/logrotate-3.20.1/configure.ac 2021-07-27 10:25:23.000000000 +0200 +++ new/logrotate-3.21.0/configure.ac 2022-12-13 18:29:43.000000000 +0100 @@ -167,7 +167,8 @@ AC_DEFINE_UNQUOTED([ROOT_UID], [0], [Root user-id.]) AC_SUBST(ROOT_UID) -AC_CHECK_FUNCS([asprintf madvise secure_getenv strndup utimensat vsyslog]) +AC_CHECK_FUNCS([asprintf futimens madvise secure_getenv strndup utimensat vsyslog]) +AC_CHECK_MEMBERS([struct stat.st_atim, struct stat.st_mtim]) AC_CONFIG_HEADERS([config.h]) AM_CFLAGS="\ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/log.c new/logrotate-3.21.0/log.c --- old/logrotate-3.20.1/log.c 2021-05-21 12:28:13.000000000 +0200 +++ new/logrotate-3.21.0/log.c 2022-06-02 09:07:15.000000000 +0200 @@ -40,9 +40,12 @@ { switch (level) { case MESS_DEBUG: - case MESS_NORMAL: - case MESS_VERBOSE: break; + + case MESS_WARN: + fprintf(where, "warning: "); + break; + default: fprintf(where, "error: "); break; @@ -78,10 +81,11 @@ priority |= LOG_DEBUG; break; case MESS_DEBUG: - case MESS_VERBOSE: - case MESS_NORMAL: priority |= LOG_INFO; break; + case MESS_WARN: + priority |= LOG_WARNING; + break; case MESS_ERROR: priority |= LOG_ERR; break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/log.h new/logrotate-3.21.0/log.h --- old/logrotate-3.20.1/log.h 2021-08-30 14:55:48.000000000 +0200 +++ new/logrotate-3.21.0/log.h 2022-06-02 09:07:15.000000000 +0200 @@ -5,8 +5,7 @@ #define MESS_REALDEBUG 1 #define MESS_DEBUG 2 -#define MESS_VERBOSE 3 -#define MESS_NORMAL 4 +#define MESS_WARN 4 #define MESS_ERROR 5 #define MESS_FATAL 6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/logrotate.8 new/logrotate-3.21.0/logrotate.8 --- old/logrotate-3.20.1/logrotate.8 2022-05-25 17:28:20.000000000 +0200 +++ new/logrotate-3.21.0/logrotate.8 2022-12-13 18:33:54.000000000 +0100 @@ -1,4 +1,4 @@ -.TH LOGROTATE 8 "3.20.1" "Linux" "System Administrator's Manual" +.TH LOGROTATE 8 "3.21.0" "Linux" "System Administrator's Manual" .\" Per groff_man(7), the TQ macro should be copied from an-ext.tmac when .\" not running under groff. That's not quite right; not all groff .\" installations include this macro. So bring it in with another name @@ -21,6 +21,7 @@ \fR[\fB\-\-debug\fR] \fR[\fB\-\-state\fR \fIfile\fR] \fR[\fB\-\-skip-state-lock\fR] +\fR[\fB\-\-wait-for-state-lock\fR] \fR[\fB\-\-verbose\fR] \fR[\fB\-\-log\fR \fIfile\fR] \fR[\fB\-\-mail\fR \fIcommand\fR] @@ -83,6 +84,11 @@ Do not lock the state file, for example if locking is unsupported or prohibited. .TP +\fB\-\-wait-for-state-lock\fR +Wait until lock on the state file is released by another logrotate process. +This option may cause logrotate to wait indefinitely. Use with caution. + +.TP \fB\-v\fR, \fB\-\-verbose\fR Turns on verbose mode, for example to display messages during rotation. @@ -307,6 +313,10 @@ If a log file does not exist, issue an error. This is the default. .TP +\fBignoreduplicates\fR +Ignore any following matches of a log file. + +.TP \fBifempty\fR Rotate the log file even if it is empty, overriding the \fBnotifempty\fR option (\fBifempty\fR is the default). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/logrotate.8.in new/logrotate-3.21.0/logrotate.8.in --- old/logrotate-3.20.1/logrotate.8.in 2022-03-31 14:00:36.000000000 +0200 +++ new/logrotate-3.21.0/logrotate.8.in 2022-12-13 18:29:43.000000000 +0100 @@ -21,6 +21,7 @@ \fR[\fB\-\-debug\fR] \fR[\fB\-\-state\fR \fIfile\fR] \fR[\fB\-\-skip-state-lock\fR] +\fR[\fB\-\-wait-for-state-lock\fR] \fR[\fB\-\-verbose\fR] \fR[\fB\-\-log\fR \fIfile\fR] \fR[\fB\-\-mail\fR \fIcommand\fR] @@ -83,6 +84,11 @@ Do not lock the state file, for example if locking is unsupported or prohibited. .TP +\fB\-\-wait-for-state-lock\fR +Wait until lock on the state file is released by another logrotate process. +This option may cause logrotate to wait indefinitely. Use with caution. + +.TP \fB\-v\fR, \fB\-\-verbose\fR Turns on verbose mode, for example to display messages during rotation. @@ -307,6 +313,10 @@ If a log file does not exist, issue an error. This is the default. .TP +\fBignoreduplicates\fR +Ignore any following matches of a log file. + +.TP \fBifempty\fR Rotate the log file even if it is empty, overriding the \fBnotifempty\fR option (\fBifempty\fR is the default). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/logrotate.c new/logrotate-3.21.0/logrotate.c --- old/logrotate-3.20.1/logrotate.c 2022-05-25 17:19:45.000000000 +0200 +++ new/logrotate-3.21.0/logrotate.c 2022-12-13 18:29:43.000000000 +0100 @@ -663,13 +663,11 @@ return fd; } -#define DIGITS 12 - /* unlink, but try to call shred from GNU coreutils if LOG_FLAG_SHRED * is enabled (in that case fd needs to be a valid file descriptor) */ static int shred_file(int fd, const char *filename, const struct logInfo *log) { - char count[DIGITS]; /* that's a lot of shredding :) */ + char count[12]; /* 11 digits - that's a lot of shredding :) */ const char *fullCommand[6]; int id = 0; int status; @@ -714,7 +712,7 @@ if (log->shred_cycles != 0) { fullCommand[id++] = "-n"; - snprintf(count, DIGITS - 1, "%d", log->shred_cycles); + snprintf(count, sizeof(count), "%d", log->shred_cycles); fullCommand[id++] = count; } fullCommand[id++] = "-"; @@ -787,23 +785,35 @@ return result; } -static void setAtimeMtime(const char *filename, const struct stat *sb) +static void setAtimeMtime(int fd, const char *filename, const struct stat *sb) { /* If we can't change atime/mtime, it's not a disaster. It might possibly fail under SELinux. But do try to preserve the fractional part if we have utimensat(). */ -#if defined HAVE_UTIMENSAT && !defined(__APPLE__) +#if defined HAVE_FUTIMENS && defined HAVE_STRUCT_STAT_ST_ATIM && defined HAVE_STRUCT_STAT_ST_MTIM + struct timespec ts[2]; + + ts[0] = sb->st_atim; + ts[1] = sb->st_mtim; + futimens(fd, ts); + + (void)filename; +#elif defined HAVE_UTIMENSAT && defined HAVE_STRUCT_STAT_ST_ATIM && defined HAVE_STRUCT_STAT_ST_MTIM struct timespec ts[2]; ts[0] = sb->st_atim; ts[1] = sb->st_mtim; - utimensat(AT_FDCWD, filename, ts, 0); + utimensat(AT_FDCWD, filename, ts, AT_SYMLINK_NOFOLLOW); + + (void)fd; #else struct utimbuf utim; utim.actime = sb->st_atime; utim.modtime = sb->st_mtime; utime(filename, &utim); + + (void)fd; #endif } @@ -966,18 +976,19 @@ wait(&status); fsync(outFile); - close(outFile); if (!WIFEXITED(status) || WEXITSTATUS(status)) { message(MESS_ERROR, "failed to compress log %s\n", name); close(inFile); + close(outFile); unlink(compressedName); free(compressedName); return 1; } - setAtimeMtime(compressedName, sb); + setAtimeMtime(outFile, compressedName, sb); + close(outFile); free(compressedName); if (shred_file(inFile, name, log)) { @@ -1347,7 +1358,7 @@ static int findNeedRotating(const struct logInfo *log, unsigned logNum, int force) { struct stat sb; - struct logState *state = NULL; + struct logState *state; struct tm now; message(MESS_DEBUG, "considering log %s\n", log->files[logNum]); @@ -1631,7 +1642,6 @@ glob_t globResult; int rc; int rotateCount = log->rotateCount ? log->rotateCount : 1; - int logStart = (log->logStart == -1) ? 1 : log->logStart; #define DATEEXT_LEN 64 #define PATTERN_LEN (DATEEXT_LEN * 2) char dext_str[DATEEXT_LEN]; @@ -1885,7 +1895,7 @@ struct stat sbprev; char *oldName; if (asprintf(&oldName, "%s/%s.%d%s", rotNames->dirName, - rotNames->baseName, logStart, fileext) < 0) { + rotNames->baseName, log->logStart, fileext) < 0) { message_OOM(); return 1; } @@ -1988,7 +1998,7 @@ } if (asprintf(&oldName, "%s/%s.%d%s%s", rotNames->dirName, - rotNames->baseName, logStart + rotateCount, fileext, + rotNames->baseName, log->logStart + rotateCount, fileext, compext) < 0) { message_OOM(); return 1; @@ -2004,7 +2014,7 @@ } if (asprintf(&rotNames->firstRotated, "%s/%s.%d%s%s", rotNames->dirName, - rotNames->baseName, logStart, fileext, + rotNames->baseName, log->logStart, fileext, (log->flags & LOG_FLAG_DELAYCOMPRESS) ? "" : compext) < 0) { message_OOM(); free(oldName); @@ -2012,7 +2022,7 @@ return 1; } - for (i = rotateCount + logStart - 1; (i >= 0) && !hasErrors; i--) { + for (i = rotateCount + log->logStart - 1; (i >= log->logStart) && !hasErrors; i--) { free(newName); newName = oldName; if (asprintf(&oldName, "%s/%s.%d%s%s", rotNames->dirName, @@ -2052,7 +2062,7 @@ message(MESS_DEBUG, "renaming %s to %s (rotatecount %d, logstart %d, i %d), \n", - oldName, newName, rotateCount, logStart, i); + oldName, newName, rotateCount, log->logStart, i); if (!debug && rename(oldName, newName)) { if (errno == ENOENT) { @@ -2093,7 +2103,7 @@ } else { /* note: the gzip extension is *not* used here! */ if (asprintf(&(rotNames->finalName), "%s/%s.%d%s", rotNames->dirName, - rotNames->baseName, logStart, fileext) < 0) { + rotNames->baseName, log->logStart, fileext) < 0) { message_OOM(); rotNames->finalName = NULL; } @@ -3005,9 +3015,10 @@ return 0; } -static int lockState(const char *stateFilename, int skip_state_lock) +static int lockState(const char *stateFilename, int skip_state_lock, int wait_for_state_lock) { int lockFd; + int lockFlags; struct stat sb; if (!strcmp(stateFilename, "/dev/null")) { @@ -3050,15 +3061,21 @@ } if (sb.st_mode & S_IROTH) { - message(MESS_ERROR, "state file %s is world-readable and thus can" - " be locked from other unprivileged users." + message(MESS_WARN, "state file %s is world-readable" + " and thus can be locked from other unprivileged users." " Skipping lock acquisition...\n", stateFilename); close(lockFd); return 0; } - if (flock(lockFd, LOCK_EX | LOCK_NB) == -1) { + lockFlags = LOCK_EX; + if (wait_for_state_lock) + message(MESS_DEBUG, "waiting for lock on state file %s", stateFilename); + else + lockFlags |= LOCK_NB; + + if (flock(lockFd, lockFlags) == -1) { if (errno == EWOULDBLOCK) { message(MESS_ERROR, "state file %s is already locked\n" "logrotate does not support parallel execution on the" @@ -3071,6 +3088,8 @@ return 1; } + message(MESS_DEBUG, "acquired lock on state file %s", stateFilename); + /* keep lockFd open till we terminate */ return 0; } @@ -3079,6 +3098,7 @@ { int force = 0; int skip_state_lock = 0; + int wait_for_state_lock = 0; const char *stateFile = STATEFILE; const char *logFile = NULL; FILE *logFd = NULL; @@ -3099,6 +3119,7 @@ "Path of state file", "statefile"}, {"skip-state-lock", '\0', POPT_ARG_NONE, &skip_state_lock, 0, "Do not lock the state file", NULL}, + {"wait-for-state-lock", '\0', POPT_ARG_NONE, &wait_for_state_lock, 0, "Wait for lock on the state file", NULL}, {"verbose", 'v', 0, NULL, 'v', "Display messages during rotation", NULL}, {"log", 'l', POPT_ARG_STRING, &logFile, 'l', "Log file or 'syslog' to log to syslog", "logfile"}, @@ -3106,7 +3127,7 @@ POPT_AUTOHELP { NULL, 0, 0, NULL, 0, NULL, NULL } }; - logSetLevel(MESS_NORMAL); + logSetLevel(MESS_WARN); setlocale (LC_ALL, ""); optCon = poptGetContext("logrotate", argc, argv, options, 0); @@ -3117,7 +3138,7 @@ switch (arg) { case 'd': debug = 1; - message(MESS_NORMAL, "WARNING: logrotate in debug mode does nothing" + message(MESS_WARN, "logrotate in debug mode does nothing" " except printing debug messages! Consider using verbose" " mode (-v) instead if this is not what you want.\n\n"); /* fallthrough */ @@ -3182,6 +3203,14 @@ poptFreeContext(optCon); exit(1); } + + if (skip_state_lock && wait_for_state_lock) { + fprintf(stderr, "logrotate: options --skip-state-lock and" + " --wait-for-state-lock are mutually exclusive\n"); + poptFreeContext(optCon); + exit(1); + } + #ifdef WITH_SELINUX selinux_enabled = (is_selinux_enabled() > 0); selinux_enforce = security_getenforce(); @@ -3195,7 +3224,7 @@ poptFreeContext(optCon); nowSecs = time(NULL); - if (!debug && lockState(stateFile, skip_state_lock)) { + if (!debug && lockState(stateFile, skip_state_lock, wait_for_state_lock)) { exit(3); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/logrotate.h new/logrotate-3.21.0/logrotate.h --- old/logrotate-3.20.1/logrotate.h 2021-07-27 10:25:23.000000000 +0200 +++ new/logrotate-3.21.0/logrotate.h 2022-12-13 18:29:43.000000000 +0100 @@ -11,23 +11,24 @@ # include <libgen.h> #endif -#define LOG_FLAG_COMPRESS (1U << 0) -#define LOG_FLAG_CREATE (1U << 1) -#define LOG_FLAG_IFEMPTY (1U << 2) -#define LOG_FLAG_DELAYCOMPRESS (1U << 3) -#define LOG_FLAG_COPYTRUNCATE (1U << 4) -#define LOG_FLAG_MISSINGOK (1U << 5) -#define LOG_FLAG_MAILFIRST (1U << 6) -#define LOG_FLAG_SHAREDSCRIPTS (1U << 7) -#define LOG_FLAG_COPY (1U << 8) -#define LOG_FLAG_DATEEXT (1U << 9) -#define LOG_FLAG_SHRED (1U << 10) -#define LOG_FLAG_SU (1U << 11) -#define LOG_FLAG_DATEYESTERDAY (1U << 12) -#define LOG_FLAG_OLDDIRCREATE (1U << 13) -#define LOG_FLAG_TMPFILENAME (1U << 14) -#define LOG_FLAG_DATEHOURAGO (1U << 15) -#define LOG_FLAG_ALLOWHARDLINK (1U << 16) +#define LOG_FLAG_COMPRESS (1U << 0) +#define LOG_FLAG_CREATE (1U << 1) +#define LOG_FLAG_IFEMPTY (1U << 2) +#define LOG_FLAG_DELAYCOMPRESS (1U << 3) +#define LOG_FLAG_COPYTRUNCATE (1U << 4) +#define LOG_FLAG_MISSINGOK (1U << 5) +#define LOG_FLAG_MAILFIRST (1U << 6) +#define LOG_FLAG_SHAREDSCRIPTS (1U << 7) +#define LOG_FLAG_COPY (1U << 8) +#define LOG_FLAG_DATEEXT (1U << 9) +#define LOG_FLAG_SHRED (1U << 10) +#define LOG_FLAG_SU (1U << 11) +#define LOG_FLAG_DATEYESTERDAY (1U << 12) +#define LOG_FLAG_OLDDIRCREATE (1U << 13) +#define LOG_FLAG_TMPFILENAME (1U << 14) +#define LOG_FLAG_DATEHOURAGO (1U << 15) +#define LOG_FLAG_ALLOWHARDLINK (1U << 16) +#define LOG_FLAG_IGNOREDUPLICATES (1U << 17) #define NO_MODE ((mode_t) -1) #define NO_UID ((uid_t) -1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/logrotate.spec new/logrotate-3.21.0/logrotate.spec --- old/logrotate-3.20.1/logrotate.spec 2022-05-25 17:28:20.000000000 +0200 +++ new/logrotate-3.21.0/logrotate.spec 2022-12-13 18:33:54.000000000 +0100 @@ -1,6 +1,6 @@ Summary: Rotates, compresses, removes and mails system log files Name: logrotate -Version: 3.20.1 +Version: 3.21.0 Release: 1%{?dist} License: GPLv2+ Group: System Environment/Base diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/test/Makefile.am new/logrotate-3.21.0/test/Makefile.am --- old/logrotate-3.20.1/test/Makefile.am 2022-05-25 09:06:46.000000000 +0200 +++ new/logrotate-3.21.0/test/Makefile.am 2022-12-13 18:29:43.000000000 +0100 @@ -91,12 +91,16 @@ test-0090.sh \ test-0091.sh \ test-0092.sh \ + test-0093.sh \ test-0100.sh \ test-0101.sh \ test-0102.sh \ test-0103.sh \ test-0104.sh \ - test-0105.sh + test-0105.sh \ + test-0106.sh \ + test-0107.sh \ + test-0108.sh EXTRA_DIST = \ compress \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/test/test-0018.sh new/logrotate-3.21.0/test/test-0018.sh --- old/logrotate-3.20.1/test/test-0018.sh 2022-05-09 10:44:06.000000000 +0200 +++ new/logrotate-3.21.0/test/test-0018.sh 2022-08-05 13:13:20.000000000 +0200 @@ -30,7 +30,7 @@ fi fi if [ $SYSLOG_TESTS = 1 ]; then - journalctl -n 50 2>/dev/null|grep $PWD/test.log.1 2>/dev/null >/dev/null + journalctl -n 100 2>/dev/null|grep "$PWD/test.log.1" 2>/dev/null >/dev/null if [ $? != 0 ]; then echo "syslog message not found" exit 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/test/test-0080.sh new/logrotate-3.21.0/test/test-0080.sh --- old/logrotate-3.20.1/test/test-0080.sh 2021-01-05 14:01:16.000000000 +0100 +++ new/logrotate-3.21.0/test/test-0080.sh 2022-06-02 09:07:15.000000000 +0200 @@ -10,4 +10,4 @@ preptest test.log 80 1 0 $RLR -d test-config.80 2>&1 | \ - grep -q "warning: 'daily' overrides previously specified 'size'" + grep -q "note: 'daily' overrides previously specified 'size'" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/test/test-0093.sh new/logrotate-3.21.0/test/test-0093.sh --- old/logrotate-3.20.1/test/test-0093.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/logrotate-3.21.0/test/test-0093.sh 2022-12-13 18:29:43.000000000 +0100 @@ -0,0 +1,27 @@ +#!/bin/sh + +. ./test-common.sh + +# check state file locking with --wait-for-state-lock +cleanup 93 + +preptest test.log 93 1 + +# the locking in logrotate does not reliably work in case the state file +# is not created in advance +touch state +chmod 0640 state + +# run two instances of logrotate in parallel +$RLR -f --wait-for-state-lock test-config.93 & +sleep 1 +$RLR -f --wait-for-state-lock test-config.93 +EC2=$? +wait || exit $? +[ $EC2 -eq 0 ] || exit $EC2 + +checkoutput <<EOF +test.log 0 +test.log.1 0 +test.log.2 0 zero +EOF diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/test/test-0106.sh new/logrotate-3.21.0/test/test-0106.sh --- old/logrotate-3.20.1/test/test-0106.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/logrotate-3.21.0/test/test-0106.sh 2022-08-05 13:13:20.000000000 +0200 @@ -0,0 +1,31 @@ +#!/bin/sh + +. ./test-common.sh + +cleanup 106 + +# ------------------------------- Test 106 ------------------------------------ +# test ~ replacement in include and olddir directives +preptest test.log 106 1 + +export HOME="$(pwd)/homedir" +rm -rf homedir/ +mkdir -p homedir/includedir +cat > homedir/includedir/test-0106-included.conf << EOF +$(pwd)/test.log { + rotate 1 + create + olddir ~/old + createolddir 700 +} +EOF +chmod go-w homedir/includedir/test-0106-included.conf + +$RLR test-config.106 --force || exit 23 + +checkoutput <<EOF +test.log 0 +homedir/old/test.log.1 0 zero +EOF + +rm -r homedir/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/test/test-0107.sh new/logrotate-3.21.0/test/test-0107.sh --- old/logrotate-3.20.1/test/test-0107.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/logrotate-3.21.0/test/test-0107.sh 2022-12-13 18:29:43.000000000 +0100 @@ -0,0 +1,15 @@ +#!/bin/sh + +. ./test-common.sh + +cleanup 107 + +# ------------------------------- Test 107 ------------------------------------ +preptest test.log 107 1 +preptest zzzz.log 107 1 +$RLR test-config.107 --force || exit 23 + +checkoutput <<EOF +test.log.1 0 zero +zzzz.log.1 0 zero +EOF diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/test/test-0108.sh new/logrotate-3.21.0/test/test-0108.sh --- old/logrotate-3.20.1/test/test-0108.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/logrotate-3.21.0/test/test-0108.sh 2022-12-13 18:29:43.000000000 +0100 @@ -0,0 +1,38 @@ +#!/bin/sh + +. ./test-common.sh + +cleanup 108 + +# ------------------------------- Test 108 ------------------------------------ +# test setting atime and time on compressed files +preptest test.log 108 0 + +checkoutput <<EOF +test.log 0 zero +EOF + +# Set log modification time to some date in the past +TZ=UTC touch -t 200001010000 test.log + +$RLR test-config.108 --force || exit 23 + +atime=$($STAT_ATIME_FORMAT test.log.1.gz) +mtime=$($STAT_MTIME_FORMAT test.log.1.gz) +expected_time=946684800 + +if [ "$atime" -ne $expected_time ]; then + echo "atime not set (expected $expected_time, got $atime)" >&2 + exit 3 +fi + +if [ "$mtime" -ne $expected_time ]; then + echo "mtime not set (expected $expected_time, got $mtime)" >&2 + exit 3 +fi + +# check last, to not modify atime +checkoutput <<EOF +test.log 0 +test.log.1.gz 1 zero +EOF diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/test/test-common-acl.sh new/logrotate-3.21.0/test/test-common-acl.sh --- old/logrotate-3.20.1/test/test-common-acl.sh 2019-10-14 14:10:31.000000000 +0200 +++ new/logrotate-3.21.0/test/test-common-acl.sh 2022-09-09 15:25:40.000000000 +0200 @@ -1,3 +1,5 @@ +# shellcheck shell=sh + # We test if the ACLs tests should be done or not if [ -z "$ACL_TESTS" ]; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/test/test-common-selinux.sh new/logrotate-3.21.0/test/test-common-selinux.sh --- old/logrotate-3.20.1/test/test-common-selinux.sh 2019-10-14 14:10:31.000000000 +0200 +++ new/logrotate-3.21.0/test/test-common-selinux.sh 2022-09-09 15:25:40.000000000 +0200 @@ -1,3 +1,5 @@ +# shellcheck shell=sh + # We test if the SELinux tests should be done or not if [ -z "$SELINUX_TESTS" ]; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/test/test-common.sh new/logrotate-3.21.0/test/test-common.sh --- old/logrotate-3.20.1/test/test-common.sh 2022-01-06 17:11:00.000000000 +0100 +++ new/logrotate-3.21.0/test/test-common.sh 2022-12-13 18:29:43.000000000 +0100 @@ -1,3 +1,5 @@ +# shellcheck shell=sh disable=SC2034 + # common variables and functions for legacy tests if readlink -f $LOGROTATE > /dev/null 2>&1; then @@ -35,8 +37,12 @@ if stat -c %f $LOGROTATE > /dev/null 2>&1; then STAT_MODE_FORMAT='stat -c %f' + STAT_ATIME_FORMAT='stat -c %X' + STAT_MTIME_FORMAT='stat -c %Y' elif stat -f %Xp $LOGROTATE > /dev/null 2>&1; then STAT_MODE_FORMAT='stat -f %Xp' + STAT_ATIME_FORMAT='stat -f %a' + STAT_MTIME_FORMAT='stat -f %m' else echo "no stat format option found:" stat -c %f $LOGROTATE @@ -142,7 +148,7 @@ } checkmail() { - (echo -s $PWD/$1 user@invalid.; echo $2) | diff -u - mail-out + printf "%s\n%s\n" "-s $PWD/$1 user@invalid." "$2" | diff -u - mail-out if [ $? != 0 ]; then exit 5 fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/test/test-config.106.in new/logrotate-3.21.0/test/test-config.106.in --- old/logrotate-3.20.1/test/test-config.106.in 1970-01-01 01:00:00.000000000 +0100 +++ new/logrotate-3.21.0/test/test-config.106.in 2022-08-05 13:13:20.000000000 +0200 @@ -0,0 +1 @@ +include ~/includedir diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/test/test-config.107.in new/logrotate-3.21.0/test/test-config.107.in --- old/logrotate-3.20.1/test/test-config.107.in 1970-01-01 01:00:00.000000000 +0100 +++ new/logrotate-3.21.0/test/test-config.107.in 2022-12-13 18:29:43.000000000 +0100 @@ -0,0 +1,8 @@ +&DIR&/test.log { + rotate 1 + ignoreduplicates +} + +&DIR&/*.log { + rotate 1 +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/test/test-config.108.in new/logrotate-3.21.0/test/test-config.108.in --- old/logrotate-3.20.1/test/test-config.108.in 1970-01-01 01:00:00.000000000 +0100 +++ new/logrotate-3.21.0/test/test-config.108.in 2022-12-13 18:29:43.000000000 +0100 @@ -0,0 +1,6 @@ +&DIR&/test.log { + create + compress + daily + rotate 1 +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/logrotate-3.20.1/test/test-config.93.in new/logrotate-3.21.0/test/test-config.93.in --- old/logrotate-3.20.1/test/test-config.93.in 1970-01-01 01:00:00.000000000 +0100 +++ new/logrotate-3.21.0/test/test-config.93.in 2022-12-13 18:29:43.000000000 +0100 @@ -0,0 +1,7 @@ +&DIR&/test.log { + rotate 2 + create + prerotate + sleep 2 + endscript +} ++++++ logrotate-all ++++++ #!/bin/sh set -eu configs= # Only read /usr/etc/logrotate.conf if /etc/logrotate.conf does not exist if ! [ -e /etc/logrotate.conf ]; then configs="$configs /usr/etc/logrotate.conf" else configs="$configs /etc/logrotate.conf" fi # Then read in all of {/usr,}/etc/logrotate.d/*, with /etc/ overriding /usr/etc/. dirs= [ -d /usr/etc/logrotate.d ] && dirs="/usr/etc/logrotate.d" [ -d /etc/logrotate.d ] && dirs="$dirs /etc/logrotate.d" if [ -n "$dirs" ]; then for confname in $(find $dirs -type f -printf "%P\n" | sort -u); do if [ -e "/etc/logrotate.d/$confname" ]; then configs="$configs /etc/logrotate.d/$confname" else configs="$configs /usr/etc/logrotate.d/$confname" fi done fi exec /usr/sbin/logrotate $configs ++++++ logrotate.service ++++++ --- /var/tmp/diff_new_pack.oTLLpc/_old 2023-01-26 14:03:07.529804832 +0100 +++ /var/tmp/diff_new_pack.oTLLpc/_new 2023-01-26 14:03:07.533804857 +0100 @@ -6,15 +6,7 @@ [Service] Type=oneshot -ExecStartPre=/bin/sh -c "/usr/bin/systemctl set-environment etc_conf=" ; \ - /bin/sh -c "if [ -f /etc/logrotate.conf ]; then /usr/bin/systemctl set-environment etc_conf=/etc/logrotate.conf; fi" ; \ - /bin/sh -c "/usr/bin/systemctl set-environment usr_etc_conf=" ; \ - /bin/sh -c "if [ -f /usr/etc/logrotate.conf ]; then /usr/bin/systemctl set-environment usr_etc_conf=/usr/etc/logrotate.conf; fi" ; \ - /bin/sh -c "/usr/bin/systemctl set-environment usr_etc_dir=" ; \ - /bin/sh -c "if [ -d /usr/etc/logrotate.d ]; then /usr/bin/systemctl set-environment usr_etc_dir=/usr/etc/logrotate.d; fi" ; \ - /bin/sh -c "/usr/bin/systemctl set-environment etc_dir=" ; \ - /bin/sh -c "if [ -d /etc/logrotate.d ]; then /usr/bin/systemctl set-environment etc_dir=/etc/logrotate.d; fi" -ExecStart=/bin/sh -c "/usr/sbin/logrotate ${usr_etc_conf} ${etc_conf} ${etc_dir} ${usr_etc_dir}" +ExecStart=/usr/sbin/logrotate-all # performance options Nice=19