[cups.bugs] [HIGH] STR #1225: Bad management of ENOSPC (Out of

Octavio Alvarez alvarezp at alvarezp.ods.org
Sun Jul 24 18:12:13 PDT 2005


[STR New]

When a printer runs out of paper, kernel reports ENOSPC. This error is
unmanaged by cups and reports "Unable to send print file to printer: No
space left on device", quitting the job without even ejecting the paper,
making it very user unfriendly by having to reset the printer.

The following patch fixes it for me.

sh-3.00$ svn diff cups
Index: cups/backend/parallel.c
===================================================================
--- cups/backend/parallel.c     (revision 4549)
+++ cups/backend/parallel.c     (working copy)
@@ -269,14 +269,27 @@
 
       while (nbytes > 0)
       {
+        error = 0;
        if ((wbytes = write(fd, bufptr, nbytes)) < 0)
          if (errno == ENOTTY)
            wbytes = write(fd, bufptr, nbytes);
 
        if (wbytes < 0)
        {
-         perror("ERROR: Unable to send print file to printer");
-         break;
+         if (errno == ENOSPC)
+         {
+           if (error != ENOSPC) /* Avoid overfilling of error_log. */
+             printf(stderr, "INFO: Printer is out of paper (ENOSPC). - "
+                "Will retry every 3 secs.\n");
+           sleep(3);
+           error = ENOSPC;
+           continue;
+         }
+         else
+         {
+           perror("ERROR: Unable to send print file to printer");
+           break;
+          }
        }
 
        nbytes -= wbytes;

Same problem reported for Gimp-Print with similar fix.

Link: http://www.cups.org/str.php?L1225
Version: 1.2-current





More information about the cups-devel mailing list