Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raw printing with multiple files and/or banners does not work #1933

Closed
michaelrsweet opened this issue Aug 25, 2006 · 9 comments
Closed

Raw printing with multiple files and/or banners does not work #1933

michaelrsweet opened this issue Aug 25, 2006 · 9 comments
Milestone

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.3-current
CUPS.org User: schwamfr

Printig from a SAP system on solaris with "Koppelart U" (means lpr) to a cups 1.2.2 (with cups-lpd) running on suse 10.1 is only possible if you try to print one copy. If you define in SAP to print more than one copy of the job the job is printed one time and remains in the queue.
in /var/spool/cups it looks like this (for 3 page copies):

-rw------- 1 root lp 638 Aug 24 16:35 c03976
-rw-r----- 1 root lp 5 Aug 24 16:35 d03976-001
-rw-r----- 1 root lp 5 Aug 24 16:35 d03976-002
-rw-r----- 1 root lp 5 Aug 24 16:35 d03976-003

The behavior ist the same printing printing to cups-lpd by a VMS maschine.
Printing multiple page copies from a linux box running cups 1.1.23 to the same lpd queue is no problem!

Thanks for your Help
Frank.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Please attach the error_log file from your system (with the log level set to "debug"...)

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: schwamfr

Hi,

what i did was start cupsd and print from SAP with a page count of 3.
The behavior is like i described in my first posting.

Frank.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

The error_log file you attached does not show the error in question. It does show, however, that you've stripped your CUPS installation down to nothing (2 MIME types) and that the jobs are queuing properly.

Try running with debug logging enabled and attach an error_log file that shows the first copy getting printed.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: schwamfr

Hi,

sorry, i made an mistake with the log level...
Ok now (for me) it seems that the lpd backend is not started a second time.

Frank.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

OK, the problem is caused by raw printing of multiple files. This will NOT get fixed in 1.2.3, but probably in a later release.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

OK, it looks like we'll be delaying a fix for this until CUPS 1.3 which should at least be in beta test by the end of the year.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

(changed the summary to be more descriptive)

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in Subversion repository.

@michaelrsweet
Copy link
Collaborator Author

"str1933.patch":

Index: filter/gziptoany.c

--- filter/gziptoany.c (revision 6373)
+++ filter/gziptoany.c (working copy)
@@ -1,9 +1,9 @@
/*

  • "$Id$"
    *
    • * GZIP pre-filter for the Common UNIX Printing System (CUPS).
    • * GZIP/raw pre-filter for the Common UNIX Printing System (CUPS).
      *
    • * Copyright 1993-2005 by Easy Software Products.
    • * Copyright 1993-2007 by Easy Software Products.
      *
  • These coded instructions, statements, and computer programs are the
  • property of Easy Software Products and are protected by Federal
    @@ -25,32 +25,28 @@
  • Contents:
    *

    • * main() - Uncompress gzip'd files and send them to stdout...
    • * main() - Copy (and uncompress) files to stdout.
      */

    /*

  • Include necessary headers...
    */

+#include <cups/file.h>
#include <cups/string.h>
#include <stdlib.h>
#include <errno.h>

-#ifdef HAVE_LIBZ
-# include <zlib.h>
-#endif /* HAVE_LIBZ */

/*

  • * 'main()' - Uncompress gzip'd files and send them to stdout...

    • 'main()' - Copy (and uncompress) files to stdout.
      */

    int /* O - Exit status /
    main(int argc, /
    I - Number of command-line arguments /
    char *argv[]) /
    I - Command-line arguments */
    {
    -#ifdef HAVE_LIBZ

  • gzFile fp; /* GZIP'd file */

  • cups_file_t fp; / File /
    char buffer[8192]; /
    Data buffer /
    int bytes; /
    Number of bytes read/written /
    int copies; /
    Number of copies */
    @@ -68,42 +64,43 @@
    }

/*

  • * Get the copy count; if the MIME type is "application/vnd.cups-raw" then
  • * make copies since the file is going straight to a backend...
  • * Get the copy count; if we have no final content type, this is a
    • raw queue or raw print file, so we need to make copies...
      */
  • if ((content_type = getenv("CONTENT_TYPE")) != NULL &&
  •  !strcasecmp(content_type, "application/vnd.cups-raw"))
    
  • if (!getenv("FINAL_CONTENT_TYPE"))
    copies = atoi(argv[4]);
    else
    copies = 1;

/*

  • * Open the gzip file...

    • Open the file...
      */
  • if ((fp = gzopen(argv[6], "rb")) == NULL)

  • if ((fp = cupsFileOpen(argv[6], "r")) == NULL)
    {

  • fprintf(stderr, "ERROR: Unable to open GZIP file: %s\n", strerror(errno));

  • fprintf(stderr, "ERROR: Unable to open file "%s": %s\n", argv[6],

  •        strerror(errno));
    

    return (1);
    }

    /*

  • * Copy the gzip file to stdout...

    • Copy the file to stdout...
      */

    setbuf(stdout, NULL);

    while (copies > 0)
    {

  • gzrewind(fp);

  • cupsFileRewind(fp);

  • while ((bytes = gzread(fp, buffer, sizeof(buffer))) > 0)

  • while ((bytes = cupsFileRead(fp, buffer, sizeof(buffer))) > 0)
    if (fwrite(buffer, 1, bytes, stdout) < bytes)
    {

  • fprintf(stderr, "ERROR: Unable to write uncompressed document data: %s\n",

  • fprintf(stderr,

  •       "ERROR: Unable to write uncompressed document data: %s\n",
        strerror(ferror(stdout)));
    
  • gzclose(fp);

  • cupsFileClose(fp);

return (1);
}
@@ -115,14 +112,9 @@

  • Close the file and return...
    */
  • gzclose(fp);
  • cupsFileClose(fp);

return (0);
-#else

  • fputs("INFO: Hint: recompile CUPS with ZLIB.\n", stderr);
  • fputs("ERROR: GZIP compression support not compiled in!\n", stderr);
  • return (1);
    -#endif /* HAVE_LIBZ */
    }

Index: scheduler/job.c

--- scheduler/job.c (revision 6373)
+++ scheduler/job.c (working copy)
@@ -1720,6 +1720,8 @@
cupsdCancelJob(job, 1, IPP_JOB_CANCELED);
return;
}
+#else

  •      (void)q;
    

    #endif /* APPLE */
    }
    }
    @@ -2527,20 +2529,6 @@
    return;
    }

  • if (printer->raw && !strncmp(printer->device_uri, "file:", 5))

  • {

  • cupsdLogMessage(CUPSD_LOG_ERROR,

  •                "Job ID %d cannot be printed to raw queue pointing to "
    
  •       "a file!",
    

- job->id);

  • strlcpy(printer->state_message, "Raw printers cannot use file: devices!",
  •        sizeof(printer->state_message));
    
  • cupsdStopPrinter(printer, 1);
  • cupsdAddPrinterHistory(printer);
  • return;

- }

/*

  • Figure out what filters are required to convert from

  • the source to the destination type...
    @@ -2670,10 +2658,12 @@
    FilterLevel += job->cost;

    /*

    • * Add decompression filters, if any...
    • * Add decompression/raw filter as needed...
      */
  • if (!printer->raw && job->compressions[job->current_file])

  • if ((!printer->raw && job->compressions[job->current_file]) ||

  •  (!filters && !printer->remote &&
    
  •   (job->num_files > 1 || !strncmp(printer->device_uri, "file:", 5))))
    

    {
    /*

    • Add gziptoany filter to the front of the list...
      @@ -2737,9 +2727,11 @@

    job->state->values[0].integer = IPP_JOB_PROCESSING;
    job->state_value = IPP_JOB_PROCESSING;
    +
    job->status = 0;
    job->printer = printer;
    printer->job = job;
    +
    cupsdSetPrinterState(printer, IPP_PRINTER_PROCESSING, 0);

    if (job->current_file == 0)
    @@ -3117,7 +3109,7 @@
    envp[envc ++] = device_uri;
    envp[envc ++] = printer_name;

  • if (!printer->remote &&

  • if (!printer->remote && !printer->raw &&
    (filter = (mime_filter_t *)cupsArrayLast(filters)) != NULL)
    {
    snprintf(final_content_type, sizeof(final_content_type),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant