Bug 837790

Summary: It's impossible to print more than one file in one lpr command to a cups-pdf printer
Product: [Fedora] Fedora Reporter: Joachim Backes <joachim.backes>
Component: cups-pdfAssignee: Robert Marcano <robert>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 31CC: fedora
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1717701 (view as bug list) Environment:
Last Closed: 2020-11-24 18:35:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1717701    
Attachments:
Description Flags
/etc/cups/cups-pdf.conf
none
Possible patch none

Description Joachim Backes 2012-07-05 09:22:40 UTC
Created attachment 596357 [details]
/etc/cups/cups-pdf.conf

Description of problem:
I tried to print more than one file to a cups-pdf printer in *one* lpr command.
But the printing fails:

1. In one case, only the first file is printed, but the generated pdf file is multilated
2. In most other cases, no file is printed (no pdf file is generated), and the lpq command shows that all print jobs remain in the print queue. I have to cleanup them with lprm, and additionally to restart cups. 

Version-Release number of selected component (if applicable):
cups-pdf-2.6.1-1.fc17.x86_64
cups-libs-1.5.2-12.fc17.i686
cups-1.5.2-12.fc17.x86_64
cups-libs-1.5.2-12.fc17.x86_64
cups-pk-helper-0.2.2-1.fc17.x86_64

How reproducible:

Almost all times

Steps to Reproduce:
1.lpr <file-1> <file-2> ... -P<pdf-printer>
2.
3.
  
Actual results:
see description

Expected results:
All file are properly printed into pdf-files

Additional info:

Comment 1 Joachim Backes 2012-07-05 09:26:28 UTC
section for the pdf printer in /etc/cups/printers.conf
------------------------------------------------------

<Printer PDF>
UUID urn:uuid:af88cddf-b230-3dcb-6c99-33a1e6a8cf74
Info PDF
MakeModel Generic CUPS-PDF Printer
DeviceURI cups-pdf:/
State Idle
StateTime 1341476143
Type 8450124
Accepting Yes
Shared Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy stop-printer
Option media na_letter_8.5x11in
Option output-bin face-down
Option print-color-mode color
Option print-quality 4
Option printer-resolution 300x300dpi
</Printer>

Comment 2 Joachim Backes 2012-07-05 09:30:04 UTC
cups-pdf specific lines in /var/log/cups/error.log:
---------------------------------------------------

W [02/Jul/2012:10:36:40 +0200] failed to find device: cups-PDF
W [03/Jul/2012:07:25:17 +0200] failed to find device: cups-PDF
W [05/Jul/2012:07:05:18 +0200] failed to find device: cups-PDF
W [05/Jul/2012:10:11:05 +0200] failed to find device: cups-PDF
W [05/Jul/2012:10:15:30 +0200] failed to find device: cups-PDF
W [05/Jul/2012:11:41:44 +0200] failed to find device: cups-PDF
W [05/Jul/2012:10:47:28 +0200] failed to find device: cups-PDF
W [05/Jul/2012:10:50:12 +0200] failed to find device: cups-PDF
W [05/Jul/2012:10:52:48 +0200] failed to find device: cups-PDF
W [05/Jul/2012:10:56:06 +0200] failed to find device: cups-PDF
W [05/Jul/2012:11:04:45 +0200] failed to find device: cups-PDF

Comment 3 Fedora End Of Life 2013-07-03 22:27:53 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 4 Joachim Backes 2013-07-04 03:49:53 UTC
Same problem in F19: "lpr -P<pdf-printer> /etc/passwd /etc/group": in the PDF target directory only the printed /etc/passwd appears, but no printout of /etc/group.

Comment 5 Joachim Backes 2013-10-24 05:26:28 UTC
Same behaviour in F20.

Comment 6 Fedora End Of Life 2017-07-25 18:30:36 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 7 Joachim Backes 2017-07-25 19:09:06 UTC
Same behaviour in F26

Comment 8 Joachim Backes 2017-11-14 08:58:27 UTC
Same behaviour in F27

Comment 9 Joachim Backes 2019-04-28 17:05:00 UTC
Same behaviour in F30!

Comment 10 Bryan Mason 2019-06-05 23:36:47 UTC
This problem occurs because cups-pdf stops processing input as soon as it sees %%EOF.  A multi-page document created by texttopaps, texttops, or a combination of texttpdf/pdftops has multiple

    %!Adobe-PS-3.0
    ...
    %%EOF

sequences in it (one for each file), so in a multi-file document, only the first file is processed and the rest is thrown out.

Comment 11 Bryan Mason 2019-06-06 00:52:30 UTC
Created attachment 1577736 [details]
Possible patch

This patch changes the way PS is read.  Instead of starting with "%!" (but not %!PS-AdobeFont") and ending at "%%EOF", it reads the entire input file, but only copies to the output those lines between "%!" and "%%EOF".  It also looks for "^D%!" as a beginning-of-document marker because the CUPS filters don't remove the EOF marker when concatenating PS files together and don't insert a newline after the EOF marker, so it ends up on the same line as the beginning of the next PS document, like:

  %!PS-Adobe-3.0
  ...
  %%EOF
  ^D%!PS-Adobe-3.0

Quick tests in Fedora 28 confirm that I can now run:

    lp -d cups-pdf /etc/fstab /etc/fstab /etc/fstab /etc/fstab

and a single four-page PDF document is created.

Comment 12 Bryan Mason 2019-06-06 01:02:53 UTC
I've also sent a message to Volker asking for inclusion of the patch upstream.

Comment 13 Joachim Backes 2020-03-07 17:18:48 UTC
Typo: use "mutilated" instead of "multilated"

Comment 14 Ben Cotton 2020-11-03 14:56:45 UTC
This message is a reminder that Fedora 31 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 31 on 2020-11-24.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '31'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 31 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 15 Joachim Backes 2020-11-03 17:24:50 UTC
Same behaviour in F33.

Comment 16 Ben Cotton 2020-11-24 18:35:51 UTC
Fedora 31 changed to end-of-life (EOL) status on 2020-11-24. Fedora 31 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 17 Joachim Backes 2020-11-24 18:49:00 UTC
Yes,I can reproduce this issue in fc33 as (see coment #15).