diff --git a/logrotate-3.20.0-man_logrotate.patch b/logrotate-3.20.0-man_logrotate.patch deleted file mode 100644 index 537d8e9..0000000 --- a/logrotate-3.20.0-man_logrotate.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff -ur logrotate-3.20.0.orig/logrotate.8.in logrotate-3.20.0/logrotate.8.in ---- logrotate-3.20.0.orig/logrotate.8.in 2022-03-31 14:00:36.000000000 +0200 -+++ logrotate-3.20.0/logrotate.8.in 2022-05-25 15:40:21.015424608 +0200 -@@ -48,6 +48,17 @@ - is given on the command line, every file in that directory is used as - a config file. - .P -+If \fBlogrotate\fR is called via \fBsystemd\fR(1), following order of -+parsed config files is defined in the \fIlogrotate.service\fR file: -+.TS -+tab(:); -+l l l. -+\fI/usr/etc/logrotate.conf\fR:Default configuration file defined by the vendor. -+\fI/usr/etc/logrotate.d/*\fR:Directory for additional configuration files defined by the vendor. -+\fI/etc/logrotate.conf\fR:Default configuration file defined by the administrator. (optional) -+\fI/etc/logrotate.d/*\fR:Directory for additional configuration files defined by the administrator. (optional) -+.TE -+.P - If no command line arguments are given, \fBlogrotate\fR will print - version and copyright information, along with a short usage summary. If - any errors occur while rotating logs, \fBlogrotate\fR will exit with -@@ -752,7 +763,8 @@ - tab(:); - l l l. - \fI@STATE_FILE_PATH@\fR:Default state file. --\fI/etc/logrotate.conf\fR:Configuration options. -+\fI/usr/etc/logrotate.conf\fR:Configuration options defined by the vendor. -+\fI/etc/logrotate.conf\fR:Configuration options defined by the administrator. - .TE - - diff --git a/logrotate-vendor-dir.patch b/logrotate-vendor-dir.patch new file mode 100644 index 0000000..74fef08 --- /dev/null +++ b/logrotate-vendor-dir.patch @@ -0,0 +1,74 @@ +diff -Naur logrotate-3.20.1.org/config.c logrotate-3.20.1.patch/config.c +--- logrotate-3.20.1.org/config.c 2022-05-24 17:20:14.000000000 +0200 ++++ logrotate-3.20.1.patch/config.c 2022-09-14 12:48:02.293003630 +0200 +@@ -1847,11 +1847,19 @@ + for (k = 0; k < log->numFiles; k++) { + if (!strcmp(log->files[k], + globResult.gl_pathv[glob_count])) { +- message(MESS_ERROR, ++#ifdef ENABLE_VENDORDIR ++ message(MESS_DEBUG, ++ "%s:%d duplicate log entry for %s --> ignoring\n", ++ configFile, lineNum, ++ globResult.gl_pathv[glob_count]); ++ state = STATE_SKIP_CONFIG; ++#else ++ message(MESS_ERROR, + "%s:%d duplicate log entry for %s\n", + configFile, lineNum, + globResult.gl_pathv[glob_count]); +- logerror = 1; ++ logerror = 1; ++#endif + goto duperror; + } + } +diff -Naur logrotate-3.20.1.org/configure.ac logrotate-3.20.1.patch/configure.ac +--- logrotate-3.20.1.org/configure.ac 2021-07-27 10:25:23.000000000 +0200 ++++ logrotate-3.20.1.patch/configure.ac 2022-09-14 13:49:13.052981225 +0200 +@@ -58,6 +58,14 @@ + AS_IF([test "$ac_cv_lib_acl_acl_get_file" = yes], + echo "1" > ./test/test.ACL; WITH_ACL="yes";, echo "0" > ./test/test.ACL;) + ++AC_ARG_ENABLE([vendordir], ++ AS_HELP_STRING([--enable-vendordir],[ignore redefined logs; prefering user defined logs defintions])) ++ ++if test x"$enable_vendordir" = x"yes" ; then ++ AC_DEFINE([ENABLE_VENDORDIR],, ++ [ignore redefined logs; prefering user defined logs defintions]) ++fi ++ + DEFAULT_MAIL_COMMAND="/bin/mail" + COMPRESS_COMMAND="/bin/gzip" + UNCOMPRESS_COMMAND="/bin/gunzip" +diff -Naur logrotate-3.20.1.org/logrotate.8.in logrotate-3.20.1.patch/logrotate.8.in +--- logrotate-3.20.1.org/logrotate.8.in 2022-03-31 14:00:36.000000000 +0200 ++++ logrotate-3.20.1.patch/logrotate.8.in 2022-09-14 13:06:32.116996856 +0200 +@@ -48,6 +48,17 @@ + is given on the command line, every file in that directory is used as + a config file. + .P ++If \fBlogrotate\fR is called via \fBsystemd\fR(1), following order of ++parsed config files is defined in the \fIlogrotate.service\fR file: ++.TS ++tab(:); ++l l l. ++\fI/usr/etc/logrotate.conf\fR:Default configuration file defined by the vendor. ++\fI/usr/etc/logrotate.d/*\fR:Directory for additional configuration files defined by the vendor. ++\fI/etc/logrotate.conf\fR:Default configuration file defined by the administrator. (optional) ++\fI/etc/logrotate.d/*\fR:Directory for additional configuration files defined by the administrator. (optional) ++.TE ++.P + If no command line arguments are given, \fBlogrotate\fR will print + version and copyright information, along with a short usage summary. If + any errors occur while rotating logs, \fBlogrotate\fR will exit with +@@ -752,7 +763,8 @@ + tab(:); + l l l. + \fI@STATE_FILE_PATH@\fR:Default state file. +-\fI/etc/logrotate.conf\fR:Configuration options. ++\fI/usr/etc/logrotate.conf\fR:Configuration options defined by the vendor. ++\fI/etc/logrotate.conf\fR:Configuration options defined by the administrator. + .TE + + diff --git a/logrotate.changes b/logrotate.changes index 035b557..108c63b 100644 --- a/logrotate.changes +++ b/logrotate.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Sep 14 11:15:55 UTC 2022 - Stefan Schubert + +- Ignoring vendor logs settings in /usr/etc/logrotate.d if they + have already been defined by the the admin in the /etc/logrotate.d + directory (bsc#1173319). + ------------------------------------------------------------------- Mon Jun 20 12:06:17 UTC 2022 - Stefan Schubert diff --git a/logrotate.default b/logrotate.default index 481ee46..5877043 100644 --- a/logrotate.default +++ b/logrotate.default @@ -19,5 +19,5 @@ compress compresscmd /usr/bin/xz uncompresscmd /usr/bin/xzdec -# RPM packages drop log rotation information into this directory -include /usr/etc/logrotate.d +# Additinal location (directory or file) for rotation information +# include diff --git a/logrotate.service b/logrotate.service index dff101e..9a4acaa 100644 --- a/logrotate.service +++ b/logrotate.service @@ -8,9 +8,13 @@ ConditionACPower=true 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/logrotate.conf ${etc_conf} ${etc_dir}" +ExecStart=/bin/sh -c "/usr/sbin/logrotate ${usr_etc_conf} ${etc_conf} ${etc_dir} ${usr_etc_dir}" # performance options Nice=19 diff --git a/logrotate.spec b/logrotate.spec index 4c68fa3..9a91f66 100644 --- a/logrotate.spec +++ b/logrotate.spec @@ -32,7 +32,7 @@ Source2: logrotate.default Source3: logrotate.service Source10: https://github.com/%{name}/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz.asc Source100: %{name}-rpmlintrc -Patch0: logrotate-3.20.0-man_logrotate.patch +Patch0: logrotate-vendor-dir.patch BuildRequires: acl BuildRequires: automake BuildRequires: libacl-devel @@ -60,7 +60,8 @@ autoreconf -f -i %configure \ --disable-silent-rules \ --with-state-file-path=%{_localstatedir}/lib/misc/logrotate.status \ - --disable-werror + --disable-werror \ + --enable-vendordir %make_build %check