foomatic fails when printing from OSX client, bash error [arg length ???]

Bug #1019662 reported by Brian Candler
28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
foomatic-filters (Ubuntu)
Fix Released
High
Unassigned
Precise
Fix Released
High
Till Kamppeter

Bug Description

Submitting PDF jobs from an OSX 10.7.4 laptop to a Linux desktop running 12.04 amd64 over CUPS/IPP, with USB-attached HP Laserjet 1020.

Job goes into "stopped" state. /var/log/cups/error.log shows:

...
D [30/Jun/2012:21:21:22 +0100] [Job 65] ================================================
D [30/Jun/2012:21:21:22 +0100] [Job 65]
D [30/Jun/2012:21:21:22 +0100] [Job 65] File: <STDIN>
D [30/Jun/2012:21:21:22 +0100] [Job 65]
D [30/Jun/2012:21:21:22 +0100] [Job 65] ================================================
D [30/Jun/2012:21:21:22 +0100] [Job 65]
D [30/Jun/2012:21:21:22 +0100] [Job 65] Filetype: PDF
D [30/Jun/2012:21:21:22 +0100] [Job 65] Neither PDF renderer command line nor Ghostscript-based renderer command line found
D [30/Jun/2012:21:21:22 +0100] [Job 65] Driver does not understand PDF input, converting to PostScript
D [30/Jun/2012:21:21:22 +0100] [Job 65] Storing temporary files in /var/spool/cups/tmp
D [30/Jun/2012:21:21:22 +0100] [Job 65] Starting process "pdf-to-ps" (generation 1)
D [30/Jun/2012:21:21:22 +0100] [Job 65] /bin/bash: -c: line 0: unexpected EOF while looking for matching `''
D [30/Jun/2012:21:21:22 +0100] [Job 65] /bin/bash: -c: line 1: syntax error: unexpected end of file
D [30/Jun/2012:21:21:22 +0100] [Job 65] Cannot process "<STDIN>": Unknown filetype.
D [30/Jun/2012:21:21:22 +0100] [Job 65] pdf-to-ps exited with status 1
D [30/Jun/2012:21:21:22 +0100] [Job 65] Process is dying with "Could not print file <STDIN>
D [30/Jun/2012:21:21:22 +0100] [Job 65] ", exit stat 2
D [30/Jun/2012:21:21:22 +0100] [Job 65] Cleaning up...
D [30/Jun/2012:21:21:22 +0100] [Job 65] prnt/backend/hp.c 839: ERROR: null print job total=0
D [30/Jun/2012:21:21:22 +0100] [Job 65] End of messages
D [30/Jun/2012:21:21:22 +0100] [Job 65] printer-state=3(idle)
D [30/Jun/2012:21:21:22 +0100] [Job 65] printer-state-message="/usr/lib/cups/filter/foomatic-rip failed"
D [30/Jun/2012:21:21:22 +0100] [Job 65] printer-state-reasons=none
E [30/Jun/2012:21:26:29 +0100] [Job 65] Stopping unresponsive job!

I refer especially to the log line "/bin/bash: -c: line 0: unexpected EOF while looking for matching `''

[Impact] Printing from Mac OS X clients to all printers with foo2zjs drivers ("Foomatic/foo2...") and with Foomatic-based PostScript drivers ("Foomatic/Postscript") does not work. Also local printing to printers with these drivers will not work in some cases.

[Test Case] To reproduce without having the appropriate printer (foo2zjs must be installed):

cupsctl FileDevice=yes
cupsctl LogLevel=debug
lpadmin -p test -E -v file:/tmp/printout -m foo2zjs:0/ppd/foo2zjs/Samsung-CLP-610.ppd
lp -d test -o testoption=`perl -e 'for($i = 0; $i < 200; $i ++) { $a .= sprintf ("%10d", $i) }; $a =~ s/ /-/g; print "$a\n"; '` ~/.bashrc
lpstat -o

Note that the Perl magic generates a string which is 2000 characters long. This will be inserted as value for the option "testoption". foomatic-rip of Precise will error out as shown above. The job will hang in the queue.

After installing the proposed package and reprinting the job (via the job viewer) or sending the job again one will see that these jobs get printed (job gets removed from the queue, /tmp/printout will contain the print data).

[Regression Potential] The two fix in the C code is trivial, only the maximum length for a string will be raised, so regressions cannot be caused.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: foomatic-filters 4.0.16-0ubuntu0.1
ProcVersionSignature: Ubuntu 3.2.0-25.40-generic 3.2.18
Uname: Linux 3.2.0-25-generic x86_64
ApportVersion: 2.0.1-0ubuntu8
Architecture: amd64
Date: Sat Jun 30 21:49:08 2012
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425)
Lpstat: device for HP-LaserJet-1020: hp:/usb/HP_LaserJet_1020?serial=JL3FLCA
MachineType: Dell Inc. Inspiron 400
Papersize: a4
PpdFiles: HP-LaserJet-1020: HP LaserJet 1020 Foomatic/foo2zjs-z1 (recommended)
ProcEnviron:
 LANGUAGE=en_GB:en
 TERM=xterm
 PATH=(custom, user)
 LANG=en_GB.UTF-8
 SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.2.0-25-generic root=UUID=81f2a233-7bda-4350-902f-2e7fcdad5f94 ro quiet splash vt.handoff=7
SourcePackage: foomatic-filters
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 09/04/2009
dmi.bios.vendor: Dell Inc.
dmi.bios.version: A01
dmi.board.name: 03D1TV
dmi.board.vendor: Dell Inc.
dmi.board.version: A00
dmi.chassis.type: 3
dmi.chassis.vendor: Dell Inc.
dmi.chassis.version: Not Specified
dmi.modalias: dmi:bvnDellInc.:bvrA01:bd09/04/2009:svnDellInc.:pnInspiron400:pvr00:rvnDellInc.:rn03D1TV:rvrA00:cvnDellInc.:ct3:cvrNotSpecified:
dmi.product.name: Inspiron 400
dmi.product.version: 00
dmi.sys.vendor: Dell Inc.

Revision history for this message
Brian Candler (b-candler) wrote :
Revision history for this message
Brian Candler (b-candler) wrote :

Additional info: OSX client shows "/usr/lib/cups/filter/foomatic-rip failed" and "Error: job stopped on server"

On the server, running "strace -s 2048 -v -f -p <pid of cups> 2>log" before submitting the job, I captured the following:

...
[pid 16670] execve("/bin/bash", ["/bin/bash", "-c", "pdftops '78' 'brian' 'test.pdf' '1' ' AP_ColorMatchingMode=AP_ApplicationColorMatching AP_D_InputSlot= nocollate com.apple.print.DocumentTicket.PMSpoolFormat=application/pdf com.apple.print.JobInfo.PMApplicationName=Preview com.apple.print.JobInfo.PMJobName=test.pdf com.apple.print.JobInfo.PMJobOwner=Brian\\ Candler com.apple.print.PageToPaperMappingMediaName=A4 com.apple.print.PageToPaperMappingType..n.=1 com.apple.print.PrinterInfo.PMColorDeviceID..n.=9784 com.apple.print.PrintSettings.PMColorMatchingMode..n.=0 com.apple.print.PrintSettings.PMColorSpaceModel..n.=1 com.apple.print.PrintSettings.PMColorSyncProfileID..n.=1580 com.apple.print.PrintSettings.PMCopies..n.=1 com.apple.print.PrintSettings.PMCopyCollate..b. com.apple.print.PrintSettings.PMDestinationType..n.=1 com.apple.print.PrintSettings.PMFirstPage..n.=1 com.apple.print.PrintSettings.PMLastPage..n.=2147483647 com.apple.print.PrintSettings.PMPageRange..a.0..n.=1 com.apple.print.PrintSettings.PMPageRange..a.1..n.=2147483647 com.apple.print.PrintSett"], ["CUPS_CACHEDIR=/var/cache/cups", "CUPS_DATADIR=/usr/share/cups", "CUPS_DOCROOT=/usr/share/cups/doc-root", "CUPS_FONTPATH=/usr/share/cups/fonts", "CUPS_REQUESTROOT=/var/spool/cups", "CUPS_SERVERBIN=/usr/lib/cups", "CUPS_SERVERROOT=/etc/cups", "CUPS_STATEDIR=/var/run/cups", "HOME=/var/spool/cups/tmp", "PATH=/usr/lib/cups/filter:/usr/bin:/usr/sbin:/bin:/usr/bin", "SERVER_ADMIN=root@zino", "SOFTWARE=CUPS/1.5.3", "TMPDIR=/var/spool/cups/tmp", "USER=root", "CUPS_SERVER=/var/run/cups/cups.sock", "CUPS_ENCRYPTION=IfRequested", "IPP_PORT=631", "CHARSET=utf-8", "LANG=en_US.UTF-8", "PPD=/etc/cups/ppd/HP-LaserJet-1020.ppd", "RIP_MAX_CACHE=128m", "CONTENT_TYPE=application/pdf", "DEVICE_URI=hp:/usb/HP_LaserJet_1020?serial=JL3FLCA", "PRINTER_INFO=Hewlett-Packard HP LaserJet 1020", "PRINTER_LOCATION=zino", "PRINTER=HP-LaserJet-1020", "PRINTER_STATE_REASONS=none", "CUPS_FILETYPE=document", "FINAL_CONTENT_TYPE=printer/HP-LaserJet-1020", "AUTH_INFO_REQUIRED=none", "GS_LIB=/usr/share/cups/fonts"] <unfinished ...>

The length of the string "pdftops '78' ...... com.apple.print.PrintSett" is exactly 1024 bytes, not including the outside double-quotes, so it looks like some fixed-sized internal buffer has been hit on the job properties.

(Aside: quite why a shell is being used here, rather than execve of pdftops directly, is unclear to me)

summary: - foomatic pdf jobs stopped, bash error
+ foomatic fails when printing from OSX client, bash error
Revision history for this message
Dave Gilbert (ubuntu-treblig) wrote : Re: foomatic fails when printing from OSX client, bash error

High=>'Has a severe impact on a small portion of Ubuntu users' (not being able to print some random proportion of their docs for no obvious reason; although I could believe it could be a medium, but there again I assume cups is core). I also worry about whether there is any way from this to be able to get something else into the bash line, but I can't immediately see it.

Changed in foomatic-filters (Ubuntu):
importance: Undecided → High
summary: - foomatic fails when printing from OSX client, bash error
+ foomatic fails when printing from OSX client, bash error [arg length
+ ???]
Revision history for this message
Yann Dupont (yann-dupont) wrote :

I have the exact same problem, but with a different scenario ;
I just connected a new printer on my system ; (canon C5030i). All is working well
except when I print PDF files from evince, where it fails with the exact same messages previously reported.

(that is, bash problem & /usr/lib/cups/filter/foomatic-rip failed)

The funny part is that printint PDF is OK with adobe reader OR okular.

So the PDF handling is probably different between evince and the rest. Don't know how this lead to the very same bug of printing PDF from a remote apple computer ?

Ho, and I can't say if the bug is new or not, I just connected the printer this morning.

Changed in foomatic-filters (Ubuntu):
status: New → In Progress
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Dave, Yann, I have uploaded a new version of the foomatic-filters package to my PPA for testing. Please follow the instructions on

https://launchpad.net/~till-kamppeter/+archive/ppa

section "Adding this PPA to your system" and after that do a system update. Please tell whether this solves your problem.

Revision history for this message
Yann Dupont (yann-dupont) wrote :

It works !
many thanks !

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

This bug was fixed in the package foomatic-filters - 4.0.17-0ubuntu1

---------------
foomatic-filters (4.0.17-0ubuntu1) quantal; urgency=low

  * New upstream release
     - foomaticrip.h: Raised PATH_MAX to 65536 bytes so that CUPS
       filter calls with many command line options work (LP: #1019662).
     - options.c, renderer.c: Fixed problems discovered by a Coverity scan
       (Upstream bug #752).
 -- Till Kamppeter <email address hidden> Mon, 2 Jul 2012 17:16:03 +0200

Changed in foomatic-filters (Ubuntu):
status: In Progress → Fix Released
Changed in foomatic-filters (Ubuntu Precise):
status: New → Triaged
importance: Undecided → Medium
importance: Medium → High
milestone: none → ubuntu-12.04.1
description: updated
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Uploaded a fixed foomatic-filters package for Precise to -proposed. Please test the package as soon as it is made available., We will inform you and give installation instructions in a separate comment. Your testing and your feedback is required to make the package an official update for Precise.

To the SRU team: debdiff attached.

Revision history for this message
Brian Candler (b-candler) wrote :

I will test shortly.

(Aside: it seems unwise to name the constant PATH_MAX when this is also a well-known standard constant in <limits.h>)

Revision history for this message
Brian Candler (b-candler) wrote :

Packages from the till-kamppeter PPA work nicely, thank you!

Capture from strace below. Length of bash command line is 1535 bytes.

[pid 9544] execve("/bin/bash", ["/bin/bash", "-c", "pdftops '81' 'brian' 'test2.pdf' '1' ' AP_ColorMatchingMode=AP_ApplicationColorMatching AP_D_InputSlot= nocollate com.apple.print.DocumentTicket.PMSpoolFormat=application/pdf com.apple.print.JobInfo.PMApplicationName=Preview com.apple.print.JobInfo.PMJobName=test2.pdf com.apple.print.JobInfo.PMJobOwner=Brian\\ Candler com.apple.print.PageToPaperMappingMediaName=A4 com.apple.print.PageToPaperMappingType..n.=1 com.apple.print.PrinterInfo.PMColorDeviceID..n.=9784 com.apple.print.PrintSettings.PMColorMatchingMode..n.=0 com.apple.print.PrintSettings.PMColorSpaceModel..n.=1 com.apple.print.PrintSettings.PMColorSyncProfileID..n.=1580 com.apple.print.PrintSettings.PMCopies..n.=1 com.apple.print.PrintSettings.PMCopyCollate..b. com.apple.print.PrintSettings.PMDestinationType..n.=1 com.apple.print.PrintSettings.PMFirstPage..n.=1 com.apple.print.PrintSettings.PMLastPage..n.=2147483647 com.apple.print.PrintSettings.PMPageRange..a.0..n.=1 com.apple.print.PrintSettings.PMPageRange..a.1..n.=2147483647 com.apple.print.PrintSettings.PMTotalBeginPages..n.=1 com.apple.print.PrintSettings.PMTotalSidesImaged..n.=1 DestinationPrinterID=Hewlett_Packard_HP_LaserJet_1020___zino Duplex=None job-impressions=1 job-originating-host-name=10.69.255.4 job-uuid=urn:uuid:b6821b76-71ba-35bf-7763-37dac787fbe8 media=A4 PageSize=A4 PaperInfoIsSuggested..b. noPDFIsProtected..b. pserrorhandler-requested=standard sides=one-sided time-at-creation=1341255672 time-at-processing=1341255675 time-at-creation=1341255675' '/var/spool/cups/tmp/foomatic-aaoHxM'"], ["CUPS_CACHEDIR=/var/cache/cups", "CUPS_DATADIR=/usr/share/cups", "CUPS_DOCROOT=/usr/share/cups/doc-root", "CUPS_FONTPATH=/usr/share/cups/fonts", "CUPS_REQUESTROOT=/var/spool/cups", "CUPS_SERVERBIN=/usr/lib/cups", "CUPS_SERVERROOT=/etc/cups", "CUPS_STATEDIR=/var/run/cups", "HOME=/var/spool/cups/tmp", "PATH=/usr/lib/cups/filter:/usr/bin:/usr/sbin:/bin:/usr/bin", "SERVER_ADMIN=root@zino", "SOFTWARE=CUPS/1.5.3", "TMPDIR=/var/spool/cups/tmp", "USER=root", "CUPS_SERVER=/var/run/cups/cups.sock", "CUPS_ENCRYPTION=IfRequested", "IPP_PORT=631", "CHARSET=utf-8", "LANG=en_US.UTF-8", "PPD=/etc/cups/ppd/HP-LaserJet-1020.ppd", "RIP_MAX_CACHE=128m", "CONTENT_TYPE=application/pdf", "DEVICE_URI=hp:/usb/HP_LaserJet_1020?serial=JL3FLCA", "PRINTER_INFO=Hewlett-Packard HP LaserJet 1020", "PRINTER_LOCATION=zino", "PRINTER=HP-LaserJet-1020", "PRINTER_STATE_REASONS=none", "CUPS_FILETYPE=document", "FINAL_CONTENT_TYPE=printer/HP-LaserJet-1020", "AUTH_INFO_REQUIRED=none", "GS_LIB=/usr/share/cups/fonts"]) = 0

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

Yann, Brian, thank you very much for testing. Please stay tuned as in some days the proposed package for the Precise update will be made available here. Please test that package as soon as it is available as your feedback is required to make the package an official update.

Changed in foomatic-filters (Ubuntu Precise):
assignee: nobody → Till Kamppeter (till-kamppeter)
Changed in foomatic-filters (Ubuntu Precise):
status: Triaged → Fix Committed
Revision history for this message
Colin Watson (cjwatson) wrote : Please test proposed package

Hello Brian, or anyone else affected,

Accepted foomatic-filters into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/foomatic-filters/4.0.16-0ubuntu0.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

tags: added: verification-needed
Revision history for this message
Brian Candler (b-candler) wrote :

I updated to foomatic-filters_4.0.16-0ubuntu0.2_amd64.deb and printing from OSX is fine. Thank you!

tags: added: verification-done
removed: verification-needed
Revision history for this message
Yann Dupont (yann-dupont) wrote :

I also confirm that foomatic-filters_4.0.16-0ubuntu0.2 from proposed is working well.
Thank you very much.

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

This bug was fixed in the package foomatic-filters - 4.0.16-0ubuntu0.2

---------------
foomatic-filters (4.0.16-0ubuntu0.2) precise-proposed; urgency=low

  * debian/patches/path_max_65536.patch: Raised length of fixed-length strings
    for CUPS filter calls to 65536 bytes, to assure that the filter command
    lines get built correctly also with very many command line options
    (LP: #1019662).
 -- Till Kamppeter <email address hidden> Mon, 2 Jul 2012 18:27:03 +0200

Changed in foomatic-filters (Ubuntu Precise):
status: Fix Committed → Fix Released
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.