[cups.development] What did I do wrong ?

Jerome Alet alet at librelogiciel.com
Wed Nov 15 14:53:44 PST 2006


Hello,

I'm using standard CUPS 1.2.5-1 under Debian Etch.

I'm trying to print several copies of the same PDF file,
so I did :

        $ lp -n 2 myfile.pdf
        
But the printer prints it only once.

When looking at CUPS' error_log in debug2 mode, I can see :

--- CUT ---
D [15/Nov/2006:23:12:38 +0100] [Job 743] argv[0]="HP2100"
D [15/Nov/2006:23:12:38 +0100] [Job 743] argv[1]="743"
D [15/Nov/2006:23:12:38 +0100] [Job 743] argv[2]="jerome"
D [15/Nov/2006:23:12:38 +0100] [Job 743] argv[3]="facture20061100111.pdf"
D [15/Nov/2006:23:12:38 +0100] [Job 743] argv[4]="2"
D [15/Nov/2006:23:12:38 +0100] [Job 743] argv[5]="job-uuid=urn:uuid:f7041e29-4cd2-3cc6-7897-bbb44014f1e6"
D [15/Nov/2006:23:12:38 +0100] [Job 743] argv[6]="/var/spool/cups/d00743-001"
D [15/Nov/2006:23:12:38 +0100] [Job 743] envp[0]="CUPS_CACHEDIR=/var/cache/cups"
--- CUT ---

The job is routed through my print accounting software PyKota, which begins
by logging its command line arguments and they are :

--- CUT ---
D [15/Nov/2006:23:12:39 +0100] [Job 743] PyKota (PID 20122) : Command line arguments : "/usr/lib/cups/backend/cupspykota" "743" "jerome" "facture20061100111.pdf" "2" "job-uuid=urn:uuid:f7041e29-4cd2-3cc6-7897-bbb44014f1e6"
--- CUT ---

Something is missing there, and I'd like to understand why.

So when PyKota's backend wrapper finally launches the original socket
backend for this particular printer, argv[6] has disappeared without
notice in CUPS' error_log. (The word 'argv' doesn't even appear in the
remaining of the log)

So although the number of copies "2" has been preserved, the input file
has not, and the socket backend prints the file only once, as can
be confirmed by looking at socket.c :

--- CUT ---
 /*
  * If we have 7 arguments, print the file named on the command-line.
  * Otherwise, send stdin instead...
  */

  if (argc == 6)
  {
    print_fd = 0;
    copies   = 1;
  }
  else
  {
   /*
    * Try to open the print file...
    */

    if ((print_fd = open(argv[6], O_RDONLY)) < 0)
    {
      perror("ERROR: unable to open print file");
      return (CUPS_BACKEND_FAILED);
    }

    copies = atoi(argv[4]);
  }
--- CUT ---

What's wrong there ?

I've got the complete log which is an 11 Kb gzipped file at :

        http://cgi.librelogiciel.com/error_log.gz

(you can remove PyKota logs and only keep CUPS' logs with 'zgrep -v 
PyKota error_log.gz') 

Thanks in advance for any explanation about why "lp -n 2" doesn't work
as expected.

bye

Jerome Alet





More information about the cups-devel mailing list