Bugs in resolution handling, especially garbage printed when invalid resolution value supplied

Bug #2022929 reported by Till Kamppeter
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libcupsfilters (Ubuntu)
Fix Released
High
Unassigned
Lunar
Fix Released
High
Unassigned
Mantic
Fix Released
High
Unassigned
libppd (Ubuntu)
Fix Released
High
Unassigned
Lunar
Fix Released
High
Unassigned
Mantic
Fix Released
High
Unassigned

Bug Description

This bug was originally reported upstream as

    https://github.com/OpenPrinting/libcupsfilters/issues/29

The reporter uses Fedora 38, besides Ubuntu 23.04 the second distro using cups-filters 2.x and libcupsfilters 2.x. As I am able to reproduce the bug on Ubuntu 23.04 and it is a problem many users could run into (it especially happens with driverless IPP printers) I post this bug report as base for an SRU in 23.04.

What happens is that if a job is printed and along with it a resolution setting is supplied which is not supported by the printer, garbage is printed as the job gets actually rasterized with the wrong resolution. This was discovered by the Chromium Browser sending print jobs with `-o resolution=96dpi` regardless which resolutions the printer actually supports. Most driverless printers receive their jobs rasterrized into Apple Raster or PWG Raster and so for them this bug occurs.

I have already fixed the bug upstream in libcupsfilters via

    https://github.com/OpenPrinting/libcupsfilters/commit/2892e9a63

The fix makes the function cfIPPAttrResolutionForPrinter() used more intensely, in which another bug showed, the list of supported resolutions searched for as a range data type which was wrong and so the list not being found. So I fixed this here, also in libcupsfilters:

    https://github.com/OpenPrinting/libcupsfilters/commit/9ff1341c2

Now unsupported resolutions supplied to jobs are ignored so that the default resolution gets used then.

The bug masked another bug in resolution handling which got revealed once the above-mentioned fix was applied.Here the problem is that for driverless IPP printers, printing in Apple Raster or PWG Raster always the minimum resolution got used, even if I higher one was requested, as the default resolution or by a job attribute/option which sets a higher resolution. This I fixed in libppd via:

    https://github.com/OpenPrinting/libppd/commit/e2190988ff6c1

Now always the correct resolution gets used for the rasterization of the job and so the correct print quality obtained.

The fixes get applied to the libcupsfilters and libppd source packages both in Mantic and in Lunar (SRU).

[ Impact ]

The bug impacts at least all users of driverless IPP printers which take print jobs in raster formats, and these are most common printers nowadays. Probably also other printers are affected.

The principal bug, jobs with unsupported resolution settings being accepted leads to unusable printouts wasting paper and toner/ink.

The secondary problem of always the lowest supported resolution being used leads to a lower print quality than expected.

The fact that the Chromium Browser from version 112 on (we use the Snap and current version there is 113) sens "-o resolution=96dpi" along with jobs will trigger this bug for many people.

[ Test Plan ]

Download the attached sample PPD file, a file to use the HP OfficeJet Pro 8730 in driverless mode, sending the job data in Apple Raster. Also have a PDF file handy.

No printer is required for the tests, simply observe the log output on the terminsl, the resolution used in the Ghostscript command line (the actual rasterization is done by Ghostscript).

cupsfilter -P driverless.ppd -m image/urf -o printer-resolution=96dpi file.pdf > out

The terminal output contains a line like

DEBUG: cfFilterGhostscript: Ghostscript command line: gs -dQUIET -dSAFER -dNOPAUSE -dBATCH -dNOINTERPOLATE -dNOMEDIAATTRS -dUsePDFX3Profile -sstdout=%stderr -sOutputFile=%stdout -sDEVICE=appleraster -sOutputType=automatic -r96x96 -dDEVICEWIDTHPOINTS=595 -dDEVICEHEIGHTPOINTS=842 -dcupsBitsPerColor=8 -dcupsColorOrder=0 -dcupsColorSpace=19 -dcupsBorderlessScalingFactor=0.0000 -dcupsInteger1=1 -dcupsInteger2=1 -scupsRenderingIntent=auto -scupsPageSizeName=A4 -dcupsManualCopies -I/usr/share/cups/fonts -sOutputICCProfile=srgb.icc -c -f -_

Note the "-r96x96" showing that the unsupported resolution got accepted for the rasterisation.

With the SRU applied we get "-r600x600" so the rasterisation is done with the default resolution of 600 dpi.

To reproduce the secondary problem of always the lowest resolution be used run

cupsfilter -P driverless.ppd -m image/urf file.pdf > out

Here you will get "-r300x300" despite the default resolution specified in the PPD file is 600 dpi ("*DefaultResolution: 600 dpi" in the PPD file). After applying the SRU you get the expected "-r600x600".

You get also the correct resolution according to the requested print quality:

cupsfilter -P driverless.ppd -m image/urf -o cupsPrintQuality=draft file.pdf > out

gives "-r300x300" after applying the SRU and

cupsfilter -P driverless.ppd -m image/urf -o cupsPrintQuality=normal file.pdf > out

and

cupsfilter -P driverless.ppd -m image/urf -o cupsPrintQuality=high file.pdf > out

both give "-r600x600" after applying the SRU.

You can also verify the resolution of the Apple Raster file "out" by installing rasterview

sudo snap install rasterview

and opening the file and see its metadata:

rasterview out

[ Where problems could occur ]

As the patches are rather small and the changes relatively easy to understand the potential for a regression is low but naturally not 100% excluded.

At least no complex changes in handling dynamic memory are contained, so the chance of having introduced a crasher is extremely low.

Changed in libcupsfilters (Ubuntu Lunar):
importance: Undecided → Critical
importance: Critical → High
Changed in libcupsfilters (Ubuntu Mantic):
importance: Undecided → High
Changed in libppd (Ubuntu Lunar):
importance: Undecided → High
Changed in libppd (Ubuntu Mantic):
importance: Undecided → High
description: updated
description: updated
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :
Changed in libcupsfilters (Ubuntu Mantic):
status: New → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libcupsfilters - 2.0~rc1-0ubuntu3

---------------
libcupsfilters (2.0~rc1-0ubuntu3) mantic; urgency=medium

  * libcupsfilters2.symbols: Added 2 riscv64-only symbols with (otional).

 -- Till Kamppeter <email address hidden> Mon, 5 Jun 2023 23:59:59 +0200

Changed in libcupsfilters (Ubuntu Mantic):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libppd - 2:2.0~rc1-0ubuntu2

---------------
libppd (2:2.0~rc1-0ubuntu2) mantic; urgency=medium

  * fix-mirrored-printout-when-ppd-has-mirrorprint-option.patch: When
    converting PPDs with “MirrorPrint” option into IPP attributes, setting
    of the option (“True”/“False”) was not considered, making printouts
    always come out mirrored (LP: #2018504).
  * fix-resolution-handling-on-ppd-to-ipp-attr-conversion.patch: For
    PPDs for driverless printers which take jobs in Apple/PWG Raster
    format always the lowest supported resolution got selected, regardless
    of the PPD default or job option settings (LP: #2022929).
  * ppdfilterpstops-fix-printers-with-reverse-output-order.patch:
    Printouts to PostScript printers (or printers with drivers which need
    PostScript input) which drop the pages face-up and therefore need to
    print in reverse order came out empty (Upstream issue #20,
    LP: #2022943).

 -- Till Kamppeter <email address hidden> Mon, 5 Jun 2023 19:46:27 +0200

Changed in libppd (Ubuntu Mantic):
status: New → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Till, or anyone else affected,

Accepted libppd into lunar-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/libppd/2:2.0~rc1-0ubuntu1.1 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 on 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 add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-lunar to verification-done-lunar. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-lunar. In either case, without details of your testing we will not be able to proceed.

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

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in libppd (Ubuntu Lunar):
status: New → Fix Committed
tags: added: verification-needed verification-needed-lunar
Revision history for this message
Brian Murray (brian-murray) wrote :

Hello Till, or anyone else affected,

Accepted libcupsfilters into lunar-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/libcupsfilters/2.0~rc1-0ubuntu1.1 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 on 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 add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-lunar to verification-done-lunar. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-lunar. In either case, without details of your testing we will not be able to proceed.

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

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in libcupsfilters (Ubuntu Lunar):
status: New → Fix Committed
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (libcupsfilters/2.0~rc1-0ubuntu1.1)

All autopkgtests for the newly accepted libcupsfilters (2.0~rc1-0ubuntu1.1) for lunar have finished running.
The following regressions have been reported in tests triggered by the package:

libppd/2:2.0~rc1-0ubuntu1 (amd64)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/lunar/update_excuses.html#libcupsfilters

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (libppd/2:2.0~rc1-0ubuntu1.1)

All autopkgtests for the newly accepted libppd (2:2.0~rc1-0ubuntu1.1) for lunar have finished running.
The following regressions have been reported in tests triggered by the package:

libppd/2:2.0~rc1-0ubuntu1.1 (amd64)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/lunar/update_excuses.html#libppd

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

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

Uploaded libppd 2:2.0~rc1-0ubuntu1.2 to fix the mentioned failing autopkgtest. The binary packages produced by it are absolutely identical with 2:2.0~rc1-0ubuntu1.1.

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

Installed libppd 2:2.0~rc1-0ubuntu1.1 and libcupsfilters 2.0~rc1-0ubuntu1.1 both from lunar-proposed. This fixes the bug as of the results of running the commands under [ Test Plan ] above.

Note that the binary packages produced by libppd 2:2.0~rc1-0ubuntu1.1 and 2:2.0~rc1-0ubuntu1.2 are identical, as the only difference between the packagges is in the autopkgtest script.

tags: added: verification-done verification-done-lunar
removed: verification-needed verification-needed-lunar
Revision history for this message
Sebastien Bacher (seb128) wrote :

Triggering libppd with migration-reference/0 also failed so that's not a regression

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

This bug was fixed in the package libppd - 2:2.0~rc1-0ubuntu1.1

---------------
libppd (2:2.0~rc1-0ubuntu1.1) lunar; urgency=medium

  * fix-mirrored-printout-when-ppd-has-mirrorprint-option.patch: When
    converting PPDs with “MirrorPrint” option into IPP attributes, setting
    of the option (“True”/“False”) was not considered, making printouts
    always come out mirrored (LP: #2018538).
  * fix-resolution-handling-on-ppd-to-ipp-attr-conversion.patch: For
    PPDs for driverless printers which take jobs in Apple/PWG Raster
    format always the lowest supported resolution got selected, regardless
    of the PPD default or job option settings (LP: #2022929).
  * ppdfilterpstops-fix-printers-with-reverse-output-order.patch:
    Printouts to PostScript printers (or printers with drivers which need
    PostScript input) which drop the pages face-up and therefore need to
    print in reverse order came out empty (Upstream issue #20,
    LP: #2022943).

 -- Till Kamppeter <email address hidden> Tue, 6 Jun 2023 08:59:59 +0200

Changed in libppd (Ubuntu Lunar):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libcupsfilters - 2.0~rc1-0ubuntu1.1

---------------
libcupsfilters (2.0~rc1-0ubuntu1.1) lunar; urgency=medium

  * ignore-unsupported-resolution-values.patch: If resolutions not supported
    by the printer are supplied alog with a job via "Resolution" or
    "printer-resolution", ignore them to prevent rasterization in the
    wrong resolution and garbage printed (Upstream issue #29, LP: #2022929).
  * cfippattrresolutionforprinter-resolution-list-not-ipp-range.patch:
    When searching for the "printer-resolution-supported" printer IPP
    attribute, do not consider it an IPP range type, as it is not, and
    so would not be found (LP: #2022929).

 -- Till Kamppeter <email address hidden> Tue, 6 Jun 2023 08:10:19 +0200

Changed in libcupsfilters (Ubuntu Lunar):
status: Fix Committed → Fix Released
Revision history for this message
Andreas Hasenack (ahasenack) wrote : Update Released

The verification of the Stable Release Update for libppd has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Steve Langasek (vorlon) wrote : Proposed package upload rejected

An upload of libppd to lunar-proposed has been rejected from the upload queue for the following reason: "This needs a new SRU bug about the autopkgtest regression for tracking; changelog currently only points to already-closed bugs".

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.