]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
More message cleanup, and retry on pretty much any error to work around printer
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Sat, 16 Apr 2011 03:28:33 +0000 (03:28 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Sat, 16 Apr 2011 03:28:33 +0000 (03:28 +0000)
bugs.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@9694 7a7537e8-13f0-0310-91df-b6672ffda945

backend/ipp.c
locale/cups.pot
locale/cups.strings

index be689fba556cf2cfef20ce62210c441cfcaed90e..b02238a76ff5618fcc02c10aab510499678b33de 100644 (file)
@@ -752,6 +752,9 @@ main(int  argc,                             /* I - Number of command-line args */
     supported  = cupsDoRequest(http, request, resource);
     ipp_status = cupsLastError();
 
+    fprintf(stderr, "DEBUG: Get-Printer-Attributes: %s (%s)\n",
+            ippErrorString(ipp_status), cupsLastErrorString());
+
     if (ipp_status > IPP_OK_CONFLICT)
     {
       fprintf(stderr, "DEBUG: Get-Printer-Attributes returned %s.\n",
@@ -767,7 +770,7 @@ main(int  argc,                             /* I - Number of command-line args */
          return (CUPS_BACKEND_FAILED);
        }
 
-       _cupsLangPrintFilter(stderr, "WARNING", _("The printer is busy."));
+       _cupsLangPrintFilter(stderr, "INFO", _("The printer is busy."));
 
         report_printer_state(supported, 0);
 
@@ -805,8 +808,7 @@ main(int  argc,                             /* I - Number of command-line args */
                             _("The printer URI is incorrect or no longer "
                               "exists."));
 
-       if (supported)
-          ippDelete(supported);
+       ippDelete(supported);
 
        return (CUPS_BACKEND_STOP);
       }
@@ -822,12 +824,12 @@ main(int  argc,                           /* I - Number of command-line args */
       else
       {
        _cupsLangPrintFilter(stderr, "ERROR",
-                            _("Unable to get printer status: %s"),
-                            cupsLastErrorString());
+                            _("Unable to get printer status."));
         sleep(10);
       }
 
       ippDelete(supported);
+      supported = NULL;
       continue;
     }
 
@@ -846,7 +848,7 @@ main(int  argc,                             /* I - Number of command-line args */
 
       if (i < printer_state->num_values)
       {
-       _cupsLangPrintFilter(stderr, "WARNING", _("The printer is busy."));
+       _cupsLangPrintFilter(stderr, "INFO", _("The printer is busy."));
 
         report_printer_state(supported, 0);
 
@@ -855,6 +857,7 @@ main(int  argc,                             /* I - Number of command-line args */
         delay = _cupsNextDelay(delay, &prev_delay);
 
        ippDelete(supported);
+       supported = NULL;
        continue;
       }
     }
@@ -1104,7 +1107,7 @@ main(int  argc,                           /* I - Number of command-line args */
   * Validate access to the printer...
   */
 
-  while (!job_canceled)
+  while (!job_canceled && validate_job)
   {
     request = new_request(IPP_VALIDATE_JOB, version, uri, argv[2], argv[3],
                           num_options, options, compression,
@@ -1115,48 +1118,47 @@ main(int  argc,                         /* I - Number of command-line args */
 
     ipp_status = cupsLastError();
 
-    if (ipp_status > IPP_OK_CONFLICT &&
-        ipp_status != IPP_OPERATION_NOT_SUPPORTED)
-    {
-      if (job_canceled)
-        break;
+    fprintf(stderr, "DEBUG: Validate-Job: %s (%s)\n",
+            ippErrorString(ipp_status), cupsLastErrorString());
 
-      if (ipp_status == IPP_SERVICE_UNAVAILABLE ||
-         ipp_status == IPP_PRINTER_BUSY)
-      {
-        _cupsLangPrintFilter(stderr, "INFO",
-                            _("Printer busy; will retry in 10 seconds."));
-       sleep(10);
-      }
-      else
-      {
-       /*
-       * Update auth-info-required as needed...
-       */
+    if (job_canceled)
+      break;
 
-        _cupsLangPrintFilter(stderr, "ERROR", "%s", cupsLastErrorString());
+    if (ipp_status == IPP_SERVICE_UNAVAILABLE || ipp_status == IPP_PRINTER_BUSY)
+    {
+      _cupsLangPrintFilter(stderr, "INFO", _("The printer is busy."));
+      sleep(10);
+    }
+    else if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN)
+    {
+     /*
+      * Update auth-info-required as needed...
+      */
 
-       if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN)
-       {
-         fprintf(stderr, "DEBUG: WWW-Authenticate=\"%s\"\n",
-                 httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE));
+      fprintf(stderr, "DEBUG: WWW-Authenticate=\"%s\"\n",
+             httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE));
 
-         /*
-         * Normal authentication goes through the password callback, which sets
-         * auth_info_required to "username,password".  Kerberos goes directly
-         * through GSSAPI, so look for Negotiate in the WWW-Authenticate header
-         * here and set auth_info_required as needed...
-         */
+     /*
+      * Normal authentication goes through the password callback, which sets
+      * auth_info_required to "username,password".  Kerberos goes directly
+      * through GSSAPI, so look for Negotiate in the WWW-Authenticate header
+      * here and set auth_info_required as needed...
+      */
 
-         if (!strncmp(httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE),
-                      "Negotiate", 9))
-           auth_info_required = "negotiate";
-       }
+      if (!strncmp(httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE),
+                  "Negotiate", 9))
+       auth_info_required = "negotiate";
 
-       goto cleanup;
-      }
+      goto cleanup;
     }
-    else
+    else if (ipp_status == IPP_OPERATION_NOT_SUPPORTED)
+    {
+      _cupsLangPrintFilter(stderr, "WARNING",
+                          _("This printer does not conform to the IPP "
+                            "standard and may not work."));
+      break;
+    }
+    else if (ipp_status < IPP_REDIRECTION_OTHER_SITE)
       break;
   }
 
@@ -1238,6 +1240,10 @@ main(int  argc,                          /* I - Number of command-line args */
 
     ipp_status = cupsLastError();
 
+    fprintf(stderr, "DEBUG: %s: %s (%s)\n",
+            num_files > 1 ? "Create-Job" : "Print-Job",
+            ippErrorString(ipp_status), cupsLastErrorString());
+
     if (ipp_status > IPP_OK_CONFLICT)
     {
       job_id = 0;
@@ -1248,8 +1254,7 @@ main(int  argc,                           /* I - Number of command-line args */
       if (ipp_status == IPP_SERVICE_UNAVAILABLE ||
          ipp_status == IPP_PRINTER_BUSY)
       {
-        _cupsLangPrintFilter(stderr, "INFO",
-                            _("Printer busy; will retry in 10 seconds."));
+       _cupsLangPrintFilter(stderr, "INFO", _("The printer is busy."));
        sleep(10);
 
        if (num_files == 0)
@@ -1269,8 +1274,7 @@ main(int  argc,                           /* I - Number of command-line args */
        */
 
         _cupsLangPrintFilter(stderr, "ERROR",
-                            _("Print file was not accepted: %s"),
-                            cupsLastErrorString());
+                            _("Print file was not accepted."));
 
        if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN)
        {
@@ -1288,6 +1292,18 @@ main(int  argc,                          /* I - Number of command-line args */
                       "Negotiate", 9))
            auth_info_required = "negotiate";
        }
+       else
+         sleep(10);
+
+       if (num_files == 0)
+       {
+        /*
+         * We can't re-submit when we have no files to print, so exit
+         * immediately with the right status code...
+         */
+
+         goto cleanup;
+       }
       }
     }
     else if ((job_id_attr = ippFindAttribute(response, "job-id",
@@ -1368,13 +1384,15 @@ main(int  argc,                         /* I - Number of command-line args */
        ippDelete(cupsGetResponse(http, resource));
        ippDelete(request);
 
+       fprintf(stderr, "DEBUG: Send-Document: %s (%s)\n",
+               ippErrorString(cupsLastError()), cupsLastErrorString());
+
        if (cupsLastError() > IPP_OK_CONFLICT)
        {
          ipp_status = cupsLastError();
 
          _cupsLangPrintFilter(stderr, "ERROR",
-                              _("Unable to add file to job: %s"),
-                              cupsLastErrorString());
+                              _("Unable to add document to print job."));
          break;
        }
       }
@@ -1450,6 +1468,9 @@ main(int  argc,                           /* I - Number of command-line args */
         break;
       }
 
+      fprintf(stderr, "DEBUG: Get-Job-Attributes: %s (%s)\n",
+             ippErrorString(ipp_status), cupsLastErrorString());
+
       if (ipp_status > IPP_OK_CONFLICT)
       {
        if (ipp_status != IPP_SERVICE_UNAVAILABLE &&
@@ -1458,8 +1479,7 @@ main(int  argc,                           /* I - Number of command-line args */
          ippDelete(response);
 
           _cupsLangPrintFilter(stderr, "ERROR",
-                              _("Unable to get job attributes: %s"),
-                              cupsLastErrorString());
+                              _("Unable to get print job status."));
           break;
        }
       }
@@ -1602,11 +1622,8 @@ main(int  argc,                          /* I - Number of command-line args */
     return (CUPS_BACKEND_AUTH_REQUIRED);
   else if (ipp_status == IPP_INTERNAL_ERROR)
     return (CUPS_BACKEND_STOP);
-  else if (ipp_status == IPP_SERVICE_UNAVAILABLE ||
-          ipp_status == IPP_PRINTER_BUSY)
-    return (CUPS_BACKEND_RETRY_CURRENT);
   else if (ipp_status > IPP_OK_CONFLICT)
-    return (CUPS_BACKEND_FAILED);
+    return (CUPS_BACKEND_RETRY_CURRENT);
   else
   {
     _cupsLangPrintFilter(stderr, "INFO", _("Ready to print."));
@@ -1651,8 +1668,7 @@ cancel_job(http_t     *http,              /* I - HTTP connection */
   ippDelete(cupsDoRequest(http, request, resource));
 
   if (cupsLastError() > IPP_OK_CONFLICT)
-    _cupsLangPrintFilter(stderr, "ERROR", _("Unable to cancel job: %s"),
-                        cupsLastErrorString());
+    _cupsLangPrintFilter(stderr, "ERROR", _("Unable to cancel print job."));
 }
 
 
@@ -1706,6 +1722,9 @@ check_printer_state(
     ippDelete(response);
   }
 
+  fprintf(stderr, "DEBUG: Get-Printer-Attributes: %s (%s)\n",
+         ippErrorString(cupsLastError()), cupsLastErrorString());
+
  /*
   * Return the printer-state value...
   */
@@ -1862,6 +1881,9 @@ monitor_printer(
 
        response = cupsDoRequest(http, request, monitor->resource);
 
+       fprintf(stderr, "DEBUG: Get-Job-Attributes: %s (%s)\n",
+               ippErrorString(cupsLastError()), cupsLastErrorString());
+
        if ((attr = ippFindAttribute(response, "job-state",
                                     IPP_TAG_ENUM)) != NULL)
          monitor->job_state = (ipp_jstate_t)attr->values[0].integer;
index e6bfbb1b557d679a97c4fc66bcea8efd7795df1a..c14459fc14d0d5181b3077ab1b7c3862d80bbf63 100644 (file)
@@ -30,7 +30,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: CUPS 1.5\n"
 "Report-Msgid-Bugs-To: http://www.cups.org/str.php\n"
-"POT-Creation-Date: 2011-04-15 19:49-0700\n"
+"POT-Creation-Date: 2011-04-15 20:27-0700\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -3037,7 +3037,7 @@ msgstr ""
 msgid "Cancel RSS Subscription"
 msgstr ""
 
-#: backend/ipp.c:1633
+#: backend/ipp.c:1650
 msgid "Canceling print job."
 msgstr ""
 
@@ -3110,7 +3110,7 @@ msgstr ""
 msgid "Control file sent successfully."
 msgstr ""
 
-#: backend/ipp.c:1067 backend/lpd.c:455
+#: backend/ipp.c:1070 backend/lpd.c:455
 msgid "Copying print data."
 msgstr ""
 
@@ -4484,12 +4484,12 @@ msgstr ""
 msgid "Print and Tear"
 msgstr ""
 
-#: backend/ipp.c:1304
+#: backend/ipp.c:1320
 #, c-format
 msgid "Print file accepted - job ID %d."
 msgstr ""
 
-#: backend/ipp.c:1297
+#: backend/ipp.c:1313
 msgid "Print file accepted - job ID unknown."
 msgstr ""
 
@@ -4497,9 +4497,8 @@ msgstr ""
 msgid "Print file sent."
 msgstr ""
 
-#: backend/ipp.c:1272
-#, c-format
-msgid "Print file was not accepted: %s"
+#: backend/ipp.c:1277
+msgid "Print file was not accepted."
 msgstr ""
 
 #: filter/bannertops.c:648
@@ -4546,10 +4545,6 @@ msgstr ""
 msgid "Printer busy, will retry in 10 seconds."
 msgstr ""
 
-#: backend/ipp.c:1128 backend/ipp.c:1252
-msgid "Printer busy; will retry in 10 seconds."
-msgstr ""
-
 #: backend/parallel.c:234 backend/serial.c:256
 msgid "Printer busy; will retry in 30 seconds."
 msgstr ""
@@ -4559,7 +4554,7 @@ msgstr ""
 msgid "Printer did not respond after %d seconds."
 msgstr ""
 
-#: backend/ipp.c:788 backend/ipp.c:795
+#: backend/ipp.c:791 backend/ipp.c:798
 #, c-format
 msgid "Printer does not support IPP/%d.%d, trying IPP/%s."
 msgstr ""
@@ -4632,7 +4627,7 @@ msgstr ""
 msgid "Rank   Owner      Pri  Job        Files                       Total Size"
 msgstr ""
 
-#: backend/ipp.c:1612 backend/socket.c:466 driver/rastertoescpx.c:1923
+#: backend/ipp.c:1629 backend/socket.c:466 driver/rastertoescpx.c:1923
 #: driver/rastertopclx.c:1948 filter/rastertoepson.c:1152
 #: filter/rastertohp.c:881 filter/rastertolabel.c:1307
 msgid "Ready to print."
@@ -4941,7 +4936,7 @@ msgstr ""
 msgid "The print file could not be opened."
 msgstr ""
 
-#: backend/ipp.c:805
+#: backend/ipp.c:808
 msgid "The printer URI is incorrect or no longer exists."
 msgstr ""
 
@@ -4949,8 +4944,8 @@ msgstr ""
 msgid "The printer is almost out of ink."
 msgstr ""
 
-#: backend/ipp.c:656 backend/ipp.c:770 backend/ipp.c:849 backend/lpd.c:832
-#: backend/socket.c:368
+#: backend/ipp.c:656 backend/ipp.c:773 backend/ipp.c:851 backend/ipp.c:1129
+#: backend/ipp.c:1257 backend/lpd.c:832 backend/socket.c:368
 msgid "The printer is busy."
 msgstr ""
 
@@ -4962,7 +4957,7 @@ msgstr ""
 msgid "The printer is not connected."
 msgstr ""
 
-#: backend/ipp.c:634 backend/ipp.c:667 backend/ipp.c:766 backend/lpd.c:811
+#: backend/ipp.c:634 backend/ipp.c:667 backend/ipp.c:769 backend/lpd.c:811
 #: backend/lpd.c:852 backend/socket.c:347 backend/socket.c:380
 msgid "The printer is not responding."
 msgstr ""
@@ -5069,11 +5064,11 @@ msgstr ""
 msgid "Thermal Transfer Media"
 msgstr ""
 
-#: backend/ipp.c:922 backend/ipp.c:931
+#: backend/ipp.c:925 backend/ipp.c:934 backend/ipp.c:1157
 msgid "This printer does not conform to the IPP standard and may not work."
 msgstr ""
 
-#: backend/ipp.c:747 backend/ipp.c:863
+#: backend/ipp.c:747 backend/ipp.c:866
 msgid "This printer does not conform to the IPP standard. Please contact the manufacturer of your printer for assistance."
 msgstr ""
 
@@ -5172,9 +5167,8 @@ msgstr ""
 msgid "Unable to add class:"
 msgstr ""
 
-#: backend/ipp.c:1376
-#, c-format
-msgid "Unable to add file to job: %s"
+#: backend/ipp.c:1395
+msgid "Unable to add document to print job."
 msgstr ""
 
 #: scheduler/ipp.c:1628
@@ -5202,9 +5196,8 @@ msgstr ""
 msgid "Unable to cancel RSS subscription:"
 msgstr ""
 
-#: backend/ipp.c:1654
-#, c-format
-msgid "Unable to cancel job: %s"
+#: backend/ipp.c:1671
+msgid "Unable to cancel print job."
 msgstr ""
 
 #: cgi-bin/admin.c:4021
@@ -5227,7 +5220,7 @@ msgstr ""
 msgid "Unable to connect to server"
 msgstr ""
 
-#: backend/ipp.c:612 backend/ipp.c:971 backend/lpd.c:791
+#: backend/ipp.c:612 backend/ipp.c:974 backend/lpd.c:791
 #: backend/parallel.c:219 backend/serial.c:241 backend/socket.c:327
 #: backend/usb-unix.c:117
 msgid "Unable to contact printer, queuing on next printer in class."
@@ -5276,7 +5269,7 @@ msgstr ""
 msgid "Unable to copy print file"
 msgstr ""
 
-#: backend/ipp.c:1742
+#: backend/ipp.c:1761
 msgid "Unable to create compressed print file"
 msgstr ""
 
@@ -5356,7 +5349,7 @@ msgstr ""
 msgid "Unable to fork filter"
 msgstr ""
 
-#: backend/ipp.c:1764
+#: backend/ipp.c:1783
 msgid "Unable to generate compressed print file"
 msgstr ""
 
@@ -5368,15 +5361,14 @@ msgstr ""
 msgid "Unable to get class status:"
 msgstr ""
 
-#: backend/ipp.c:1461
-#, c-format
-msgid "Unable to get job attributes: %s"
-msgstr ""
-
 #: cgi-bin/admin.c:1321
 msgid "Unable to get list of printer drivers:"
 msgstr ""
 
+#: backend/ipp.c:1482
+msgid "Unable to get print job status."
+msgstr ""
+
 #: cgi-bin/admin.c:2959
 msgid "Unable to get printer attributes:"
 msgstr ""
@@ -5385,13 +5377,12 @@ msgstr ""
 msgid "Unable to get printer list:"
 msgstr ""
 
-#: cgi-bin/printers.c:569
-msgid "Unable to get printer status:"
+#: backend/ipp.c:827
+msgid "Unable to get printer status."
 msgstr ""
 
-#: backend/ipp.c:825
-#, c-format
-msgid "Unable to get printer status: %s"
+#: cgi-bin/printers.c:569
+msgid "Unable to get printer status:"
 msgstr ""
 
 #: cups/adminutil.c:565 cups/adminutil.c:769
@@ -5442,7 +5433,7 @@ msgstr ""
 msgid "Unable to open charset file"
 msgstr ""
 
-#: backend/ipp.c:1748
+#: backend/ipp.c:1767
 msgid "Unable to open compressed print file"
 msgstr ""
 
@@ -5459,7 +5450,7 @@ msgstr ""
 msgid "Unable to open document #%d in job #%d."
 msgstr ""
 
-#: backend/ipp.c:1754 backend/lpd.c:476 backend/parallel.c:150
+#: backend/ipp.c:1773 backend/lpd.c:476 backend/parallel.c:150
 #: backend/serial.c:190 backend/socket.c:156 backend/usb.c:237
 #: filter/bannertops.c:183 filter/gziptoany.c:71 filter/pstext.c:89
 #: filter/pstext.c:249 filter/pstext.c:266 filter/pstops.c:299
@@ -5813,7 +5804,7 @@ msgstr ""
 msgid "Version uses indefinite length"
 msgstr ""
 
-#: backend/ipp.c:1401
+#: backend/ipp.c:1419
 msgid "Waiting for job to complete."
 msgstr ""
 
index 0bfb0cb19f2e7eb61660a962f6871887a855e91c..f6c2a9b4dbcb4ff08fe9b9e076398b311af982e1 100644 (file)
 "Print file accepted - job ID %d." = "Print file accepted - job ID %d.";
 "Print file accepted - job ID unknown." = "Print file accepted - job ID unknown.";
 "Print file sent." = "Print file sent.";
-"Print file was not accepted: %s" = "Print file was not accepted: %s";
+"Print file was not accepted." = "Print file was not accepted.";
 "Printed For: " = "Printed For: ";
 "Printed From: " = "Printed From: ";
 "Printed On: " = "Printed On: ";
 "Printer Paused" = "Printer Paused";
 "Printer Settings" = "Printer Settings";
 "Printer busy, will retry in 10 seconds." = "Printer busy, will retry in 10 seconds.";
-"Printer busy; will retry in 10 seconds." = "Printer busy; will retry in 10 seconds.";
 "Printer busy; will retry in 30 seconds." = "Printer busy; will retry in 30 seconds.";
 "Printer did not respond after %d seconds." = "Printer did not respond after %d seconds.";
 "Printer does not support IPP/%d.%d, trying IPP/%s." = "Printer does not support IPP/%d.%d, trying IPP/%s.";
 "Unable to access cupsd.conf file:" = "Unable to access cupsd.conf file:";
 "Unable to add RSS subscription:" = "Unable to add RSS subscription:";
 "Unable to add class:" = "Unable to add class:";
-"Unable to add file to job: %s" = "Unable to add file to job: %s";
+"Unable to add document to print job." = "Unable to add document to print job.";
 "Unable to add job for destination \"%s\"." = "Unable to add job for destination \"%s\".";
 "Unable to add printer:" = "Unable to add printer:";
 "Unable to allocate memory for file types." = "Unable to allocate memory for file types.";
 "Unable to allocate memory for page info" = "Unable to allocate memory for page info";
 "Unable to allocate memory for pages array" = "Unable to allocate memory for pages array";
 "Unable to cancel RSS subscription:" = "Unable to cancel RSS subscription:";
-"Unable to cancel job: %s" = "Unable to cancel job: %s";
+"Unable to cancel print job." = "Unable to cancel print job.";
 "Unable to change printer-is-shared attribute:" = "Unable to change printer-is-shared attribute:";
 "Unable to change printer:" = "Unable to change printer:";
 "Unable to change server settings:" = "Unable to change server settings:";
 "Unable to generate compressed print file" = "Unable to generate compressed print file";
 "Unable to get class list:" = "Unable to get class list:";
 "Unable to get class status:" = "Unable to get class status:";
-"Unable to get job attributes: %s" = "Unable to get job attributes: %s";
 "Unable to get list of printer drivers:" = "Unable to get list of printer drivers:";
+"Unable to get print job status." = "Unable to get print job status.";
 "Unable to get printer attributes:" = "Unable to get printer attributes:";
 "Unable to get printer list:" = "Unable to get printer list:";
+"Unable to get printer status." = "Unable to get printer status.";
 "Unable to get printer status:" = "Unable to get printer status:";
-"Unable to get printer status: %s" = "Unable to get printer status: %s";
 "Unable to install Windows 2000 printer driver files (%d)." = "Unable to install Windows 2000 printer driver files (%d).";
 "Unable to install Windows 9x printer driver files (%d)." = "Unable to install Windows 9x printer driver files (%d).";
 "Unable to locate printer \"%s\"." = "Unable to locate printer \"%s\".";