diff --git a/cups-moved-logs.patch b/cups-moved-logs.patch new file mode 100644 index 0000000..e0b9b7e --- /dev/null +++ b/cups-moved-logs.patch @@ -0,0 +1,21 @@ +diff -up cups-2.2.6/scheduler/log.c.moved-logs cups-2.2.6/scheduler/log.c +--- cups-2.2.6/scheduler/log.c.moved-logs 2018-02-06 14:24:32.857387592 +0100 ++++ cups-2.2.6/scheduler/log.c 2018-02-06 14:24:32.917387049 +0100 +@@ -979,7 +979,7 @@ cupsdLogPage(cupsd_job_t *job, /* I - J + *bufptr = '\0'; + + #ifdef HAVE_SYSTEMD_SD_JOURNAL_H +- if (!strcmp(ErrorLog, "syslog")) ++ if (!strcmp(PageLog, "syslog")) + { + static const char * const job_states[] = + { /* job-state strings */ +@@ -1176,7 +1176,7 @@ cupsdLogRequest(cupsd_client_t *con, /* + } + + #ifdef HAVE_SYSTEMD_SD_JOURNAL_H +- if (!strcmp(ErrorLog, "syslog")) ++ if (!strcmp(AccessLog, "syslog")) + { + sd_journal_print(LOG_INFO, "REQUEST %s - %s \"%s %s HTTP/%d.%d\" %d " CUPS_LLFMT " %s %s", con->http->hostname, con->username[0] != '\0' ? con->username : "-", states[con->operation], _httpEncodeURI(temp, con->uri, sizeof(temp)), con->http->version / 100, con->http->version % 100, code, CUPS_LLCAST con->bytes, con->request ? ippOpString(con->request->request.op.operation_id) : "-", con->response ? ippErrorString(con->response->request.status.status_code) : "-"); + return (1); diff --git a/cups.spec b/cups.spec index f94f09c..ef12194 100644 --- a/cups.spec +++ b/cups.spec @@ -15,7 +15,7 @@ Summary: CUPS printing system Name: cups Epoch: 1 Version: 2.2.6 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv2 Url: http://www.cups.org/ Source0: https://github.com/apple/cups/releases/download/v%{VERSION}/cups-%{VERSION}-source.tar.gz @@ -61,6 +61,7 @@ Patch35: cups-ipp-multifile.patch Patch36: cups-web-devices-timeout.patch Patch37: cups-synconclose.patch Patch38: cups-ypbind.patch +Patch39: cups-moved-logs.patch Patch100: cups-lspp.patch @@ -263,10 +264,15 @@ Sends IPP requests to the specified URI and tests and/or displays the results. %patch100 -p1 -b .lspp %endif +# Move log files into journal (bug #1519331) +%patch39 -p1 -b .moved-logs + sed -i -e '1iMaxLogSize 0' conf/cupsd.conf.in -# Log to the system journal by default (bug #1078781). +# Log to the system journal by default (bug #1078781, bug #1519331). sed -i -e 's,^ErrorLog .*$,ErrorLog syslog,' conf/cups-files.conf.in +sed -i -e 's,^AccessLog .*$,AccessLog syslog,' conf/cups-files.conf.in +sed -i -e 's,^PageLog .*,PageLog syslog,' conf/cups-files.conf.in # Add comment text mentioning syslog is systemd journal (bug #1358589) sed -i -e 's,\"syslog\",\"syslog\" \(syslog means systemd journal by default\),' conf/cups-files.conf.in @@ -303,6 +309,8 @@ export CFLAGS="$RPM_OPT_FLAGS -fstack-protector-all -DLDAP_DEPRECATED=1" --enable-gnutls \ --enable-webif \ --with-xinetd=no \ + --with-access-log-level=actions \ + --enable-page-logging \ localedir=%{_datadir}/locale # If we got this far, all prerequisite libraries must be here. @@ -414,9 +422,20 @@ for keyword in PageLogFormat; do /bin/sed -i -e "s,^$keyword,#$keyword,i" "$FILE" || : done -# We've been using 'journal' name in our journal.patch for couple releases, -# but upstream decided not to use 'journal', but 'syslog'. -sed -i -e 's,^ErrorLog journal,ErrorLog syslog,' %{_sysconfdir}/cups/cups-files.conf +# Because of moving logs to journal, we need to create placeholder files +# at /var/log/cups for users, whose are going to install CUPS on new OS +# machine with info message +%if 0%{?rhel} > 7 || 0%{?fedora} > 27 +message="This CUPS log has been moved into journal by default unless changes have been made in /etc/cups/cups-files.conf. Log messages can be got by \"$ journalctl -u cups -e\"" +for i in error_log access_log page_log +do + if [ ! -f %{_localstatedir}/log/cups/$i ] + then + %{_bindir}/touch %{_localstatedir}/log/cups/$i || : + %{_bindir}/echo $message >> %{_localstatedir}/log/cups/$i || : + fi +done +%endif exit 0 @@ -477,6 +496,20 @@ exit 0 [ $2 = 0 ] || exit 0 rm -f %{cups_serverbin}/backend/smb +# This trigger is for putting info message to /var/log/cups files, if user is +# going to update to newer OS +%if 0%{?rhel} > 7 || 0%{?fedora} > 27 +%triggerin -- cups < 2.2.4-7 +for i in error_log access_log page_log +do + if [ -f %{_localstatedir}/log/cups/$i ] + then + %{_bindir}/echo $message >> %{_localstatedir}/log/cups/$i || : + fi +done +exit 0 +%endif + %files -f %{name}.lang %doc README.md CREDITS.md CHANGES.md %dir %attr(0755,root,lp) %{_sysconfdir}/cups @@ -622,6 +655,9 @@ rm -f %{cups_serverbin}/backend/smb %{_mandir}/man5/ipptoolfile.5.gz %changelog +* Tue Feb 20 2018 Zdenek Dohnal - 1:2.2.6-7 +- 1499261 - Move log files into journal + * Mon Feb 19 2018 Zdenek Dohnal - 1:2.2.6-6 - gcc and gcc-c++ is not in buildroot by default now