Printing not possible with line break or mis-interpreted encoding in job title

Bug #57445 reported by Ondřej Nový
8
Affects Status Importance Assigned to Milestone
CUPS
Fix Released
Undecided
Unassigned
cupsys (Ubuntu)
Fix Released
High
Martin Pitt
Dapper
Fix Released
Medium
Martin Pitt
foomatic-filters (Ubuntu)
Dapper
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: foomatic-filters

i can't print documents from Firefox with not iso-8859-1 character title.

Revision history for this message
Ondřej Nový (onovy) wrote :

cups say "/usr/lib/cups/filter/foomatic-rip failed"
log from foomatic-rip attached

Revision history for this message
Ondřej Nový (onovy) wrote :

after some testing, i think, maybe this is not encondig problem. this is another document that a can't print :( log attached, i'm trying to print from PDF AcrobatReader.

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

Concerning the first foomatic-rip log there is a newline in the job title, which seems to make GhostScript crashing, as CUPS seems to embed the job title somewhere in the PostScript data stream.

In current Edgy CUPS has some fixes concerning non-ASCII job titles. If you have Edgy handy, can you please update it to the newest state and check whether the problems still appear?

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

Can you attach all documents which you were not able to print (second foomatic-rip log looks like GhostScript bug or broken document)?

Changed in foomatic-filters:
status: Unconfirmed → Needs Info
status: Unconfirmed → Needs Info
Revision history for this message
Ondřej Nový (onovy) wrote :

Try print this in firefox (1.5.0.7):
http://cs.wikipedia.org/w/index.php?title=Alkalick%C3%BD_%C4%8Dl%C3%A1nek&printable=yes

if i print to file, and than print that postscript file it works fine.

sorry, but i can test it with edgy, it's production computer.

Changed in foomatic-filters:
status: Needs Info → Unconfirmed
status: Needs Info → Unconfirmed
Revision history for this message
Ondřej Nový (onovy) wrote :

can = can't sry
thx

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

I cannot print the mentioned web page both on Ubuntu Edgy and Mandriva 2007 (=> Upstream bug).

Printing to an HP LaserJet 4050 (with manufacturer-supplied PPD) with queue defined on Edgy with all updates (CUPS 1.2.3 with Debian patches, newest foomatic-filters, ...) lets the printer print an error message, so GhostScript and foomatic-filters are probably not the culprit for this bug.

Printing to an HP LaserJet 1022 on Mandriva 2007 (with CUPS 1.2.4) gives the following in /var/spool/cups/error_log:

D [26/Sep/2006:19:57:46 +0200] [Job 81] Starting renderer
D [26/Sep/2006:19:57:46 +0200] [Job 81] JCL: <job data>
D [26/Sep/2006:19:57:46 +0200] [Job 81]
D [26/Sep/2006:19:57:46 +0200] [Job 81] renderer PID kid4=1099
D [26/Sep/2006:19:57:46 +0200] [Job 81] renderer command: foo2zjs-wrapper -P -
z1 -L0 -r1200x600 -p9 -s7 -m1 -d1 -n1
D [26/Sep/2006:19:57:49 +0200] [Job 81] ESP Ghostscript 815.03: Unrecoverable er
ror, exit code 1
D [26/Sep/2006:19:57:49 +0200] [Job 81] cat: write error: Broken pipe
D [26/Sep/2006:19:57:49 +0200] [Job 81] Not a pbm file!
D [26/Sep/2006:19:57:49 +0200] [Job 81] tail process done writing data to STDOUT
D [26/Sep/2006:19:57:49 +0200] [Job 81] KID4 finished
D [26/Sep/2006:19:57:50 +0200] [Job 81] Wrote 1 pages...
D [26/Sep/2006:19:57:50 +0200] PID 1091 (/usr/lib/cups/filter/pstops) exited wit
h no errors.
D [26/Sep/2006:19:57:50 +0200] [Job 81]
D [26/Sep/2006:19:57:50 +0200] [Job 81] Closing renderer

So one sees that it always breaks while rendering PostScript, but independent of the interpreter.

So next investigations would be to similate a workflow without CUPS' pstops filter.

Changed in foomatic-filters:
status: Unconfirmed → Confirmed
status: Unconfirmed → Confirmed
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

If I choose "default" as the printer in Firefox and then click options I can choose a print command. I have chosen

kprinter ${MOZ_PRINTER_NAME:+'-P'}${MOZ_PRINTER_NAME}

(I have installed "kdebase" before). This command seems not to supply a job title but only a printer name. Then the kprinter dialog pops up and I choose the actual printer there. Then I click "Print" and this way both the LaserJet 4050 and the LaserJet 1022 print. So this seems to prove that really the job title breaks the processing bya CUPS.

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

It is a CUPS upstream bug, it is in /usr/lib/cups/filter/pstops.

To reproduce:

0. Do "sudo apt-get install gv" (Include universe in /etc/apt/sources.list if needed)

1. Create a PostScript file which does not contain a "%%Title:" line, either by printing from an appropriate application into a file (for example Firefox, document content does not matter) or by deleting this line from an existing PostScript file with a text editor.

2. Type

cat file.ps | /usr/lib/cups/filter/pstops 1 user a 1 "" > result.ps
gv result.ps

You will see your PostScript file in a window. Close the window

3.

Type

cat file.ps | /usr/lib/cups/filter/pstops 1 user 'a

and press <Enter>. Then type

b' 1 "" > result.ps

and press <Enter> again. You have made pstops now treating a job with the title "a<newline>b".

Do

gv result.ps

and you get an error.

So pstops cannot treat jobs whose titles have a newline inside, or where due to a misinterpreted encoding a byte of decimal value 13 (= ASCII value for newline) is not understood as part of a special character.

Reporting upstream ...

Changed in cupsys:
importance: Undecided → High
importance: Undecided → Medium
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :
Changed in cupsys:
status: Unconfirmed → Confirmed
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Mike Sweet has committed a fix to the SVN repository and also posted the fix as patch. We should pick up the patch to fix this bug.

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

Martin, did you already upload CUPS 1.2.4, Mike Sweet has posted a patch to fix this bug:

http://www.cups.org/str.php?L1988
http://www.cups.org/strfiles/1988/str1988.patch

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

The proposed upstream patch fixes the bug, I have done a short test on my Mandriva test box.

Attached is a slightly corrected version of the patch, as with the original on hunk fails on a the original CUPS 1.2.4 source.

Martin Pitt (pitti)
Changed in cupsys:
assignee: nobody → pitti
status: Confirmed → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

 cupsys (1.2.4-2ubuntu2) edgy; urgency=low
 .
   * debian/rules: Do not install http/ipp backend with 0700 permissions
     (regression from 1.2.4-2). Closes: LP#63707
   * Add debian/patches/00_dsc-comment-encoding.dpatch:
     - Fix printing of jobs with invalid/misinterpreted characters in the name.
     - Patch taken from upstream SVN, thanks to Till Kamppeter for porting it
       to 1.2.4. (STR#1988)
     - Closes: LP#57445

Changed in cupsys:
status: In Progress → Fix Released
Changed in cupsys:
status: Fix Committed → Fix Released
Changed in foomatic-filters:
status: Unconfirmed → Rejected
Martin Pitt (pitti)
Changed in cupsys:
assignee: nobody → pitti
Revision history for this message
Martin Pitt (pitti) wrote :

I cleaned up the patch (removed the reformatting), scrutinized it to verify that it makes sense and looks correct, and uploaded it to dapper-proposed:

cupsys (1.2.2-0ubuntu0.6.06.3) dapper-proposed; urgency=low

  * Add debian/patches/59_title_escaping.dpatch:
    - Escape non-ASCII characters in comment fields in the filters.
    - This fixes printing of documents with titles containing non-ASCII
      characters, line breaks, etc.
    - Patch backported from upstream SVN (dropped the formatting changes):
      http://www.cups.org/strfiles/1988/str1988.patch
    - LP #57445.
  * Skipping version number to .3 since .2 is in proposed and didn't verify.

 -- Martin Pitt <email address hidden> Fri, 10 Aug 2007 12:47:32 +0200

For verification, this is a cut&paste test which replicates the problem:

  grep -v '^%%Title' /usr/share/cups/data/testprint.ps | /usr/lib/cups/filter/pstops 1 `id -un` "`echo -e 'a\nb'`" 1 '' | gs -sDEVICE=x11 -

With current dapper cups, this will result in a ghostscript error. With the updated packages, the page will be displayed properly (without waiting, though).

Revision history for this message
Martin Pitt (pitti) wrote :

Accepted into dapper-proposed, needs QA testing. I successfully verified it myself.

Changed in cupsys:
status: Confirmed → Fix Committed
Revision history for this message
Brian Murray (brian-murray) wrote :

Verification passed:

Using cupsys version 1.2.2-0ubuntu0.6.06 I received an unrecoverable ghostscript error when using the commands provided by pitti.
Using cupsys version 1.2.2-0ubuntu0.6.06.3 I was able to briefly see a ghostcript test page and did not receive an unrecoverable error.

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks, Brian! Copied to dapper-updates.

Changed in cupsys:
status: Fix Committed → Fix Released
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.