diff --git a/cups-synconclose.patch b/cups-synconclose.patch index 380be94..3f7d122 100644 --- a/cups-synconclose.patch +++ b/cups-synconclose.patch @@ -1,48 +1,191 @@ -diff -up cups-2.2.12/conf/cups-files.conf.in.synconclose cups-2.2.12/conf/cups-files.conf.in ---- cups-2.2.12/conf/cups-files.conf.in.synconclose 2019-08-16 00:35:30.000000000 +0200 -+++ cups-2.2.12/conf/cups-files.conf.in 2019-08-19 09:58:14.646567949 +0200 +From 9c1dcee087eee3c57937a223df76757a61dfd046 Mon Sep 17 00:00:00 2001 +From: Michael R Sweet +Date: Sat, 14 Nov 2020 09:58:12 -0500 +Subject: [PATCH] Add --enable-sync-on-close configure option (Issue #37) + +--- + CHANGES-OPENPRINTING.md | 1 + + conf/cups-files.conf.in | 2 +- + config-scripts/cups-defaults.m4 | 10 ++++++++++ + config.h.in | 7 +++++++ + configure | 17 +++++++++++++++++ + man/cups-files.conf.5 | 3 +-- + scheduler/conf.c | 4 ++++ + vcnet/config.h | 7 +++++++ + xcode/config.h | 7 +++++++ + 9 files changed, 55 insertions(+), 3 deletions(-) + +diff --git a/conf/cups-files.conf.in b/conf/cups-files.conf.in +index 4a78ba615..af11fcce6 100644 +--- a/conf/cups-files.conf.in ++++ b/conf/cups-files.conf.in @@ -7,7 +7,7 @@ #FatalErrors @CUPS_FATAL_ERRORS@ # Do we call fsync() after writing configuration or status files? -#SyncOnClose No -+#SyncOnClose Yes ++#SyncOnClose @CUPS_SYNC_ON_CLOSE@ # Default user and group for filters/backends/helper programs; this cannot be # any user or group that resolves to ID 0 for security reasons... -diff -up cups-2.2.12/doc/help/man-cups-files.conf.html.synconclose cups-2.2.12/doc/help/man-cups-files.conf.html ---- cups-2.2.12/doc/help/man-cups-files.conf.html.synconclose 2019-08-16 00:35:30.000000000 +0200 -+++ cups-2.2.12/doc/help/man-cups-files.conf.html 2019-08-19 09:58:14.646567949 +0200 -@@ -150,7 +150,7 @@ The default is "/var/run/cups" or "/etc/ -
Specifies whether the scheduler calls - fsync(2) - after writing configuration or state files. --The default is "No". -+The default is "Yes". -
SystemGroup group-name [ ... group-name ] -
Specifies the group(s) to use for @SYSTEM group authentication. - The default contains "admin", "lpadmin", "root", "sys", and/or "system". -diff -up cups-2.2.12/man/cups-files.conf.man.in.synconclose cups-2.2.12/man/cups-files.conf.man.in ---- cups-2.2.12/man/cups-files.conf.5.synconclose 2019-08-16 00:35:30.000000000 +0200 -+++ cups-2.2.12/man/cups-files.conf.5 2019-08-19 09:58:14.646567949 +0200 -@@ -214,7 +214,7 @@ The default is "/var/run/cups" or "/etc/ +diff --git a/config-scripts/cups-defaults.m4 b/config-scripts/cups-defaults.m4 +index b6051778d..df386b822 100644 +--- a/config-scripts/cups-defaults.m4 ++++ b/config-scripts/cups-defaults.m4 +@@ -137,6 +137,16 @@ else + fi + AC_SUBST(CUPS_PAGE_LOG_FORMAT) + ++dnl Default SyncOnClose ++AC_ARG_ENABLE(sync_on_close, [ --enable-sync-on-close enable SyncOnClose (off by default)]) ++if test "x$enable_sync_on_close" = xyes; then ++ CUPS_SYNC_ON_CLOSE="Yes" ++ AC_DEFINE(CUPS_DEFAULT_SYNC_ON_CLOSE) ++else ++ CUPS_SYNC_ON_CLOSE="No" ++fi ++AC_SUBST(CUPS_SYNC_ON_CLOSE) ++ + dnl Default Browsing + AC_ARG_ENABLE(browsing, [ --disable-browsing disable Browsing by default]) + if test "x$enable_browsing" = xno; then +diff --git a/config.h.in b/config.h.in +index 6a197ecc5..6343e6dd0 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -101,6 +101,13 @@ + #define CUPS_DEFAULT_MAX_COPIES 9999 + + ++/* ++ * Default SyncOnClose value... ++ */ ++ ++#undef CUPS_DEFAULT_SYNC_ON_CLOSE ++ ++ + /* + * Do we have domain socket support, and if so what is the default one? + */ +diff --git a/configure b/configure +index a7e7a825e..ee25f1f24 100755 +--- a/configure ++++ b/configure +@@ -642,6 +642,7 @@ CUPS_USER + CUPS_DEFAULT_SHARED + CUPS_BROWSE_LOCAL_PROTOCOLS + CUPS_BROWSING ++CUPS_SYNC_ON_CLOSE + CUPS_PAGE_LOG_FORMAT + CUPS_ACCESS_LOG_LEVEL + CUPS_LOG_LEVEL +@@ -903,6 +904,7 @@ with_fatal_errors + with_log_level + with_access_log_level + enable_page_logging ++enable_sync_on_close + enable_browsing + with_local_protocols + enable_default_shared +@@ -1573,6 +1575,7 @@ Optional Features: + --disable-systemd disable systemd support + --enable-upstart enable upstart support + --enable-page-logging enable page_log by default ++ --enable-sync-on-close enable SyncOnClose (off by default) + --disable-browsing disable Browsing by default + --disable-default-shared + disable DefaultShared by default +@@ -9459,6 +9462,20 @@ else + fi + + ++# Check whether --enable-sync_on_close was given. ++if test "${enable_sync_on_close+set}" = set; then : ++ enableval=$enable_sync_on_close; ++fi ++ ++if test "x$enable_sync_on_close" = xyes; then ++ CUPS_SYNC_ON_CLOSE="Yes" ++ $as_echo "#define CUPS_DEFAULT_SYNC_ON_CLOSE 1" >>confdefs.h ++ ++else ++ CUPS_SYNC_ON_CLOSE="No" ++fi ++ ++ + # Check whether --enable-browsing was given. + if test "${enable_browsing+set}" = set; then : + enableval=$enable_browsing; +diff --git a/man/cups-files.conf.5 b/man/cups-files.conf.5 +index b451e2f92..d9b9a63e3 100644 +--- a/man/cups-files.conf.5 ++++ b/man/cups-files.conf.5 +@@ -7,7 +7,7 @@ + .\" Licensed under Apache License v2.0. See the file "LICENSE" for more + .\" information. + .\" +-.TH cups-files.conf 5 "CUPS" "26 April 2019" "Apple Inc." ++.TH cups-files.conf 5 "CUPS" "14 November 2020" "Apple Inc." + .SH NAME + cups\-files.conf \- file and directory configuration file for cups + .SH DESCRIPTION +@@ -211,7 +211,6 @@ The default is "/var/run/cups" or "/etc/cups" depending on the platform. Specifies whether the scheduler calls .BR fsync (2) after writing configuration or state files. -The default is "No". -+The default is "Yes". .\"#SystemGroup .TP 5 \fBSystemGroup \fIgroup-name \fR[ ... \fIgroup-name\fR ] -diff -up cups-2.2.12/scheduler/conf.c.synconclose cups-2.2.12/scheduler/conf.c ---- cups-2.2.12/scheduler/conf.c.synconclose 2019-08-19 09:58:14.647567941 +0200 -+++ cups-2.2.12/scheduler/conf.c 2019-08-19 09:59:36.066927455 +0200 -@@ -735,7 +735,7 @@ cupsdReadConfiguration(void) +diff --git a/scheduler/conf.c b/scheduler/conf.c +index 839cd6866..8dfebe546 100644 +--- a/scheduler/conf.c ++++ b/scheduler/conf.c +@@ -735,7 +735,11 @@ cupsdReadConfiguration(void) RootCertDuration = 300; Sandboxing = CUPSD_SANDBOXING_STRICT; StrictConformance = FALSE; -- SyncOnClose = FALSE; ++#ifdef CUPS_DEFAULT_SYNC_ON_CLOSE + SyncOnClose = TRUE; ++#else + SyncOnClose = FALSE; ++#endif /* CUPS_DEFAULT_SYNC_ON_CLOSE */ Timeout = 900; WebInterface = CUPS_DEFAULT_WEBIF; +diff --git a/vcnet/config.h b/vcnet/config.h +index 5e105c826..05d36dcfc 100644 +--- a/vcnet/config.h ++++ b/vcnet/config.h +@@ -181,6 +181,13 @@ typedef unsigned long useconds_t; + #define CUPS_DEFAULT_MAX_COPIES 9999 + + ++/* ++ * Default SyncOnClose value... ++ */ ++ ++/* #undef CUPS_DEFAULT_SYNC_ON_CLOSE */ ++ ++ + /* + * Do we have domain socket support, and if so what is the default one? + */ +diff --git a/xcode/config.h b/xcode/config.h +index 7a3f98aa9..5f8117467 100644 +--- a/xcode/config.h ++++ b/xcode/config.h +@@ -102,6 +102,13 @@ + #define CUPS_DEFAULT_MAX_COPIES 9999 + + ++/* ++ * Default SyncOnClose value... ++ */ ++ ++/* #undef CUPS_DEFAULT_SYNC_ON_CLOSE */ ++ ++ + /* + * Do we have domain socket support, and if so what is the default one? + */ diff --git a/cups.spec b/cups.spec index 5c84e37..b618d4b 100644 --- a/cups.spec +++ b/cups.spec @@ -53,11 +53,9 @@ Patch9: cups-freebind.patch Patch10: cups-ipp-multifile.patch # prolongs web ui timeout Patch11: cups-web-devices-timeout.patch -# needs to be set to Yes to avoid race conditions -Patch12: cups-synconclose.patch # failover backend for implementing failover functionality # TODO: move it to the cups-filters upstream -Patch13: cups-failover-backend.patch +Patch12: cups-failover-backend.patch %if %{lspp} # selinux and audit enablement for CUPS - needs work and CUPS upstream wants @@ -112,6 +110,8 @@ Patch1011: cups-systemd-socket.patch Patch1012: cups-ypbind.patch # https://github.com/OpenPrinting/cups/pull/31 Patch1013: 0001-Add-Requires-cups.socket-to-cups.service-to-make-sur.patch +# needs to be set to Yes to avoid race conditions +Patch1014: cups-synconclose.patch ##### Patches removed because IMHO they aren't no longer needed ##### but still I'll leave them in git in case their removal @@ -286,10 +286,8 @@ to CUPS daemon. This solution will substitute printer drivers and raw queues in %patch10 -p1 -b .ipp-multifile # Increase web interface get-devices timeout to 10s (bug #996664). %patch11 -p1 -b .web-devices-timeout -# Set the default for SyncOnClose to Yes. -%patch12 -p1 -b .synconclose # Add failover backend (bug #1689209) -%patch13 -p1 -b .failover +%patch12 -p1 -b .failover %if %{lspp} # LSPP support. @@ -317,6 +315,8 @@ to CUPS daemon. This solution will substitute printer drivers and raw queues in %patch1012 -p1 -b .ypbind # https://github.com/OpenPrinting/cups/pull/31 %patch1013 -p1 -b .require-socket +# Set the default for SyncOnClose to Yes. +%patch1014 -p1 -b .synconclose # Log to the system journal by default (bug #1078781, bug #1519331). @@ -357,6 +357,7 @@ export CFLAGS="$RPM_OPT_FLAGS -fstack-protector-all -DLDAP_DEPRECATED=1" --with-access-log-level=actions \ --enable-page-logging \ --with-rundir=%{_rundir}/cups \ + --enable-sync-on-close \ localedir=%{_datadir}/locale # If we got this far, all prerequisite libraries must be here. @@ -721,6 +722,7 @@ rm -f %{cups_serverbin}/backend/smb - remove %%post scriptlet - it is covered by drop-in now - remove cups-filter-debug.patch - remove cups-dymo-deviceid.patch +- backport cups-synconclose.patch from upstream * Thu Nov 26 2020 Zdenek Dohnal - 1:2.3.3-20 - remove downstream autostart patch - use systemd drop-in