[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#818469: /usr/share/hplip/base/sixext.py: Printing from some PDF files fails in pdftops conversion with python UTF8 error



Package: hplip-data
Version: 3.16.2+repack0-7
Severity: normal
File: /usr/share/hplip/base/sixext.py
Tags: patch

Dear Debian Maintainer,

Trying to print some PDF files from atril (MATE's desktop environment viewer) fails
with print error:

"There was a problem processing document ..."

I tried with the hplip-data in testing (3.16.2+repack0-4), and the one in
unstable (3.16.2+repack0-7).

This is the relevant part of  /var/log/cups/error_log, (with usernames
and IP adresses edited)
==================================================
E [17/Mar/2016:09:27:43 +0100] [Job 267] Job stopped due to filter errors; please consult the error_log file for details.
D [17/Mar/2016:09:27:43 +0100] [Job 267] The following messages were recorded from 09:27:43 to 09:27:43
D [17/Mar/2016:09:27:43 +0100] [Job 267] Adding start banner page "none".
D [17/Mar/2016:09:27:43 +0100] [Job 267] Adding end banner page "none".
D [17/Mar/2016:09:27:43 +0100] [Job 267] File of type application/pdf queued by "XXXXX".
D [17/Mar/2016:09:27:43 +0100] [Job 267] hold_until=0
D [17/Mar/2016:09:27:43 +0100] [Job 267] Queued on "HP-LaserJet-600-M601" by "XXXXX".
D [17/Mar/2016:09:27:43 +0100] [Job 267] time-at-processing=1458203263
D [17/Mar/2016:09:27:43 +0100] [Job 267] 3 filters for job:
D [17/Mar/2016:09:27:43 +0100] [Job 267] pdftopdf (application/pdf to application/vnd.cups-pdf, cost 66)
D [17/Mar/2016:09:27:43 +0100] [Job 267] pdftops (application/vnd.cups-pdf to application/vnd.cups-postscript, cost 100)
D [17/Mar/2016:09:27:43 +0100] [Job 267] hpps (application/vnd.cups-postscript to printer/HP-LaserJet-600-M601, cost 0)
D [17/Mar/2016:09:27:43 +0100] [Job 267] job-sheets=none,none
D [17/Mar/2016:09:27:43 +0100] [Job 267] argv[0]="HP-LaserJet-600-M601"
D [17/Mar/2016:09:27:43 +0100] [Job 267] argv[1]="267"
D [17/Mar/2016:09:27:43 +0100] [Job 267] argv[2]="XXXXX"
D [17/Mar/2016:09:27:43 +0100] [Job 267] argv[3]="eldiario.pdf — (eldiario.es - Periodismo a pesar de todo)"
D [17/Mar/2016:09:27:43 +0100] [Job 267] argv[4]="1"
D [17/Mar/2016:09:27:43 +0100] [Job 267] argv[5]="HPPrintQuality=FastRes1200 HPTHDigit=0 noHPEdgeToEdge HPPaperSource=AutomaticallySelect noHPEconoMode number-up-layout=lrtb PageSize=A4 noHPPinPrnt number-up=2 HPSEDigit=0 OutputBin=None Duplex=DuplexNoTumble MediaType=Unspecified HPFIDigit=0 HPFTDigit=0 job-uuid=urn:uuid:da7298d8-1b7d-3a9c-7e81-fa385d8c411b media=iso-a4 job-originating-host-name=localhost date-time-at-creation= date-time-at-processing= time-at-creation=1458203263 time-at-processing=1458203263"
D [17/Mar/2016:09:27:43 +0100] [Job 267] argv[6]="/var/spool/cups/d00267-001"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[0]="CUPS_CACHEDIR=/var/cache/cups"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[1]="CUPS_DATADIR=/usr/share/cups"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[2]="CUPS_DOCROOT=/usr/share/cups/doc-root"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[3]="CUPS_FONTPATH=/usr/share/cups/fonts"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[4]="CUPS_REQUESTROOT=/var/spool/cups"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[5]="CUPS_SERVERBIN=/usr/lib/cups"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[6]="CUPS_SERVERROOT=/etc/cups"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[7]="CUPS_STATEDIR=/var/run/cups"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[8]="HOME=/var/spool/cups/tmp"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[9]="PATH=/usr/lib/cups/filter:/usr/bin:/usr/sbin:/bin:/usr/bin"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[10]="SERVER_ADMIN=root@debian-machine"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[11]="SOFTWARE=CUPS/2.1.3"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[12]="TMPDIR=/var/spool/cups/tmp"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[13]="USER=root"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[14]="CUPS_MAX_MESSAGE=2047"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[15]="CUPS_SERVER=/var/run/cups/cups.sock"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[16]="CUPS_ENCRYPTION=IfRequested"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[17]="IPP_PORT=631"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[18]="CHARSET=utf-8"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[19]="LANG=en.UTF-8"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[20]="PPD=/etc/cups/ppd/HP-LaserJet-600-M601.ppd"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[21]="RIP_MAX_CACHE=128m"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[22]="CONTENT_TYPE=application/pdf"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[23]="DEVICE_URI=socket://XXX.XXX.YY.YY:9100"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[24]="PRINTER_INFO=HP LaserJet 600 M601"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[25]="PRINTER_LOCATION="
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[26]="PRINTER=HP-LaserJet-600-M601"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[27]="PRINTER_STATE_REASONS=none"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[28]="CUPS_FILETYPE=document"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[29]="FINAL_CONTENT_TYPE=application/vnd.cups-postscript"
D [17/Mar/2016:09:27:43 +0100] [Job 267] envp[30]="AUTH_I****"
D [17/Mar/2016:09:27:43 +0100] [Job 267] Started filter /usr/lib/cups/filter/pdftopdf (PID 26334)
D [17/Mar/2016:09:27:43 +0100] [Job 267] Started filter /usr/lib/cups/filter/pdftops (PID 26335)
D [17/Mar/2016:09:27:43 +0100] [Job 267] Started filter /usr/lib/cups/filter/hpps (PID 26336)
D [17/Mar/2016:09:27:43 +0100] [Job 267] Started backend /usr/lib/cups/backend/socket (PID 26337)
D [17/Mar/2016:09:27:43 +0100] [Job 267] pdftops - copying to temp print file \"/var/spool/cups/tmp/066df56efaa25\"
D [17/Mar/2016:09:27:43 +0100] [Job 267] STATE: +connecting-to-device
D [17/Mar/2016:09:27:43 +0100] [Job 267] Looking up \"XXX.XXX.YY.YY\"...
D [17/Mar/2016:09:27:43 +0100] [Job 267] backendWaitLoop(snmp_fd=7, addr=0x8199d25c, side_cb=0x800d7340)
D [17/Mar/2016:09:27:43 +0100] [Job 267] PID 26334 (/usr/lib/cups/filter/pdftopdf) exited with no errors.
D [17/Mar/2016:09:27:43 +0100] [Job 267] Printer make and model: HP HP LaserJet 600 M603
D [17/Mar/2016:09:27:43 +0100] [Job 267] Switching to Poppler\'s pdftops instead of Ghostscript for old HP LaserJet (\"LaserJet <number>\", no letters before <number>) printers to work around bugs in the printer\'s PS interpreters
D [17/Mar/2016:09:27:43 +0100] [Job 267] Running command line for pstops: pstops 267 XXXXX \'eldiario.pdf — (eldiario.es - Periodismo a pesar de todo)\' 1 \'HPPrintQuality=FastRes1200 HPTHDigit=0 noHPEdgeToEdge HPPaperSource=AutomaticallySelect noHPEconoMode PageSize=A4 noHPPinPrnt HPSEDigit=0 OutputBin=None Duplex=DuplexNoTumble MediaType=Unspecified HPFIDigit=0 HPFTDigit=0 job-uuid=urn:uuid:da7298d8-1b7d-3a9c-7e81-fa385d8c411b media=iso-a4 job-originating-host-name=localhost date-time-at-creation= date-time-at-processing= time-at-creation=1458203263 time-at-processing=1458203263\'
D [17/Mar/2016:09:27:43 +0100] [Job 267] Using image rendering resolution 600 dpi
D [17/Mar/2016:09:27:43 +0100] [Job 267] Running command line for pdftops: pdftops -level2 -origpagesizes -nocenter -r 600 /var/spool/cups/tmp/066df56efaa25 -
D [17/Mar/2016:09:27:43 +0100] [Job 267] Started filter pdftops (PID 26338)
D [17/Mar/2016:09:27:43 +0100] [Job 267] Started filter pstops (PID 26339)
D [17/Mar/2016:09:27:43 +0100] [Job 267] Page = 595x842; 12,12 to 583,830
D [17/Mar/2016:09:27:43 +0100] [Job 267] slow_collate=0, slow_duplex=0, slow_order=0
D [17/Mar/2016:09:27:43 +0100] [Job 267] Before copy_comments - %!PS-Adobe-3.0
D [17/Mar/2016:09:27:43 +0100] [Job 267] %!PS-Adobe-3.0
D [17/Mar/2016:09:27:43 +0100] [Job 267] %Produced by poppler pdftops version: 0.38.0 (http://poppler.freedesktop.org)
D [17/Mar/2016:09:27:43 +0100] [Job 267] %%Creator: cairo 1.14.6 (http://cairographics.org)
D [17/Mar/2016:09:27:43 +0100] [Job 267] %%LanguageLevel: 2
D [17/Mar/2016:09:27:43 +0100] [Job 267] %%DocumentSuppliedResources: (atend)
D [17/Mar/2016:09:27:43 +0100] [Job 267] %%DocumentMedia: A4 595 842 0 () ()
D [17/Mar/2016:09:27:43 +0100] [Job 267] %%BoundingBox: 0 0 595 842
D [17/Mar/2016:09:27:43 +0100] [Job 267] %%Pages: 1
D [17/Mar/2016:09:27:43 +0100] [Job 267] %%EndComments
D [17/Mar/2016:09:27:43 +0100] [Job 267] Before copy_prolog - %%BeginProlog
D [17/Mar/2016:09:27:43 +0100] [Job 267] Before copy_setup - %%BeginSetup
D [17/Mar/2016:09:27:43 +0100] [Job 267] Connecting to XXX.XXX.YY.YY:9100
D [17/Mar/2016:09:27:43 +0100] [Job 267] Connecting to printer.
D [17/Mar/2016:09:27:43 +0100] [Job 267] Set job-printer-state-message to "Connecting to printer.", current level=INFO
D [17/Mar/2016:09:27:43 +0100] [Job 267] Traceback (most recent call last):
D [17/Mar/2016:09:27:43 +0100] [Job 267] File \"/usr/lib/cups/filter/hpps\", line 186, in <module>
D [17/Mar/2016:09:27:43 +0100] [Job 267] os.write(output_fd, to_bytes_utf8(\'@PJL SET JOBNAME=\"%s\"\\x0a\' % title))
D [17/Mar/2016:09:27:43 +0100] [Job 267] File \"/usr/share/hplip/base/sixext.py\", line 109, in to_bytes_utf8
D [17/Mar/2016:09:27:43 +0100] [Job 267] return s.encode(\"utf-8\")
D [17/Mar/2016:09:27:43 +0100] [Job 267] UnicodeEncodeError: \'utf-8\' codec can\'t encode character \'\\udce2\' in position 31: surrogates not allowed
D [17/Mar/2016:09:27:43 +0100] [Job 267] STATE: -connecting-to-device
D [17/Mar/2016:09:27:43 +0100] [Job 267] Connected to printer.
D [17/Mar/2016:09:27:43 +0100] [Job 267] Set job-printer-state-message to "Connected to printer.", current level=INFO
D [17/Mar/2016:09:27:43 +0100] [Job 267] Connected to XXX.XXX.YY.YY:9100...
D [17/Mar/2016:09:27:43 +0100] [Job 267] backendRunLoop(print_fd=0, device_fd=8, snmp_fd=7, addr=0x8199d25c, use_bc=1, side_cb=0x800d7340)
D [17/Mar/2016:09:27:43 +0100] [Job 267] Read 27 bytes of print data...
D [17/Mar/2016:09:27:43 +0100] [Job 267] Wrote 27 bytes of print data...
D [17/Mar/2016:09:27:43 +0100] [Job 267] STATE: +cups-waiting-for-job-completed
D [17/Mar/2016:09:27:43 +0100] [Job 267] Waiting for printer to finish.
D [17/Mar/2016:09:27:43 +0100] [Job 267] Set job-printer-state-message to "Waiting for printer to finish.", current level=INFO
D [17/Mar/2016:09:27:43 +0100] [Job 267] PID 26336 (/usr/lib/cups/filter/hpps) stopped with status 1.
D [17/Mar/2016:09:27:43 +0100] [Job 267] Hint: Try setting the LogLevel to "debug" to find out more.
D [17/Mar/2016:09:27:43 +0100] [Job 267] PID 26337 (/usr/lib/cups/backend/socket) exited with no errors.
D [17/Mar/2016:09:27:43 +0100] [Job 267] Before page loop - %%Page: 1 1
D [17/Mar/2016:09:27:43 +0100] [Job 267] Copying page 1...
D [17/Mar/2016:09:27:43 +0100] [Job 267] pagew = 571.0, pagel = 818.0
D [17/Mar/2016:09:27:43 +0100] [Job 267] bboxx = 0, bboxy = 0, bboxw = 595, bboxl = 842
D [17/Mar/2016:09:27:43 +0100] [Job 267] PageLeft = 12.0, PageRight = 583.0
D [17/Mar/2016:09:27:43 +0100] [Job 267] PageTop = 830.0, PageBottom = 12.0
D [17/Mar/2016:09:27:43 +0100] [Job 267] PageWidth = 595.0, PageLength = 842.0
D [17/Mar/2016:09:27:43 +0100] [Job 267] Wrote 1 pages...
D [17/Mar/2016:09:27:43 +0100] [Job 267] PID 26339 (pstops) exited with no errors.
D [17/Mar/2016:09:27:43 +0100] [Job 267] PID 26338 (pdftops) exited with no errors.
D [17/Mar/2016:09:27:43 +0100] [Job 267] PID 26335 (/usr/lib/cups/filter/pdftops) exited with no errors.
D [17/Mar/2016:09:27:43 +0100] [Job 267] End of messages
D [17/Mar/2016:09:27:43 +0100] [Job 267] printer-state=3(idle)
D [17/Mar/2016:09:27:43 +0100] [Job 267] printer-state-message="Filter failed"
D [17/Mar/2016:09:27:43 +0100] [Job 267] printer-state-reasons=none

==================================================

The error lines  are:

D [17/Mar/2016:09:27:43 +0100] [Job 267] File \"/usr/share/hplip/base/sixext.py\", line 109, in to_bytes_utf8
D [17/Mar/2016:09:27:43 +0100] [Job 267] return s.encode(\"utf-8\")
D [17/Mar/2016:09:27:43 +0100] [Job 267] UnicodeEncodeError: \'utf-8\' codec can\'t encode character \'\\udce2\' in position 31: surrogates not allowed

==================================================

I found a solution (or workaroud) at:
https://bugs.launchpad.net/hplip/+bug/1498366

Change line 109 in /usr/share/hplip/base/sixext.py 
"return s.encode("utf-8")"
with
"return s.encode("utf-8", errors="surrogateescape")".

with this change, the filter works, and the printer prints.

Best regards, and thank you for your work.

Jaume 


(Sorry for the previous wrongly formatted message, hope this time is Ok)

-- System Information:
Debian Release: stretch/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 4.3.0-1-686-pae (SMP w/2 CPU cores)
Locale: LANG=C.UTF-8, LC_CTYPE=ca_ES.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages hplip-data depends on:
pn  python3:any  <none>
ii  xz-utils     5.1.1alpha+20120614-2.1

hplip-data recommends no packages.

Versions of packages hplip-data suggests:
ii  hplip  3.16.2+repack0-4

-- no debconf information


Reply to: