logrotate/logrotate-vendor-dir.patch
David Anes 7fe931ced3 Accepting request 1003701 from home:schubi2
- 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).

OBS-URL: https://build.opensuse.org/request/show/1003701
OBS-URL: https://build.opensuse.org/package/show/Base:System/logrotate?expand=0&rev=103
2022-09-15 17:05:18 +00:00

75 lines
3.5 KiB
Diff

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