From ce05ab28318e63dd3900b7e1c34a48779fae1010 Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Fri, 9 Nov 2018 16:23:16 +0100 Subject: [PATCH] 1622432 - Jobs with multiple files don't complete when backend fails --- ...ulti-file-jobs-Issue-5359-Issue-5413.patch | 56 +++++++++++++++++++ cups.spec | 8 ++- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 0001-Fix-stuck-multi-file-jobs-Issue-5359-Issue-5413.patch diff --git a/0001-Fix-stuck-multi-file-jobs-Issue-5359-Issue-5413.patch b/0001-Fix-stuck-multi-file-jobs-Issue-5359-Issue-5413.patch new file mode 100644 index 0000000..2d7ca02 --- /dev/null +++ b/0001-Fix-stuck-multi-file-jobs-Issue-5359-Issue-5413.patch @@ -0,0 +1,56 @@ +diff --git a/backend/socket.c b/backend/socket.c +index 675061dd9..68379e95b 100644 +--- a/backend/socket.c ++++ b/backend/socket.c +@@ -397,8 +397,10 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ + lseek(print_fd, 0, SEEK_SET); + } + +- tbytes = backendRunLoop(print_fd, device_fd, snmp_fd, &(addrlist->addr), 1, +- 0, backendNetworkSideCB); ++ if ((bytes = backendRunLoop(print_fd, device_fd, snmp_fd, &(addrlist->addr), 1, 0, backendNetworkSideCB)) < 0) ++ tbytes = -1; ++ else ++ tbytes = bytes; + + if (print_fd != 0 && tbytes >= 0) + _cupsLangPrintFilter(stderr, "INFO", _("Print file sent.")); +@@ -406,7 +408,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ + + fputs("STATE: +cups-waiting-for-job-completed\n", stderr); + +- if (waiteof) ++ if (waiteof && tbytes >= 0) + { + /* + * Shutdown the socket and wait for the other end to finish... +@@ -443,7 +445,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ + if (print_fd != 0) + close(print_fd); + +- return (CUPS_BACKEND_OK); ++ return (tbytes >= 0 ? CUPS_BACKEND_OK : CUPS_BACKEND_FAILED); + } + + +diff --git a/scheduler/main.c b/scheduler/main.c +index 4b3914ade..472b9946d 100644 +--- a/scheduler/main.c ++++ b/scheduler/main.c +@@ -1472,9 +1472,16 @@ process_children(void) + (!job->filters[i] && WIFEXITED(old_status))) + { /* Backend and filter didn't crash */ + if (job->filters[i]) ++ { + job->status = status; /* Filter failed */ ++ } + else ++ { + job->status = -status; /* Backend failed */ ++ ++ if (job->current_file < job->num_files) ++ cupsdSetJobState(job, IPP_JOB_ABORTED, CUPSD_JOB_FORCE, "Canceling multi-file job due to backend failure."); ++ } + } + + if (job->state_value == IPP_JOB_PROCESSING && diff --git a/cups.spec b/cups.spec index f4ddcbf..ab50ba8 100644 --- a/cups.spec +++ b/cups.spec @@ -15,7 +15,7 @@ Summary: CUPS printing system Name: cups Epoch: 1 Version: 2.2.8 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2+ and LGPLv2+ with exceptions and AML Url: http://www.cups.org/ Source0: https://github.com/apple/cups/releases/download/v%{VERSION}/cups-%{VERSION}-source.tar.gz @@ -105,6 +105,8 @@ Patch43: cups-ippvalidateattr-regression.patch Patch44: cups-ippeve-webui.patch # fixed covscan issues from upstream Patch45: 0001-Fix-memory-leaks-found-by-Coverity-Issue-5375.patch +# 1622432 - multiple file job can stuck when data transfer is interrupted, so now it is aborted (https://github.com/apple/cups/pull/5413) +Patch46: 0001-Fix-stuck-multi-file-jobs-Issue-5359-Issue-5413.patch ##### Patches removed because IMHO they aren't no longer needed ##### but still I'll leave them in git in case their removal @@ -352,6 +354,7 @@ Sends IPP requests to the specified URI and tests and/or displays the results. %patch44 -p1 -b .ippeve-webui # fixed covscan issues from upstream %patch45 -p1 -b .covscan +%patch46 -p1 -b .multifile-stuck # if cupsd is set to log into /var/log/cups, then 'MaxLogSize 0' needs to be # in cupsd.conf to disable cupsd logrotate functionality and use logrotated @@ -745,6 +748,9 @@ rm -f %{cups_serverbin}/backend/smb %{_mandir}/man5/ipptoolfile.5.gz %changelog +* Fri Nov 09 2018 Zdenek Dohnal - 1:2.2.8-6 +- 1622432 - Jobs with multiple files don't complete when backend fails + * Fri Sep 21 2018 Zdenek Dohnal - 1:2.2.8-5 - fixed coverity issues