This commit is contained in:
Zdenek Dohnal 2018-12-13 16:06:47 +01:00
parent 8ab2c03a62
commit 6239c46f66
5 changed files with 102 additions and 21 deletions

1
.gitignore vendored
View File

@ -86,3 +86,4 @@
/cups-filters-1.20.2.tar.xz
/cups-filters-1.20.3.tar.xz
/cups-filters-1.21.2.tar.xz
/cups-filters-1.21.5.tar.xz

View File

@ -0,0 +1,88 @@
diff --git a/utils/cups-browsed.c b/utils/cups-browsed.c
index ee361d9a..02de23d1 100644
--- a/utils/cups-browsed.c
+++ b/utils/cups-browsed.c
@@ -4476,15 +4476,6 @@ gboolean update_cups_queues(gpointer unused) {
current_time = time(NULL);
timeout_reached = 0;
- /* cups-browsed tried to add this print queue unsuccessfully for too
- many times due to timeouts - Skip print queue creation for this one */
- if (p->timeouted >= HttpMaxRetries)
- {
- fprintf(stderr, "Max number of retries (%d) for creating print queue %s reached, skipping it.\n",
- HttpMaxRetries, p->queue_name);
- continue;
- }
-
/* terminating means we have received a signal and should shut down.
in_shutdown means we have exited the main loop.
update_cups_queues() is called after having exited the main loop
@@ -4686,6 +4677,14 @@ gboolean update_cups_queues(gpointer unused) {
if (p->timeout > current_time)
break;
+ /* cups-browsed tried to add this print queue unsuccessfully for too
+ many times due to timeouts - Skip print queue creation for this one */
+ if (p->timeouted >= HttpMaxRetries) {
+ fprintf(stderr, "Max number of retries (%d) for creating print queue %s reached, skipping it.\n",
+ HttpMaxRetries, p->queue_name);
+ continue;
+ }
+
debug_printf("Creating/Updating CUPS queue %s\n",
p->queue_name);
@@ -5477,6 +5476,24 @@ gboolean update_cups_queues(gpointer unused) {
} else
p->timeout = (time_t) -1;
+ /* Check if an HTTP timeout happened during the print queue creation
+ If it does - increment p->timeouted and set status to TO_BE_CREATED
+ because the creation can fall through the process, have state changed to
+ STATUS_CONFIRMED and experience the timeout */
+ /* If no timeout has happened, clear p->timeouted */
+ if (timeout_reached == 1) {
+ fprintf(stderr, "Timeout happened during creation of the queue %s, turn on DebugLogging for more info.\n", p->queue_name);
+ p->timeouted ++;
+ debug_printf("The queue %s already timeouted %d times in a row.\n",
+ p->queue_name, p->timeouted);
+ p->status = STATUS_TO_BE_CREATED;
+ p->timeout = current_time + TIMEOUT_RETRY;
+ } else if (p->timeouted != 0) {
+ debug_printf("Creating the queue %s went smoothly after %d timeouts.\n",
+ p->queue_name, p->timeouted);
+ p->timeouted = 0;
+ }
+
p->no_autosave = 0;
break;
@@ -5496,27 +5513,6 @@ gboolean update_cups_queues(gpointer unused) {
break;
}
-
- /* Check if an HTTP timeout happened during the print queue creation
- If it does - increment p->timeouted and set status to TO_BE_CREATED
- because the creation can fall through the process, have state changed to
- STATUS_CONFIRMED and experience the timeout */
- /* If no timeout has happened, clear p->timeouted */
- if (timeout_reached == 1)
- {
- fprintf(stderr, "Timeout happened during creating the queue %s, turn on DebugLogging for more info.\n", p->queue_name);
- p->timeouted ++;
-
- debug_printf("The queue %s already timeouted %d times in a row.\n",
- p->queue_name, p->timeouted);
- p->status = STATUS_TO_BE_CREATED;
- }
- else if (p->timeouted != 0)
- {
- debug_printf("Creating the queue %s went smoothly after %d timeouts.\n",
- p->queue_name, p->timeouted);
- p->timeouted = 0;
- }
}
log_all_printers();

View File

@ -1,11 +0,0 @@
diff -up cups-filters-1.20.3/filter/foomatic-rip/foomaticrip.c.cleareof cups-filters-1.20.3/filter/foomatic-rip/foomaticrip.c
--- cups-filters-1.20.3/filter/foomatic-rip/foomaticrip.c.cleareof 2018-09-21 13:38:05.882666106 +0200
+++ cups-filters-1.20.3/filter/foomatic-rip/foomaticrip.c 2018-09-21 13:38:55.330277816 +0200
@@ -663,6 +663,7 @@ int print_file(const char *filename, int
rip_die(EXIT_PRNERR_NORETRY_BAD_SETTINGS,
"Couldn't dup stdout of pdf-to-ps\n");
+ clearerr(stdin);
ret = print_file("<STDIN>", 0);
wait_for_process(renderer_pid);

View File

@ -3,8 +3,8 @@
Summary: OpenPrinting CUPS filters and backends
Name: cups-filters
Version: 1.21.2
Release: 4%{?dist}
Version: 1.21.5
Release: 1%{?dist}
# For a breakdown of the licensing, see COPYING file
# GPLv2: filters: commandto*, imagetoraster, pdftops, rasterto*,
@ -21,14 +21,14 @@ Url: http://www.linuxfoundation.org/collaborate/workgroups/openprinting/cups
Source0: http://www.openprinting.org/download/cups-filters/cups-filters-%{version}.tar.xz
Patch01: cups-filters-createall.patch
# backported patch from upstream - since glibc 2.28 there is a need to clear EOF on
# file descriptor when I use dup2 on file descriptor where is EOF
Patch02: cups-filters-cleareof.patch
# Links in man page is wrong - it shows 'cups-browsed' in path, but we
# have 'cups-filters' in path, because it is shipped in 'cups-filters' package
# instead of 'cups-browsed' as Ubuntu does. I can repack the project later,
# so cups-browsed would have separate sub package, so the link would be correct
Patch03: cups-browsed.8.patch
Patch02: cups-browsed.8.patch
# backport from upstream - checking for timeouts were done for disappearing queues,
# which caused crashes
Patch03: 0001-cups-browsed-Fixed-crashes-caused-by-checking-HTTP-t.patch
Requires: cups-filters-libs%{?_isa} = %{version}-%{release}
@ -133,10 +133,10 @@ This is the development package for OpenPrinting CUPS filters and backends.
# set LocalQueueNamingRemoteCUPS and CreateIPPPrinterQueues by default
%patch01 -p1 -b .createall
# backported from upstream - EOF from pipe needs to cleared
%patch02 -p1 -b .cleareof
# links in manpage
%patch03 -p1 -b .manpage
%patch02 -p1 -b .manpage
# timeouts - backport from upstream
%patch03 -p1 -b .timeouts
%build
# work-around Rpath
@ -309,6 +309,9 @@ fi
%{_libdir}/libfontembed.so
%changelog
* Thu Dec 13 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1.21.5-1
- 1.21.5
* Mon Nov 12 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1.21.2-4
- links in manpages are wrong

View File

@ -1 +1 @@
SHA512 (cups-filters-1.21.2.tar.xz) = 07672737108e1593374fa95582e2c8ad7a3fec6202846ba85224c1c89f65b7b89de96ebf67841ec5d948fe556dddd06ae6a58ad6c5c0a25a82ce643c9384aaf0
SHA512 (cups-filters-1.21.5.tar.xz) = 41ed3364cb0a87e8b2b2482f3c8de90eba63538682ad3fa1079908beadec5e975d9eda151d822e93f62dcc32fe2a6189cc02b6b7691640fb00434efec35c0f7a