]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
The IPP backend did not detect all cases where a job should be retried using
authorMichael R Sweet <michael.r.sweet@gmail.com>
Mon, 7 Oct 2019 19:03:54 +0000 (15:03 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Mon, 7 Oct 2019 19:03:54 +0000 (15:03 -0400)
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.

CHANGES.md
backend/ipp.c

index f8540ec6323b8c996a2981e263b1f53f7eaede8b..311c35409a4f3e077d126a91cac14cb48372d4a3 100644 (file)
@@ -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
index 8226acc7b074595d135d1dc632b14fd6ab26fd26..b2b22065ef4ab9e5e964f1c36d482c9eff4eee8d 100644 (file)
@@ -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"))
     {