CUPS, foomatic, & pdftopdf fail when printing more than one copy of an image

Bug #345183 reported by TK
34
This bug affects 2 people
Affects Status Importance Assigned to Milestone
cups (Ubuntu)
Fix Released
High
kpmconnolly
Intrepid
Fix Released
High
Unassigned
Jaunty
Fix Released
High
Unassigned

Bug Description

Binary package hint: cupsys

When using Eye of Gnome or Gimp, and attempting to print multiple copies of the same image, CUPS experiences a rendering failure and nothing is printed. Printing one copy at a time (COPIES=1) of the same image works. When COPIES > 1, the renderer fails.

This problem exists in Intrepid 8.10 and Jaunty 9.04

example error_log entry:

D [11/Mar/2009:08:42:36 -0400] [Job 3562] GPL Ghostscript 8.63: Unrecoverable error, exit code 1
D [11/Mar/2009:08:42:36 -0400] [Job 3562] renderer exited with status 1
D [11/Mar/2009:08:42:36 -0400] [Job 3562] Possible error on renderer command line or PostScript error. Check options.Kid3 exit status: 3
E [11/Mar/2009:08:42:36 -0400] PID 14452 (/usr/lib/cups/filter/foomatic-rip) stopped with status 9!

Revision history for this message
TK (tkrishan) wrote :
Download full text (4.4 KiB)

Here's another example from Jaunty, updated from the main repository as of 20 March 2009.

The attempt is to print two copies of a 40k jpg image file using the Eye of Gnome to a HP 970C Deskjet.

Here is some information from the CUPS error_log with logging set to the 'debug' level.

I [20/Mar/2009:11:31:01 -0400] [Job 36] Queued on "HP970Cxi" by "tom".
I [20/Mar/2009:11:31:01 -0400] Saving subscriptions.conf...
D [20/Mar/2009:11:31:01 -0400] [Job 36] job-sheets=none,none
D [20/Mar/2009:11:31:01 -0400] [Job 36] banner_page = 0
D [20/Mar/2009:11:31:01 -0400] [Job 36] argv[0]="HP970Cxi"
D [20/Mar/2009:11:31:01 -0400] [Job 36] argv[1]="36"
D [20/Mar/2009:11:31:01 -0400] [Job 36] argv[2]="tom"
D [20/Mar/2009:11:31:01 -0400] [Job 36] argv[3]="164.JPG"
D [20/Mar/2009:11:31:01 -0400] [Job 36] argv[4]="2"
D [20/Mar/2009:11:31:01 -0400] [Job 36] argv[5]="Quality=FromPrintoutMode number-up=1 PrintoutMode=Normal Duplex=DuplexNoTumble PageSize=Letter job-uuid=urn:uuid:c3bf4733-78fd-3ab2-7d74-c670b9d6687f"
...
D [20/Mar/2009:11:31:01 -0400] [Job 36] Getting input from file
D [20/Mar/2009:11:31:01 -0400] [Job 36] foomatic-rip version 4.0.0.195 running...
...
D [20/Mar/2009:11:31:01 -0400] [Job 36] Parameter Summary
D [20/Mar/2009:11:31:01 -0400] [Job 36] -----------------
D [20/Mar/2009:11:31:01 -0400] [Job 36]
D [20/Mar/2009:11:31:01 -0400] [Job 36] Spooler: cups
D [20/Mar/2009:11:31:01 -0400] [Job 36] Printer: HP970Cxi
D [20/Mar/2009:11:31:01 -0400] [Job 36] Shell: /bin/bash
D [20/Mar/2009:11:31:01 -0400] [Job 36] PPD file: /etc/cups/ppd/HP970Cxi.ppd
D [20/Mar/2009:11:31:01 -0400] [Job 36] ATTR file:
D [20/Mar/2009:11:31:01 -0400] [Job 36] Printer model: HP Deskjet 970c Foomatic/hpijs, hpijs 2.8.7
D [20/Mar/2009:11:31:01 -0400] [Job 36] Job title: 164.JPG
...
D [20/Mar/2009:11:31:01 -0400] [Job 36]
D [20/Mar/2009:11:31:01 -0400] [Job 36] Filetype: PDF
D [20/Mar/2009:11:31:01 -0400] [Job 36] Storing temporary files in /var/spool/cups/tmp
E [20/Mar/2009:11:31:01 -0400] [Job 36] freed object:9 found
I [20/Mar/2009:11:31:01 -0400] Saving subscriptions.conf...
D [20/Mar/2009:11:31:01 -0400] [Job 36]
D [20/Mar/2009:11:31:01 -0400] PID 9410 (/usr/lib/cups/filter/pdftopdf) exited with no errors.
D [20/Mar/2009:11:31:01 -0400] [Job 36] File contains 4 pages

NOTE: the two copies are now expanded to a file containing 4 pages!

Ghostscript rendering fails at the next step, probably from a corrupt input.

D [20/Mar/2009:11:31:01 -0400] [Job 36] Starting renderer with command: gs -dFirstPage=1 -q -dBATCH -dPARANOIDSAFER -dQUIET -dNOPAUSE -sDEVICE=ijs -sIjsServer=hpijs -dDEVICEWIDTHPOINTS=612 -dDEVICEHEIGHTPOINTS=792 -sDeviceManufacturer="HEWLETT-PACKARD" -sDeviceModel="DESKJET 930" -dDuplex=true -dTumble=false -r300 -sIjsParams=Quality:Quality=0,Quality:ColorMode=2,Quality:MediaType=0,Quality:PenSet=2 -dIjsUseOutputFD -sOutputFile=- /var/spool/cups/tmp/foomatic-NAjuU1
D [20/Mar/2009:11:31:01 -0400] [Job 36] Starting process "kid3" (generation 1)
D [20/Mar/2009:11:31:01 -0400] [Job 36] Starting process "kid4" (generation 2)
D [20/Mar/2009:11:31:01 -0400] [Job 36] JCL: %-12345X@PJL
D [20/Mar/2009:11:31:01 -0400] [Job 36] <job data>
D [20/Mar/2009:11:31:01 -0...

Read more...

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Sorry for the late reply, there were more urgent things to do.

I have checked it and the problem is the pdftopdf filter. It breaks the PDF which comes out of eog when trying to generate the requested copies.

I will inform the upstream author of pdftopdf about this problem.

The creation of 4 pages is intended. Your HP DeskJet 970C is a duplex printer. To avoid that the next copy goes onto the back side of the current copy, blank pages are inserted.

Changed in cupsys (Ubuntu):
importance: Undecided → High
milestone: none → ubuntu-9.04
status: New → Triaged
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

For easy reproduction I have extracted the PDF output which eog sends to the printer and attached it. Run

/usr/lib/cups/filter/pdftopdf 1 1 1 2 "" eog-test-output.pdf > out.pdf

and Ghostscript will crash when you try to display the resulting PDF file with

gs out.pdf

evince will display the PDF file but issue warnings in the terminal window.

To let pdftopdf actually generate two copies do

PPD=/etc/cups/ppd/HP970Cxi.ppd /usr/lib/cups/filter/pdftopdf 1 1 1 2 "" eog-test-output.pdf > out.pdf

Revision history for this message
Paul Dufresne (paulduf) wrote :

I have marked bug #309515, only base on the similarity of the symptoms.
Feel free to clear duplicate mark if you think it was done with not enough info.

Revision history for this message
Mitchell (curious-mitchell) wrote : Re: [Bug 345183] Re: CUPS, foomatic, & pdftopdf fail when printing more than one copy of an image

Thanks Paul. I have since downgraded my system to Hardy Heron, and won't
be able to upgrade until this problem is fixed; printing multiples of a
file properly is essential for my business. Hopefully it will be fixed
in the next Long Term Service release, otherwise I'll be forced to go
with another distro. Cheers.

~dinky

Paul Dufresne wrote:
> I have marked bug #309515, only base on the similarity of the symptoms.
> Feel free to clear duplicate mark if you think it was done with not enough info.
>
>

Revision history for this message
Paul Dufresne (paulduf) wrote :

Ok, Thanks (dinky) for this information.

Till:
When you say:
"To let pdftopdf actually generate two copies do
PPD=/etc/cups/ppd/HP970Cxi.ppd /usr/lib/cups/filter/pdftopdf 1 1 1 2 "" eog-test-output.pdf > out.pdf"

If I understand that you try to set PPD while executing the filter, I think this does not works (at least for me):
paul@Arcturus:~$ TEST=56 echo $TEST

paul@Arcturus:~$

What works for me, is
paul@Arcturus:~$ TEST=56 ; echo $TEST
56
paul@Arcturus:~$

but then it is not temporary like I think you wanted.

Revision history for this message
Paul Dufresne (paulduf) wrote :

Ok, Sorry, It works.
It works if I use a mini script:
#!/bin/bash
echo CUPS=$CUPS
echo 0=$0 1=$1 2=$2 3=$3

paul@Arcturus:~$ CUPS=trio ./myecho
CUPS=trio
0=./myecho 1= 2= 3=

Revision history for this message
TK (tkrishan) wrote :

Till,

> To let pdftopdf actually generate two copies do...

I tried your example on 8.10 with CUPS 1.3.9-2ubuntu7. setting the environment variable to my local PPD file, HP970Cxi,ppd. HP970Cxi.ppd has duplexing set to on.

Invoking pdftopdf manually results in the same failure as when pdftopdf is run from within CUPS.

ERROR: freed object:9 found

I've attached the out.pdf file. The file out.pdf contains four pages, the first two are blank; page three contains the image, and page four is also blank.

Also, as you mentioned, evince opens the file with errors:
evince out.pdf
Error: Unknown pattern 'R1'
Error: Unknown pattern 'R1'
Error: Unknown pattern 'R1'
Error: Unknown pattern 'R1'

Revision history for this message
TK (tkrishan) wrote :

For completeness, here's my PPD file used in the previous message.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

I got a patch from upstream now and tested it and now pdftopdf works perfectly. I have applied the patch to the CUPS BZR repository at Debian. The fixed package will appear soon in Jaunty.

Changed in cups (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
TK (tkrishan) wrote :

On Mon, 2009-03-23 at 16:04 +0000, Till Kamppeter wrote:
> I got a patch from upstream now and tested it and now pdftopdf works
> perfectly. I have applied the patch to the CUPS BZR repository at
> Debian. The fixed package will appear soon in Jaunty.

Thank you very much for your assistance.

This bug also exists in Intrepid 8.10.

Would it be possible to also release this patch in the Intrepid pre-released repository (intrepid-proposed)?

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

We can make an SRU for that. The patch is simple but important.

Revision history for this message
TK (tkrishan) wrote :

On Mon, 2009-03-23 at 18:46 +0000, Till Kamppeter wrote:
> We can make an SRU for that. The patch is simple but important.

Can you provide some sort of time estimate when we might expect a SRU containing the pdftopdf patch for Intrepid 8.10?

If it is more than one week, I would ask that you post the patch or provide some direction as to where I might be able to download it.

Thank you.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

I have prepared an SRU to fix the bug in Intrepid. The fixed package will soon appear in -proposed.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :
Changed in cups (Ubuntu Intrepid):
importance: Undecided → High
status: New → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

Accepted into intrepid-proposed; please test and give feedback here. Please see https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: regression-release
Changed in cups (Ubuntu Intrepid):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
TK (tkrishan) wrote :

The intrepid-proposed fix corrects the problem for me. I have not done extensive testing but have installed the proposed fix on a production print server. I will provide additional feedback if I encounter problems.

Thank you.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cups - 1.3.9-16

---------------
cups (1.3.9-16) unstable; urgency=low

  [ Till Kamppeter ]
  * debian/local/filters/pdf-filters/pdftopdf/P2PResources.cxx: Fixed
    corruption of output when generating mmultiple copies of EOG or GIMP
    output files (LP: #345183).
  * debian/cups.postinst: Silenced non-fatal error messages when
    post-instyall script updates PPDs and there are PPDs not belonging to
    a CUPS queue in /etc/cups/ppd/ (LP: #345866).

  [ Martin Pitt ]
  * debian/local/apparmor-profile: Drop 'm' permission for /etc/passwd and
    friends, which was a workaround for a kernel apparmor bug on i386. This is
    fixed in current kernels. Thanks to Kees Cook for pointing this out!
    (LP: #270663)
  * debian/cups.install: Do not install the unnecessary (and broken) D-BUS
    configuration file any more. All cupsd does is to send signals, which are
    allowed by default. It does not provide any D-BUS service right now. Also
    remove the obsolete file on upgrades in debian/cups.preinst.
    (Closes: #510634, LP: #318742)
  * Add logfiles_adm_readable.dpatch: Make log files readable by group "adm".
    (LP: #345953)
  * debian/changelog: Fix cruft at the end of file.
  * debian/local/apparmor-profile: Explicitly deny access to /dev/tty and
    writing access to /etc/krb5.conf, so that accesses to them do not create
    log spewage. (LP: #348556)

 -- Martin Pitt <email address hidden> Fri, 27 Mar 2009 09:35:56 +0100

Changed in cups (Ubuntu Jaunty):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cups - 1.3.9-2ubuntu9

---------------
cups (1.3.9-2ubuntu9) intrepid-proposed; urgency=low

  [ Martin Pitt ]
  * Add bzr-builddeb configuration (merge mode). This does not cause any
    change in the built packages, but makes package maintenance easier.

  [ Till Kamppeter ]
  * debian/local/filters/pdf-filters/pdftopdf/P2PResources.cxx: Fixed
    corruption of output when generating multiple copies of EOG or GIMP
    output files. (LP: #345183)

 -- Till Kamppeter <email address hidden> Thu, 26 Mar 2009 11:56:14 +0100

Changed in cups (Ubuntu Intrepid):
status: Fix Committed → Fix Released
Revision history for this message
Colin Watson (cjwatson) wrote :

Copied to intrepid-updates following successful verification.

Changed in cups (Ubuntu):
assignee: nobody → kpmconnolly (kpmconnolly)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.