system-config-printer crash UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 1441: invalid continuation byte (only UTF-8-encoded PPD files can be used)

Bug #1400232 reported by Doudz
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
system-config-printer (Ubuntu)
Undecided
Unassigned
Trusty
Undecided
Unassigned
Utopic
Undecided
Unassigned

Bug Description

system-config-printer crash with the following traceback :

sramage@japc09:~$ system-config-printer
Traceback (most recent call last):
  File "/usr/share/system-config-printer/asyncipp.py", line 191, in send_reply
    handler (self._conn, result)
  File "/usr/share/system-config-printer/asyncpk1.py", line 164, in _ipp_reply_handler
    self._client_reply_handler (self._conn, *args)
  File "/usr/share/system-config-printer/asyncconn.py", line 91, in reply_handler
    self._reply_handler (self, self._reply_data, *args)
  File "/usr/share/system-config-printer/asyncconn.py", line 209, in _subst_reply_handler
    reply_handler (self, *args)
  File "/usr/share/system-config-printer/ppdcache.py", line 79, in <lambda>
    self._got_ppd3 (c, name, r, callback),
  File "/usr/share/system-config-printer/ppdcache.py", line 153, in _got_ppd3
    self.fetch_ppd (name, callback, check_uptodate=False)
  File "/usr/share/system-config-printer/ppdcache.py", line 90, in fetch_ppd
    tmpf.writelines (f.readlines ())
  File "/usr/lib/python3.4/codecs.py", line 313, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 1441: invalid continuation byte

[Impact]

It is impossible to set up or manipulate a printer with a PPD file which is not UTF-8-encoded and no plain ASCII. Even worse, if such a PPD is installed into the system's PPD repository, the corresponding printer(s) will not auto-setup.

[Test Case]

Take a PPD file which is not UTF-8-encoded, for example a PPD file for Windows with Windows-1252 encoding. Try to set up a que with it or to change an existing queue to use it by means of system-config-printer. system-config-printer will crash.

With the proposed package the PPD can be used without problems.

[Regression Potential]

The changes are very simple and therefore the regression potential is low.

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

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in system-config-printer (Ubuntu):
status: New → Confirmed
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Tim, it seems that system-config-printer needs some facility to make it non-fatal when a (corrupted, broken, ...) PPD file containing bytes which cannot get UTF-8 decoded. Can you have a look?

Revision history for this message
Doudz (sebastien-ramage) wrote :

On my system the bug was caused by a PPD encoded in Windows-1252 instead of UTF-8.
After re-encoding the file, everything was fine !

It would be cool to have an error message like "Unable to read PPD file, please check the file".

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

Can you attach the PPD file? Is it part of the Ubuntu system or did you install it separately?

Changed in system-config-printer (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Tim Waugh (twaugh) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package system-config-printer - 1.5.4+20141212-0ubuntu1

---------------
system-config-printer (1.5.4+20141212-0ubuntu1) vivid; urgency=medium

  * New upstream release
     o GIT 1.5.x snapshot from 12 December 2014
     o Fixed all problems which prevented the automatic download of printer
       driver packages (LP: #1401835).
     o Handle non-UTF8 PPD files (LP: #1400232).
     o Use 'with' when dealing with temporary files.
     o troubleshoot: get logs from cups.service, not just cupsd
     o Avoid traceback (Red Hat bug #1171469).
     o Fixed 'Search' button icon.
     o Debug output showing DBus exception message.
     o Fixed display of downloadable drivers (Red Hat bug #1167978).
     o Prevent backtrace (Red Hat bug #1167978).
     o Refresh job-printer-uri in update_job
     o Consider version suffixes in Nickname for PPDs from Canon drivers
       (fedorahosted.org bug #235).
     o Extract hostname from hp:/net/...?hostname= URIs when grouping by
       physical device (Red Hat bug #1154686).
     o Codec fix for AuthDialog.get_auth_info (Red Hat bug #1060453).
     o Catch IPPError when writing server settings (Red Hat bug #1159584).
     o OpenPrintingRequest lock handling fixes
     o Never set SMB Verify button sensitive without checking pysmb is
       available
     o PackageKit-based installation of smb backend on demand is now fixed
     o Ubuntu fix for on demand installation of libsane-hpaio
     o HP MFP devices that cannot scan are now properly detected
     o ppdcache: handle errors more gracefully
     o Don't try to remove gobject sources that are already removed
     o A Python 3 fix when dealing with HPLIP fax devices
     o Fixed physical device grouping by using the cupshelpers.ppds
       'normalize' function for comparisons
     o Cancel deferred timer on quit (possible fix for Red Hat bug #1145388)
     o Don't use deprecated GTK+ widgets and properties
     o React to button-press-event for Move To submenu in jobviewer
       (LP: #1388601)
  * debian/patches/35_package-download-fixes.patch: Removed, included upstream.
 -- Till Kamppeter <email address hidden> Fri, 12 Dec 2014 19:41:08 +0100

Changed in system-config-printer (Ubuntu):
status: Incomplete → Fix Released
Changed in system-config-printer (Ubuntu Trusty):
status: New → Triaged
Changed in system-config-printer (Ubuntu Utopic):
status: New → Triaged
description: updated
summary: system-config-printer crash UnicodeDecodeError: 'utf-8' codec can't
- decode byte 0xe9 in position 1441: invalid continuation byte
+ decode byte 0xe9 in position 1441: invalid continuation byte (only
+ UTF-8-encoded PPD files can be used)
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Uploaded packages fixing bug 1398444, bug 1400232, and bug 1401835 to trusty-proposed and utopic-proposed. As soon as the packages are approved they will be available for download and testing and instructions will get posted here. Please test the packages and give your feedback here, otherwise they will not get available as official update.

Changed in system-config-printer (Ubuntu Trusty):
status: Triaged → In Progress
Changed in system-config-printer (Ubuntu Utopic):
status: Triaged → In Progress
Revision history for this message
Chris J Arges (arges) wrote : Please test proposed package

Hello Doudz, or anyone else affected,

Accepted system-config-printer into utopic-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/system-config-printer/1.5.1+20141010-0ubuntu2.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 add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and 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!

Changed in system-config-printer (Ubuntu Utopic):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Brian Murray (brian-murray) wrote :

Hello Doudz, or anyone else affected,

Accepted system-config-printer into trusty-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/system-config-printer/1.4.3+20140219-0ubuntu2.4 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 add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and 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!

Changed in system-config-printer (Ubuntu Trusty):
status: In Progress → Fix Committed
Revision history for this message
Doudz (sebastien-ramage) wrote :

I can't help since I'm working on utopic now and everything is fine since the last update 1.5.1+20141010-0ubuntu2.1

with this last update this is what I get from command line

Bad UTF-8 string "Module de finition/Bac r�cepteur" changed to "Module de finition/Bac r?cepteur"
Bad UTF-8 string "Bac � d�calage" changed to "Bac ? d?calage"
Bad UTF-8 string "Unit� de perforation" changed to "Unit? de perforation"
Bad UTF-8 string "Install�(e)" changed to "Install?(e)"
Bad UTF-8 string "Non install�(e)" changed to "Non install?(e)"
Bad UTF-8 string "Install�(e)" changed to "Install?(e)"
Bad UTF-8 string "Non install�(e)" changed to "Non install?(e)"

But everything is working.
I'll attach the bad ppd

Revision history for this message
Doudz (sebastien-ramage) wrote :

badly encoded ppd

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

Doudz thank you for the PPD file. I have tested the proposed package of system-config-printer with it and system-config-printer does not crash any more. I also get the same console messages as you got. So the proposed package for Trusty also fixes this bug. Marking as verified.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Verified by Doudz for Utopic (comment #10), by me for Trusty (comment #12).

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

The proposed system-config-printer package for Trusty got a dependency on cups-filters-ippusbxd accidentally (binary package system-config-printer-udev). Therefore please reject the package in trusty-proposed. I will upload a corrected -0ubuntu2.5 immediately then.

Changed in system-config-printer (Ubuntu Trusty):
status: Fix Committed → In Progress
tags: added: verification-done-utopic verification-failed-trusty
removed: verification-done
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Uploaded system-config-printer_1.4.3+20140219-0ubuntu2.5 to trusty-proposed with the dependency on cups-filters-ippusbxd removed. See bug 1409263.

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

This bug was fixed in the package system-config-printer - 1.5.1+20141010-0ubuntu2.2

---------------
system-config-printer (1.5.1+20141010-0ubuntu2.2) utopic-proposed; urgency=medium

  * debian/patches/70_package-download-fixes.patch: Fixed several bugs to
    make automatic printer driver download working again (LP: #1401835):
     o Use pyrequests instead of pycurl for secure (verified certificate)
       downloads. pycurl stopped working after the OpenPrinting web server
       has moved from Ubuntu 10.04 to 12.04 (LP: #1394244).
     o In the install-printerdriver script improved the check for the
       necessity of adding the driver's Debian repository and added a
       workaround for a bug in aptdaemon interpreting PackageKit's package
       IDs wrongly when installing a package (LP: #1397750).
     o In fillDriverList() use ".hasattr()" to check presence of
       attributes.
     o Python3 transition bugs
  * debian/patches/73_support-non-utf-8-encoded-ppds.patch: Do not
    crash on non-UTF-8-encoded PPD files (LP: #1400232)
  * debian/control: Depend on python-requests instead of on python-pycurl.
 -- Till Kamppeter <email address hidden> Sat, 13 Dec 2014 11:01:26 +0100

Changed in system-config-printer (Ubuntu Utopic):
status: Fix Committed → Fix Released
Revision history for this message
Chris J Arges (arges) wrote : Update Released

The verification of the Stable Release Update for system-config-printer has completed successfully and the package has now been 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
Till Kamppeter (till-kamppeter) wrote :

Re-subscribing ubuntu-sru for the SRU on Trusty.

Changed in system-config-printer (Ubuntu Trusty):
status: In Progress → Fix Committed
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

I have tested the new proposed package of system-config-printer for Trusty (-0ubuntu2.5) with the sample PPD file and system-config-printer does not crash any more. I also get the same console messages as shown. So this package also fixes this bug. Marking as verified.

tags: added: verification-done-trusty
removed: verification-failed-trusty
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package system-config-printer - 1.4.3+20140219-0ubuntu2.5

---------------
system-config-printer (1.4.3+20140219-0ubuntu2.5) trusty-proposed; urgency=medium

  * debian/patches/35_ipp-over-usb-support.patch: Removed, IPP-over-USB support
    was not yet intended with this SRU.
  * debian/control: Removed dependency on cups-filters-ippusbxd package
    (LP: #1409263).
 -- Till Kamppeter <email address hidden> Sat, 10 Jan 2014 17:19:26 +0100

Changed in system-config-printer (Ubuntu Trusty):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers