pstoturboprint filter fails with single quote (') in title

Questions on certain printers and applications
Post Reply
rcostine
Posts: 1
Joined: Mon Jul 02, 2007 3:31 pm

pstoturboprint filter fails with single quote (') in title

Post by rcostine »

pstoturboprint failed when attempting to print this page from firefox via cups on fedora fc6:

http://www.nobodix.org/seb/win2003_adminpass.html

The cups printer is defined as an IPP: printer, pointing to an IP address of a linksys PSUS4 network print server, which has a Canon MP530 connected to its usb port as printers/P1. The Test Page printed fine after install.

From the cups log it looks like the problem is in the filter. Namely, the filter script seems to fail with an unmatched quote if the title of the print job contains a single quote.

Here's the output from the turboprint_cups.log

----------- End of var file -----------
GSCOMMANDLINE=gs -sDEVICE=pcx24b -r600x600 -g5100x6600 -dSAFER -dNOPAUSE -dBATCH
TPCOMMANDLINE=/usr/bin/tpprint -a0 -e1 -s8500x11000 -v2 -l/var/log/turboprint_cups.log ---cpi=10 ---lpi=6 ---job-uuid=urn:uuid:17f8c1a4-9cba-31a2-4346-69cd51840a50 --ppdfile=/etc/cups/ppd/woodsprinter.ppd --psheader=/tmp/pstoturboprint3779.chunk --jobid=28 --username=rjc '--title=Seb's Corner'
COMPLETEPIPE=/usr/share/turboprint/lib/tpstdin --paste /tmp/pstoturboprint3779.chunk | gs -sDEVICE=pcx24b -r600x600 -g5100x6600 -dSAFER -dNOPAUSE -dBATCH -sOutputFile=/tmp/pstoturboprint3779.fifo - >> /var/log/turboprint_cups.log

And here's the output from the cups error_log:

D [02/Jul/2007:10:44:07 -0400] [Job 28] /usr/lib/cups/filter/pstoturboprint: eval: line 219: unexpected EOF while looking for matching `''
D [02/Jul/2007:10:44:07 -0400] [Job 28] /usr/lib/cups/filter/pstoturboprint: eval: line 220: syntax error: unexpected end of file

From the bash man page:

Enclosing characters in single quotes preserves the literal value of
each character within the quotes. A single quote may not occur between
single quotes, even when preceded by a backslash.

That's what looks like is happening when a single quote appears in the job title (in this case, the title of the web page).

--Rich




[/url]
zedonet
Site Admin
Posts: 2159
Joined: Fri Oct 06, 2006 8:02 am

Post by zedonet »

Hello,

thank you for your report!

This will be fixed in the next release. As a workaround you can edit /usr/lib/cups/filter/pstoturboprint and replace

Code: Select all

TPCOMMANDLINE="$TPPRINT -a0 -e1 -s${TPWIDTH}x$TPHEIGHT -v2 -l$LOGFILE $TPOPTION --ppdfile=$PPD --psheader=$CHUNKFILE --jobid=$JOBID --username=$2 '--title=$3'"
by

Code: Select all

TPCOMMANDLINE="$TPPRINT -a0 -e1 -s${TPWIDTH}x$TPHEIGHT -v2 -l$LOGFILE $TPOPTION --ppdfile=$PPD --psheader=$CHUNKFILE --jobid=$JOBID --username=$2"
(remove the argument '--title=$3').
Post Reply