From: Michael R Sweet Date: Mon, 7 Oct 2019 19:03:54 +0000 (-0400) Subject: The IPP backend did not detect all cases where a job should be retried using X-Git-Tag: v2.3.1~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b835597f35bce14f9b6018164ac2da2b4024e6d;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 reason keywords and client-error-document-xxx status codes after a Send-Document or Print-Job request. --- diff --git a/CHANGES.md b/CHANGES.md index f8540ec632..311c35409a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,8 @@ Changes in CUPS v2.3.1 - Fixed a bug in the handling of printer resource files (Issue #5652) - 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.3.0 diff --git a/backend/ipp.c b/backend/ipp.c index 8226acc7b0..b2b22065ef 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -1450,6 +1450,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]; @@ -1867,21 +1869,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) @@ -1898,7 +1908,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")) {