backport cups-synconclose.patch from upstream

Setting SyncOnClose is now doable via configure option.
This commit is contained in:
Zdenek Dohnal 2020-11-27 10:31:20 +01:00
parent b96b449a51
commit f6119ede15
2 changed files with 177 additions and 32 deletions

View File

@ -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 From 9c1dcee087eee3c57937a223df76757a61dfd046 Mon Sep 17 00:00:00 2001
--- cups-2.2.12/conf/cups-files.conf.in.synconclose 2019-08-16 00:35:30.000000000 +0200 From: Michael R Sweet <msweet@msweet.org>
+++ cups-2.2.12/conf/cups-files.conf.in 2019-08-19 09:58:14.646567949 +0200 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 @@ @@ -7,7 +7,7 @@
#FatalErrors @CUPS_FATAL_ERRORS@ #FatalErrors @CUPS_FATAL_ERRORS@
# Do we call fsync() after writing configuration or status files? # Do we call fsync() after writing configuration or status files?
-#SyncOnClose No -#SyncOnClose No
+#SyncOnClose Yes +#SyncOnClose @CUPS_SYNC_ON_CLOSE@
# Default user and group for filters/backends/helper programs; this cannot be # Default user and group for filters/backends/helper programs; this cannot be
# any user or group that resolves to ID 0 for security reasons... # 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 diff --git a/config-scripts/cups-defaults.m4 b/config-scripts/cups-defaults.m4
--- cups-2.2.12/doc/help/man-cups-files.conf.html.synconclose 2019-08-16 00:35:30.000000000 +0200 index b6051778d..df386b822 100644
+++ cups-2.2.12/doc/help/man-cups-files.conf.html 2019-08-19 09:58:14.646567949 +0200 --- a/config-scripts/cups-defaults.m4
@@ -150,7 +150,7 @@ The default is "/var/run/cups" or "/etc/ +++ b/config-scripts/cups-defaults.m4
<dd style="margin-left: 5.0em">Specifies whether the scheduler calls @@ -137,6 +137,16 @@ else
<b>fsync</b>(2) fi
after writing configuration or state files. AC_SUBST(CUPS_PAGE_LOG_FORMAT)
-The default is "No".
+The default is "Yes". +dnl Default SyncOnClose
<dt><a name="SystemGroup"></a><b>SystemGroup </b><i>group-name </i>[ ... <i>group-name</i> ] +AC_ARG_ENABLE(sync_on_close, [ --enable-sync-on-close enable SyncOnClose (off by default)])
<dd style="margin-left: 5.0em">Specifies the group(s) to use for <i>@SYSTEM</i> group authentication. +if test "x$enable_sync_on_close" = xyes; then
The default contains "admin", "lpadmin", "root", "sys", and/or "system". + CUPS_SYNC_ON_CLOSE="Yes"
diff -up cups-2.2.12/man/cups-files.conf.man.in.synconclose cups-2.2.12/man/cups-files.conf.man.in + AC_DEFINE(CUPS_DEFAULT_SYNC_ON_CLOSE)
--- cups-2.2.12/man/cups-files.conf.5.synconclose 2019-08-16 00:35:30.000000000 +0200 +else
+++ cups-2.2.12/man/cups-files.conf.5 2019-08-19 09:58:14.646567949 +0200 + CUPS_SYNC_ON_CLOSE="No"
@@ -214,7 +214,7 @@ The default is "/var/run/cups" or "/etc/ +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 Specifies whether the scheduler calls
.BR fsync (2) .BR fsync (2)
after writing configuration or state files. after writing configuration or state files.
-The default is "No". -The default is "No".
+The default is "Yes".
.\"#SystemGroup .\"#SystemGroup
.TP 5 .TP 5
\fBSystemGroup \fIgroup-name \fR[ ... \fIgroup-name\fR ] \fBSystemGroup \fIgroup-name \fR[ ... \fIgroup-name\fR ]
diff -up cups-2.2.12/scheduler/conf.c.synconclose cups-2.2.12/scheduler/conf.c diff --git a/scheduler/conf.c b/scheduler/conf.c
--- cups-2.2.12/scheduler/conf.c.synconclose 2019-08-19 09:58:14.647567941 +0200 index 839cd6866..8dfebe546 100644
+++ cups-2.2.12/scheduler/conf.c 2019-08-19 09:59:36.066927455 +0200 --- a/scheduler/conf.c
@@ -735,7 +735,7 @@ cupsdReadConfiguration(void) +++ b/scheduler/conf.c
@@ -735,7 +735,11 @@ cupsdReadConfiguration(void)
RootCertDuration = 300; RootCertDuration = 300;
Sandboxing = CUPSD_SANDBOXING_STRICT; Sandboxing = CUPSD_SANDBOXING_STRICT;
StrictConformance = FALSE; StrictConformance = FALSE;
- SyncOnClose = FALSE; +#ifdef CUPS_DEFAULT_SYNC_ON_CLOSE
+ SyncOnClose = TRUE; + SyncOnClose = TRUE;
+#else
SyncOnClose = FALSE;
+#endif /* CUPS_DEFAULT_SYNC_ON_CLOSE */
Timeout = 900; Timeout = 900;
WebInterface = CUPS_DEFAULT_WEBIF; 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?
*/

View File

@ -53,11 +53,9 @@ Patch9: cups-freebind.patch
Patch10: cups-ipp-multifile.patch Patch10: cups-ipp-multifile.patch
# prolongs web ui timeout # prolongs web ui timeout
Patch11: cups-web-devices-timeout.patch 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 # failover backend for implementing failover functionality
# TODO: move it to the cups-filters upstream # TODO: move it to the cups-filters upstream
Patch13: cups-failover-backend.patch Patch12: cups-failover-backend.patch
%if %{lspp} %if %{lspp}
# selinux and audit enablement for CUPS - needs work and CUPS upstream wants # 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 Patch1012: cups-ypbind.patch
# https://github.com/OpenPrinting/cups/pull/31 # https://github.com/OpenPrinting/cups/pull/31
Patch1013: 0001-Add-Requires-cups.socket-to-cups.service-to-make-sur.patch 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 ##### Patches removed because IMHO they aren't no longer needed
##### but still I'll leave them in git in case their removal ##### 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 %patch10 -p1 -b .ipp-multifile
# Increase web interface get-devices timeout to 10s (bug #996664). # Increase web interface get-devices timeout to 10s (bug #996664).
%patch11 -p1 -b .web-devices-timeout %patch11 -p1 -b .web-devices-timeout
# Set the default for SyncOnClose to Yes.
%patch12 -p1 -b .synconclose
# Add failover backend (bug #1689209) # Add failover backend (bug #1689209)
%patch13 -p1 -b .failover %patch12 -p1 -b .failover
%if %{lspp} %if %{lspp}
# LSPP support. # LSPP support.
@ -317,6 +315,8 @@ to CUPS daemon. This solution will substitute printer drivers and raw queues in
%patch1012 -p1 -b .ypbind %patch1012 -p1 -b .ypbind
# https://github.com/OpenPrinting/cups/pull/31 # https://github.com/OpenPrinting/cups/pull/31
%patch1013 -p1 -b .require-socket %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). # 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 \ --with-access-log-level=actions \
--enable-page-logging \ --enable-page-logging \
--with-rundir=%{_rundir}/cups \ --with-rundir=%{_rundir}/cups \
--enable-sync-on-close \
localedir=%{_datadir}/locale localedir=%{_datadir}/locale
# If we got this far, all prerequisite libraries must be here. # 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 %%post scriptlet - it is covered by drop-in now
- remove cups-filter-debug.patch - remove cups-filter-debug.patch
- remove cups-dymo-deviceid.patch - remove cups-dymo-deviceid.patch
- backport cups-synconclose.patch from upstream
* Thu Nov 26 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.3.3-20 * Thu Nov 26 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.3.3-20
- remove downstream autostart patch - use systemd drop-in - remove downstream autostart patch - use systemd drop-in