RELEASE FREEZE EXCEPTION: When requesting n copies, n*n or even n*n*n copies get printed

Bug #286048 reported by Till Kamppeter
14
Affects Status Importance Assigned to Milestone
cups (Ubuntu)
Fix Released
Critical
Unassigned
Intrepid
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: cups

Sending a PostScript job to a non-PostScript printer produces n*n copies instead of the requested n copies, also sending a non-PostScript job to a PostScript printer. A PostScript job sent to a PostScript printer produces even n*n*n copies.

You can test it with a command line like

lpr -#2 /usr/share/cups/data/testprint.ps

The problem is due to the calls of /usr/lib/cups/filter/pstops in the /usr/lib/cups/filter/pstopdf (used to print PostScript input files) and /usr/lib/cups/filter/cpdftocps (used to get PostScript output for PostScript printers) filters. There were called with the actual number of copies on their command line and so they produced n copies of the data stream, in addition to /usr/lib/cups/filter/pdftopdf. The fix is to set only one copy on the pstops command lines in the filters.

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

Not having the correct number of copy is a severe bug which we should not leave in the Intrepid release, therefore milestoning.

Changed in cups:
importance: Undecided → Critical
milestone: none → ubuntu-8.10
status: New → Triaged
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Fixed on Debian BZR, revision 561.

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

The fix is attached as a debdiff.

Please consider this bug report as Release Freeze exception request. I think we cannot ship Intrepid with the numver of copies functionality not working and wasting big amounts of paper. The fix is trivial and therefore there is no risk of regressions. I have tested the fix and now always the correct number of copies is printed.

pitti, please also upload to Debian, so that we can stay with synced packages.

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

till@till-laptop:~/ubuntu/cups$ diffstat cups_1.3.9-1_1.3.9-2.debdiff
 changelog | 10 ++++++++++
 filters/pstopdf | 2 +-
 local/filters/cpdftocps | 2 +-
 3 files changed, 12 insertions(+), 2 deletions(-)
till@till-laptop:~/ubuntu/cups$

Tested with the above command line, with PostScript and PDF files on PostScript and non-PostScript printers. All cases work correctly.

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

Benjamin Kay confirms in bug 286014 that the attached debdiff fixes this bug (286048).

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

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

---------------
cups (1.3.9-2) experimental; urgency=low

  * debian/local/filters/cpdftocps, debian/filters/pstopdf: Avoid duplicate
    execution of the number of copies. Sending a PostScript job to a
    non-PostScript printer produced n*n copies instead of n copies, also
    sending a non-PostScript job to a PostScript printer. A PostScript job
    sent to a PostScript printer could even produce n*n*n copies (LP: #286048).

 -- Martin Pitt <email address hidden> Mon, 20 Oct 2008 08:18:20 +0200

Changed in cups:
status: Fix Committed → Fix Released
Revision history for this message
Benjamin Kay (benkay) wrote :

I can confirm that the fix has been released. Works with cups 1.3.9-2 in the Intrepid release candidate. Thank you, Till!

Revision history for this message
J. Scott Berg (jsberg) wrote :

Unfortunately this fix seems to prevent my printer from printing multiple copies. Brother HL-5250DN.

lp -n 2 test.ps

prints a single copy. Editing /usr/lib/cups/filter/cpdftocps and putting back the "$4" gets me multiple copies again.

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

J. Scott Berg, can you please attach your PPD file (/etc/cups/ppd/<queue>.ppd)? Can you also attach a sample input file? Thanks.

Revision history for this message
J. Scott Berg (jsberg) wrote :
Revision history for this message
J. Scott Berg (jsberg) wrote :
Revision history for this message
J. Scott Berg (jsberg) wrote :

Most PostScript printers can print multiple copies by simply defining NumCopies in the dictionary fed to setpagedevice. Only pstops (called from cpdftocps, the last filter in the chain in my case) is capable of adding that code, so it must get fed the number of copies. Thus I don't think the patch could be right in the general case.

Revision history for this message
J. Scott Berg (jsberg) wrote :

Just tried to see if I could get n*n copes after putting the "$4" back into cpdftocps by using some of the printer's emulations, and no luck (or luck, depending on what you're looking for): when asking for 2 pages, both PCL6 and Epson 9-pin gave me 2 pages.

Revision history for this message
Benjamin Kay (benkay) wrote :

I, too, have a Brother HL-5250DN. Running:

lp -n 2 test.ps

on the file J. Scott Berg provided gets me a page that says "Test", a blank page, another page that says "Test", and then another blank page. Overall I get two copies, which is the expected behavior, and which is different than what Scott is getting with the same model of printer. I don't know if the blank pages I'm getting are expected behavior or not.

I've attached my PPD, which is different from Scott's. It's the one that's "recommended" during the printer installation process.

Ubuntu 8.10 Intrepid Ibex x86_64
cups 1.3.9-2ubuntu4

Revision history for this message
J. Scott Berg (jsberg) wrote :

There are actually two Brother HL-5250DN printers options: one is labeled HL-5250DN, the other is labeled HL-5250DN BR-Script3. The former is a foomatic-generated PPD, and has the line "*cupsManualCopies: True", and therefore never asks the printer hardware to do the copies. The latter lets the hardware do the copies (which I happen to think is the preferable option).

With some experimentation I was in fact finally able to get the n*n bug to be produced: by asking for collated copies. So, here's a table (sorry, the spacing will probably come out wrong):

cpdftocps PPD Collate Copies
mine foomatic True 2
mine foomatic False 2
mine BR-Script3 True 4
mine BR-Script3 False 2
2ubuntu3 foomatic True 2
2ubuntu3 foomatic False 2
2ubuntu3 BR-Script3 True 2
2ubuntu3 BR-Script3 False 1

The basic problem is that when there is a chain of filters, each filter has a shot at multiplying by the number of copies. In principle these scripts need to arrange things so that only one script makes a given modification. The scripts actually attempt to do this (some never multiply copies, some look at the PPD and decide whether they'll do it or let someone later do it). But the logic for doing this is not in shared code, so they can make different decisions. And in practice maybe it's hard to know where you are in the chain. It's not clear to me why something other than the last filter in the chain should be creating multiple copies and/or collating. That way all the logic would be in one place, and to make 10 copies of something you would delay pushing around a file that's 10 times as large as the original until the last possible moment (if at all).

Clearly the simple reversion of the patch is the wrong thing (this was clear from that start). Getting it right will be complicated I think. Presumably upstream doesn't have this problem (?), but I suspect there was some logic to switching to this PDF filter backend in Debian/Ubuntu.

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

Can you all please replace your /usr/lib/cups/filter/cpdftocps file by the attached one? Please make sure that you make the new file world-executable.

Do you get always the correct number of copies now?

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

Can you use this file instead of the one from the previous comment? I have done a slight improvement on it.

Revision history for this message
J. Scott Berg (jsberg) wrote :

Unfortunately, I get no copies with this cpdftocps. The following ends up in the PostScript that gets sent to the printer:

%RBIBeginNonPPDFeature: *NumCopies 0
0/languagelevel where{pop languagelevel 2 ge}{false}ifelse
{1 dict begin/NumCopies exch def currentdict end setpagedevice}
{userdict/#copies 3 -1 roll put}ifelse

Presumably your copies variable is getting assigned the null string.

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

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

---------------
cups (1.3.9-10) experimental; urgency=low

  [ Till Kamppeter ]
  * debian/local/filters/pdf-filters/pdftopdf/P2PCatalog.cxx,
    debian/local/filters/pdf-filters/pdftopdf/P2PCatalog.h,
    debian/local/filters/pdf-filters/pdftopdf/P2PDoc.cxx,
    debian/local/filters/pdf-filters/pdftopdf/P2PDoc.h,
    debian/local/filters/pdf-filters/pdftopdf/P2PPage.cxx,
    debian/local/filters/pdf-filters/pdftopdf/P2PPage.h,
    debian/local/filters/pdf-filters/pdftopdf/P2PPageTree.cxx,
    debian/local/filters/pdf-filters/pdftopdf/P2PPageTree.h,
    debian/local/filters/pdf-filters/pdftopdf/pdftopdf.cxx: Fixed problem
    of Landscape-oriented PDF files being printed in the wrong orientation
    (LP: #47649, LP: #244840).

  * debian/local/filters/cpdftocps: Made correct number of copies being
    printed on PostScript printers with hardware copy handling (LP: #286048).

  [ Martin Pitt ]
  * debian/local/apparmor-profile: Allow cupsd to run Brother drivers.
    (LP: #237256)

 -- Martin Pitt <email address hidden> Wed, 17 Dec 2008 07:46:04 +0100

Changed in cups:
status: Fix Committed → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote :

Accepted cups 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!

Changed in cups:
status: New → Fix Committed
Revision history for this message
J. Scott Berg (jsberg) wrote :

Manually installed 2ubuntu5 for intrepid (cups, cups-bsd, cups-client, cups-common, libcups2, libcupsimage2), same problem as previous comment (no copies).

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

Attached is another replacement for /usr/lib/cups/filter/cpdftocps. Please try

Revision history for this message
J. Scott Berg (jsberg) wrote :

This behaves fine with the BR-Script3 PPD, also with the footmatic PPD with the one exception that the foomatic PPD insists on collating even if you do "-o Collate=False." This is not a change in behavior, it does that with 2ubuntu4 as well.

Somebody with a printer that collates in hardware should probably test this as well (the HL-5250DN will make uncollated copies in hardware, it will not collate in hardware).

Revision history for this message
niclone (4-launchpad-nicospam-sengena-com) wrote :

I confirm that the latest cpdftocps filter (adding -a to grep) has resolved the printing problem for me. (I've just spend a lot of time to search why my printer was not working anymore, fond the bug, corrected myself, searched on cups svn this file that was not existing, to finally found this bug was reported here...)

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

Which Duplex setting did you use? If you print more than one copy double-sided, Collate is forced, as otherwise you will get two copies of each page on the front and on the back side of one sheet.

Revision history for this message
J. Scott Berg (jsberg) wrote :

Duplex is on (and the default at the printer), though I can't seem to force it off from the command line (I'm not the first: bug 47263). With the BR-Script3 PPD, it does the right thing from the command line with duplex on (i.e., Collate=False, 3 page document is 1-2-1-2-3-blank-3-blank, Collate=True is 1-2-3-blank-1-2-3-blank). Opening the same file with evince and printing from there, duplex on and collate off makes 1-1-2-2-3-3, duplex on and and collate on makes 1-2-3-1-2-3 (no blank back sides!). This happens with both the BR-Script3 and foomatic PPDs, both the old and the new cpdftocps. At least I can turn duplex off with evince. Attaching my 3-page test file for grins.

Revision history for this message
J. Scott Berg (jsberg) wrote :

Seems my evince-related comments are bug 158483.

Revision history for this message
Steve Langasek (vorlon) wrote :

I have marked this bug as 'verification failed' because I am no longer able to print from OOo or from evince after upgrading to the intrepid-proposed version of the package. Downgrading to the intrepid-updates version (1.3.9-2ubuntu4) makes my printer work again. 1.3.9-2ubuntu5 should not be copied to intrepid-updates.

My printer is an HP PSC 750, which I print to using hpoj.

Changed in cups:
status: Fix Committed → Confirmed
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Steve, I have already uploaded a fix as 1.3.9-2ubuntu6 into -proposed. I asked pitti to approve it, but he has already left for Christmas. Can you (or anyone else of the SRU team) approve it so that it gets into -proposed and tested here? Thanks.

Changed in cups:
status: Confirmed → Fix Committed
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :
Revision history for this message
Martin Pitt (pitti) wrote :

Updated version accepted into intrepid-proposed, please test:

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

  * debian/local/filters/cpdftocps: Fixed the fix for the number of copies.
    In some cases it failed and pstops was called with 0 copies
    requested. (LP: #309314)

 -- Till Kamppeter <email address hidden> Fri, 19 Dec 2008 15:58:55 +0100

Revision history for this message
Steve Langasek (vorlon) wrote :

Ok, I can confirm that printing works again for me with the -2ubuntu6 upload. It should still get broader testing from others before we consider this verified, to be sure there aren't other regressions with the latest change.

Revision history for this message
J. Scott Berg (jsberg) wrote :

Works for me.

Revision history for this message
Launchpad Janitor (janitor) wrote :

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

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

  * debian/local/filters/cpdftocps: Fixed the fix for the number of copies.
    In some cases it failed and pstops was called with 0 copies
    requested. (LP: #309314)

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

  [ Till Kamppeter ]
  * debian/local/filters/pdf-filters/pdftopdf/P2PCatalog.cxx,
    debian/local/filters/pdf-filters/pdftopdf/P2PCatalog.h,
    debian/local/filters/pdf-filters/pdftopdf/P2PDoc.cxx,
    debian/local/filters/pdf-filters/pdftopdf/P2PDoc.h,
    debian/local/filters/pdf-filters/pdftopdf/P2PPage.cxx,
    debian/local/filters/pdf-filters/pdftopdf/P2PPage.h,
    debian/local/filters/pdf-filters/pdftopdf/P2PPageTree.cxx,
    debian/local/filters/pdf-filters/pdftopdf/P2PPageTree.h,
    debian/local/filters/pdf-filters/pdftopdf/pdftopdf.cxx,
    debian/local/filters/pdf-filters/pdftopdf/P2PResources.cxx: Fixed problem
    of Landscape-oriented PDF files being printed in the wrong orientation
    (LP: #47649), added processing of the rotate tag (intrepid
    regression) (LP: #300312).
  * debian/local/filters/cpdftocps: Made correct number of copies
    being printed on PostScript printers with hardware copy handling
    (LP: #286048).

  [ Martin Pitt ]
  * debian/local/apparmor-profile: Allow cupsd to run Brother drivers.
    (LP: #237256)

 -- Till Kamppeter <email address hidden> Fri, 19 Dec 2008 15:58:55 +0100

Changed in cups:
status: Fix Committed → Fix Released
Revision history for this message
pd.crone (pd-crone) wrote :
Download full text (12.1 KiB)

I am running Mint Gloria (based on Intrepid); using a Canon LBP3100 which was faultless; installed acroread;

now cannot print at all; any text: error message

/usr/lib/cups/filter/cpdftocps failed

error log:

D [26/Nov/2009:09:36:17 +1300] cupsdCloseClient: 12
D [26/Nov/2009:09:36:17 +1300] cupsdAcceptClient: 12 from localhost (Domain)
D [26/Nov/2009:09:36:17 +1300] cupsdReadClient: 12 POST / HTTP/1.1
D [26/Nov/2009:09:36:17 +1300] cupsdAuthorize: No authentication data provided.
D [26/Nov/2009:09:36:17 +1300] Get-Jobs ipp://localhost/jobs/
D [26/Nov/2009:09:36:17 +1300] [Job 206] Loading attributes...
D [26/Nov/2009:09:36:17 +1300] cupsdProcessIPPRequest: 12 status_code=0 (successful-ok)
D [26/Nov/2009:09:36:17 +1300] cupsdCloseClient: 12
D [26/Nov/2009:09:36:17 +1300] cupsdAcceptClient: 12 from localhost (Domain)
D [26/Nov/2009:09:36:17 +1300] cupsdReadClient: 12 POST / HTTP/1.1
D [26/Nov/2009:09:36:17 +1300] cupsdAuthorize: No authentication data provided.
D [26/Nov/2009:09:36:17 +1300] Create-Printer-Subscription /
D [26/Nov/2009:09:36:17 +1300] cupsdCreateSubscription(con=0xb9606358(12), uri="/")
D [26/Nov/2009:09:36:17 +1300] pullmethod="ippget"
D [26/Nov/2009:09:36:17 +1300] notify-lease-duration=86400
D [26/Nov/2009:09:36:17 +1300] notify-time-interval=0
D [26/Nov/2009:09:36:17 +1300] cupsdAddSubscription(mask=17800, dest=(nil)(), job=(nil)(0), uri="(null)")
D [26/Nov/2009:09:36:17 +1300] Added subscription 97 for server
I [26/Nov/2009:09:36:17 +1300] Saving subscriptions.conf...
D [26/Nov/2009:09:36:17 +1300] cupsdProcessIPPRequest: 12 status_code=0 (successful-ok)
D [26/Nov/2009:09:36:17 +1300] cupsdCloseClient: 12
D [26/Nov/2009:09:36:18 +1300] cupsdAcceptClient: 12 from localhost (Domain)
D [26/Nov/2009:09:36:18 +1300] cupsdReadClient: 12 POST / HTTP/1.1
D [26/Nov/2009:09:36:18 +1300] cupsdAuthorize: No authentication data provided.
D [26/Nov/2009:09:36:18 +1300] Get-Notifications /
D [26/Nov/2009:09:36:18 +1300] cupsdIsAuthorized: requesting-user-name="pdc"
D [26/Nov/2009:09:36:18 +1300] cupsdProcessIPPRequest: 12 status_code=0 (successful-ok)
D [26/Nov/2009:09:36:18 +1300] cupsdCloseClient: 12
D [26/Nov/2009:09:36:26 +1300] cupsdAcceptClient: 12 from localhost (Domain)
D [26/Nov/2009:09:36:26 +1300] cupsdReadClient: 12 POST /printers/LBP3100 HTTP/1.1
D [26/Nov/2009:09:36:26 +1300] cupsdAuthorize: No authentication data provided.
D [26/Nov/2009:09:36:26 +1300] Print-Job ipp://localhost/printers/LBP3100
D [26/Nov/2009:09:36:26 +1300] add_job: requesting-user-name="pdc"
D [26/Nov/2009:09:36:26 +1300] Adding default job-sheets values "none,none"...
I [26/Nov/2009:09:36:26 +1300] [Job 207] Adding start banner page "none".
I [26/Nov/2009:09:36:26 +1300] Saving subscriptions.conf...
I [26/Nov/2009:09:36:26 +1300] [Job 207] Adding end banner page "none".
I [26/Nov/2009:09:36:26 +1300] [Job 207] File of type application/postscript queued by "pdc".
D [26/Nov/2009:09:36:26 +1300] [Job 207] hold_until=0
I [26/Nov/2009:09:36:26 +1300] [Job 207] Queued on "LBP3100" by "pdc".
I [26/Nov/2009:09:36:26 +1300] Saving subscriptions.conf...
D [26/Nov/2009:09:36:26 +1300] [Job 207] job-sheets=none,none
D [26/Nov/2009:09:36:26 +1300] [Job 207] bann...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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