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

Bug#941864: cups: pxlmono fails to print on Samsung ML-2250 with 9.28rc



Package: ghostscript
Version: 9.28~~rc4~dfsg-1
Severity: important
Tags: upstream

Dear Maintainer,

my Samsung ML-2250 printer stopped to work, it outputs a page with
this error message:

  PCL6 ERROR - sb_count != -128
    POSITION : 0xbc8 (3016)
    SYSTEM   : XLPGP/xl_pattern
    LINE     : 890
    VERSION  : PCL6 3.34 05-01-2004

It took me a while to figure out what part of the printing system
caused the failure, but after downgrading ghostscript to
9.27~dfsg-3.1 printing worked again.

For fun I decided to dig into it:

- I used "gs -sDEVICE=pxlmono -sOutputFile=t.raw -r300x300 foo.pdf"
  to generate output for 9.27 and 9.28

- I used ghostpdl/pcl/tools/pxldis.py tool from ghostscript
  source to convert it to something readable and compared it

  -> the only difference is the use of RLE compression with 9.28

- I checked the RLE encoding and it is correct
  (pcl_xl_2_0_technical_reference_rev2_2.pdf appendix Q)

Then it dawned on me that ghostscript's 0x80 "EOD" marker
is rejected by the Samsung printer firmware.

Ghostscript adds the (apparently useless, at least for PCL6)
EOD marker as the last byte of RLE compressed data.  According to
spec, 0x80 bytes have no meaning and should be ignored
("A control byte of -128 is ignored and is not included in the
decompressed data. The byte following a control byte of 128 is
treated as the next control byte.").  But the error message from
my printer reads like a failed assertion for this case, i.e. the
printer firmware is buggy.

To test my theory I made the following change:

--- ghostscript-9.28~~rc4~dfsg.orig/base/srle.c
+++ ghostscript-9.28~~rc4~dfsg/base/srle.c
@@ -329,11 +329,13 @@ run_len_0_n0_read:
                 *++q = n0;
             }
     case state_eod_unmarked:
+#if 0
             if (wlimit - q < 1) {
                 ss->state = state_eod_unmarked;
                 goto no_output_room;
             }
             *++q = 128; /* EOD */
+#endif
     case state_eod:
             ss->run_len = 0;
             ss->state = state_0;

Success!  It make my printer work again.


Best Regards,
Johannes


-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.2.15 (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=de_DE.utf-8 (charmap=UTF-8), LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages ghostscript depends on:
ii  libc6   2.29-2
ii  libgs9  9.28~~rc4~dfsg-1

ghostscript recommends no packages.

Versions of packages ghostscript suggests:
ii  ghostscript-x  9.28~~rc4~dfsg-1

-- no debconf information


Reply to: