From: Michael R Sweet Date: Mon, 7 Oct 2019 19:05:30 +0000 (-0400) Subject: The IPP backend did not detect all cases where a job should be retried using X-Git-Tag: v2.2.13~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=891e14ed26f8f6495bbe1338eb7b709f028ff4eb;p=thirdparty%2Fcups.git The IPP backend did not detect all cases where a job should be retried using a raster format (rdar://56021091) - Look for document-xxx reasons and client-error-document-xxx status codes from Send-Document and Print-Job requests. --- diff --git a/CHANGES.md b/CHANGES.md index ba78c244ac..0c9b7df239 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,8 @@ Changes in CUPS v2.2.13 - Fixed the default common name for TLS certificates used by `ippserver`. - The libusb-based USB backend now reports an error when the distribution permissions are wrong (Issue #5658) +- The IPP backend did not detect all cases where a job should be retried using + a raster format (rdar://56021091) Changes in CUPS v2.2.12 diff --git a/backend/ipp.c b/backend/ipp.c index c364e19788..23a46a7675 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -1,7 +1,7 @@ /* * IPP backend for CUPS. * - * Copyright 2007-2018 by Apple Inc. + * Copyright 2007-2019 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -1459,6 +1459,8 @@ main(int argc, /* I - Number of command-line args */ monitor.printer_state = IPP_PSTATE_IDLE; monitor.retryable = argc == 6 && document_format && strcmp(document_format, "image/pwg-raster") && strcmp(document_format, "image/urf"); + fprintf(stderr, "DEBUG: retryable=%d\n", monitor.retryable); + if (create_job) { monitor.job_name = argv[3]; @@ -1852,21 +1854,29 @@ main(int argc, /* I - Number of command-line args */ response = cupsGetResponse(http, resource); ippDelete(request); - fprintf(stderr, "DEBUG: Send-Document: %s (%s)\n", - ippErrorString(cupsLastError()), cupsLastErrorString()); + fprintf(stderr, "DEBUG: Send-Document: %s (%s)\n", ippErrorString(cupsLastError()), cupsLastErrorString()); debug_attributes(response); - ippDelete(response); if (cupsLastError() > IPP_STATUS_OK_CONFLICTING && !job_canceled) { + ipp_attribute_t *reasons = ippFindAttribute(response, "job-state-reasons", IPP_TAG_KEYWORD); + /* job-state-reasons values */ + ipp_status = cupsLastError(); - _cupsLangPrintFilter(stderr, "ERROR", - _("Unable to add document to print job.")); + if (ippContainsString(reasons, "document-format-error")) + ipp_status = IPP_STATUS_ERROR_DOCUMENT_FORMAT_ERROR; + else if (ippContainsString(reasons, "document-unprintable")) + ipp_status = IPP_STATUS_ERROR_DOCUMENT_UNPRINTABLE; + + ippDelete(response); + _cupsLangPrintFilter(stderr, "ERROR", _("Unable to add document to print job.")); break; } else { + ippDelete(response); + password_tries = 0; if (num_files == 0 || fd < 0) @@ -1883,7 +1893,7 @@ main(int argc, /* I - Number of command-line args */ fprintf(stderr, "PAGE: 1 %d\n", copies_sup ? atoi(argv[4]) : 1); copies_remaining --; } - else if ((ipp_status == IPP_STATUS_ERROR_DOCUMENT_FORMAT_NOT_SUPPORTED || ipp_status == IPP_STATUS_ERROR_DOCUMENT_UNPRINTABLE) && + else if ((ipp_status == IPP_STATUS_ERROR_DOCUMENT_FORMAT_NOT_SUPPORTED || ipp_status == IPP_STATUS_ERROR_DOCUMENT_FORMAT_ERROR || ipp_status == IPP_STATUS_ERROR_DOCUMENT_UNPRINTABLE) && argc == 6 && document_format && strcmp(document_format, "image/pwg-raster") && strcmp(document_format, "image/urf")) {