apple / cups

Apple CUPS Sources
https://www.cups.org
Apache License 2.0
1.91k stars 461 forks source link

ESP GS 8.15 dumps core when using "ijs_server_epsonepl" (Epson EPLxxxxL driver) #1077

Closed michaelrsweet closed 19 years ago

michaelrsweet commented 19 years ago

Version: 8.15rc1 CUPS.org User: till.kamppeter

If I use the IJS server "ijs_server_epsonepl" for the Epson EPL L series (http://sourceforge.net/projects/epsonepl/) I get


cat /usr/share/cups/data/testprint.ps | gs -dBATCH -dSAFER -dNOPAUSE -sProcessColorModel=DeviceGray -dBitsPerSample=1 -sDEVICE=ijs -sIjsServer=ijs_server_epsonepl -dIjsUseOutputFD -sDeviceManufacturer=Epson -sDeviceModel=EPL6100L -sIjsParams="EplFlowControl=off,EplDpi=600,EplDensity=3,EplRitech=on,EplTonerSave=off," -sOutputFile=- - > testfilegetting page header

ijs_server_get_page_header failed: -2 Segmentation fault (core dumped)

ls -l testfile

-rw-r--r-- 1 root root 174 Feb 10 20:14 testfile


I have asked already on the epsonepl developer mailing list. Hin-Tak Leung, the project leader, answered:


Hmm, in this case, I wonder if it is due to some of ESP ghostscript's

changes to do with stderr. GPL ghostscript 8.15 does work with epson epl.

So it seems to be in some ESP-GhostScript-specific stuff.

michaelrsweet commented 19 years ago

CUPS.org User: mike

OK, none of the changes to write messages to stderr should have this effect, since the "-sOutputFile=-" will send the output to the real stdout, just like with the CUPS device...

I don't have the EPL IJS server installed, and I don't have time to do so, however if you can come up with a traceback via gdb, we might have a chance of tracking the problem down...

michaelrsweet commented 19 years ago

CUPS.org User: till.kamppeter

Works perfectly with GPL GhostScript 8.16 (from CVS).

michaelrsweet commented 19 years ago

CUPS.org User: till.kamppeter

Here is the gdb output of the current ESP GhostScript (subversion rev 46):


root@localhost g]# cat /usr/share/cups/data/testprint.ps | gs -dBATCH -dSAFER -dNOPAUSE -sProcessColorModel=DeviceGray -dBitsPerSample=1 -sDEVICE=ijs -sIjsServer=ijs_server_epsonepl -dIjsUseOutputFD -sDeviceManufacturer=Epson -sDeviceModel=EPL6100L -sIjsParams="EplFlowControl=off,EplDpi=600,EplDensity=3,EplRitech=on,EplTonerSave=off," -sOutputFile=- - > testfile ESP Ghostscript 815.00 (2005-02-08) Copyright (C) 2004 artofcode LLC, Benicia, CA. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. getting page header ijs_server_get_page_header failed: -2 Segmentation fault (core dumped) [root@localhost g]# [root@localhost g]# gdb -c core.27111 /usr/bin/gs-common GNU gdb 6.3-3mdk (Mandrakelinux) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i586-mandrake-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

warning: core file may not match specified executable file. Core was generated by `gs -dBATCH -dSAFER -dNOPAUSE -sProcessColorModel=DeviceGray -dBitsPerSample=1 -'. Program terminated with signal 11, Segmentation fault.

warning: current_sos: Can't read pathname for load map: Input/output error

Reading symbols from /usr/lib/libz.so.1...done. Loaded symbols for /usr/lib/libz.so.1 Reading symbols from /usr/lib/libcupsimage.so.2...done. Loaded symbols for /usr/lib/libcupsimage.so.2 Reading symbols from /usr/lib/libtiff.so.3...done. Loaded symbols for /usr/lib/libtiff.so.3 Reading symbols from /usr/lib/libjpeg.so.62...done. Loaded symbols for /usr/lib/libjpeg.so.62 Reading symbols from /usr/lib/libpng.so.3...done. Loaded symbols for /usr/lib/libpng.so.3 Reading symbols from /lib/tls/libm.so.6...done. Loaded symbols for /lib/tls/libm.so.6 Reading symbols from /usr/lib/libcups.so.2...done. Loaded symbols for /usr/lib/libcups.so.2 Reading symbols from /usr/lib/libssl.so.0.9.7...done. Loaded symbols for /usr/lib/libssl.so.0.9.7 Reading symbols from /usr/lib/libcrypto.so.0.9.7...done. Loaded symbols for /usr/lib/libcrypto.so.0.9.7 Reading symbols from /lib/libnsl.so.1...done. Loaded symbols for /lib/libnsl.so.1 Reading symbols from /usr/lib/libstdc++.so.6...done. Loaded symbols for /usr/lib/libstdc++.so.6 Reading symbols from /lib/libdl.so.2...done. Loaded symbols for /lib/libdl.so.2 Reading symbols from /lib/tls/libc.so.6...done. Loaded symbols for /lib/tls/libc.so.6 Reading symbols from /lib/ld-linux.so.2...done. Loaded symbols for /lib/ld-linux.so.2 Reading symbols from /lib/libgcc_s.so.1...done. Loaded symbols for /lib/libgcc_s.so.1 Reading symbols from /usr/lib/ghostscript/8.15/X11.so...done. Loaded symbols for /usr/lib/ghostscript/8.15/X11.so Reading symbols from /usr/X11R6/lib/libXt.so.6...done. Loaded symbols for /usr/X11R6/lib/libXt.so.6 Reading symbols from /usr/X11R6/lib/libSM.so.6...done. Loaded symbols for /usr/X11R6/lib/libSM.so.6 Reading symbols from /usr/X11R6/lib/libICE.so.6...done. Loaded symbols for /usr/X11R6/lib/libICE.so.6 Reading symbols from /usr/X11R6/lib/libXext.so.6...done. Loaded symbols for /usr/X11R6/lib/libXext.so.6 Reading symbols from /usr/X11R6/lib/libX11.so.6...done. Loaded symbols for /usr/X11R6/lib/libX11.so.6

0 0x08306836 in gsijs_fill_rectangle (dev=0x867e904, x=0, y=0, w=5100,

h=6600, color=1) at ./src/gdevijs.c:179

179 ./src/gdevijs.c: No such file or directory. in ./src/gdevijs.c (gdb) backtrace

0 0x08306836 in gsijs_fill_rectangle (dev=0x867e904, x=0, y=0, w=5100,

h=6600, color=1) at ./src/gdevijs.c:179

1 0x08354ed9 in gx_dc_pure_fill_rectangle (pdevc=0x8647f6c, x=0, y=0,

w=5100, h=6600, dev=0x867e904, lop=252, source=0x0) at ./src/gxdcolor.c:387

2 0x08334d68 in gs_fillpage (pgs=0x8647ae4) at ./src/gspaint.c:91

3 0x081397a4 in zfillpage (i_ctx_p=0x865823c) at ./src/zpaint.c:51

4 0x0810925a in interp (pi_ctx_p=0x84dcb24, pref=0xbfffe780,

perror_object=0xbfffea60) at ./src/interp.c:1492

5 0x0810688a in gs_call_interp (pi_ctx_p=0x84dcb24, pref=0xbfffe838,

user_errors=1, pexit_code=0xbfffea68, perror_object=0xbfffea60)
at ./src/interp.c:487

6 0x081066ef in gs_interpret (pi_ctx_p=0x84dcb24, pref=0xbfffe838,

user_errors=1, pexit_code=0xbfffea68, perror_object=0xbfffea60)
at ./src/interp.c:445

7 0x080fc0da in gs_main_interpret (minst=0x84dc920, pref=0xbfffea20,

user_errors=1, pexit_code=0xbfffea68, perror_object=0xbfffea60)
at ./src/imain.c:297

8 0x080fc9d1 in gs_run_init_file (minst=0x84dc920, pexit_code=0xbfffea68,

perror_object=0xbfffea60) at ./src/imain.c:531

9 0x080fc230 in gs_main_init2 (minst=0x84dc920) at ./src/imain.c:346

10 0x080fdfb8 in swproc (minst=0x84dc920,

arg=0xbffffa7f "LESSKEY=/etc/.less", pal=0xbfffee10)
at ./src/imainarg.c:279

11 0x080fdddb in gs_main_init_with_args (minst=0x84dc920, argc=14,

---Type to continue, or q to quit--- argv=0xbffff7b4) at ./src/imainarg.c:216

12 0x08076700 in main (argc=14, argv=0xbffff7b4) at ./src/gs.c:45

(gdb) quit

[root@localhost g]

michaelrsweet commented 19 years ago

CUPS.org User: mike

ESP Ghostscript has a much different IJS driver than GPL Ghostscript CVS; the ESPGS driver has KRGB support while the CVS one does not.

Can you try the current Subversion code - I just imported a lot of bug fixes from there, but I didn't touch the IJS driver due to the number of differences...

michaelrsweet commented 19 years ago

CUPS.org User: till.kamppeter

The segfault still persists. Here is a new gdb backtrace:


[root@localhost g]# cat /usr/share/cups/data/testprint.ps | gs -dBATCH -dSAFER -dNOPAUSE -sProcessColorModel=DeviceGray -dBitsPerSample=1 -sDEVICE=ijs -sIjsServer=ijs_server_epsonepl -dIjsUseOutputFD -sDeviceManufacturer=Epson -sDeviceModel=EPL6100L -sIjsParams="EplFlowControl=off,EplDpi=600,EplDensity=3,EplRitech=on,EplTonerSave=off," -sOutputFile=- - > testfile ESP Ghostscript 815.00 (2005-02-08) Copyright (C) 2004 artofcode LLC, Benicia, CA. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. getting page header Segmentation fault (core dumped) ijs_server_get_page_header failed: -2 [root@localhost g]# [root@localhost g]# gdb -c core.15522 /usr/bin/gs-common GNU gdb 6.3-3mdk (Mandrakelinux) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i586-mandrake-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

warning: core file may not match specified executable file. Core was generated by `gs -dBATCH -dSAFER -dNOPAUSE -sProcessColorModel=DeviceGray -dBitsPerSample=1 -'. Program terminated with signal 11, Segmentation fault.

warning: current_sos: Can't read pathname for load map: Input/output error

Reading symbols from /usr/lib/libz.so.1...done. Loaded symbols for /usr/lib/libz.so.1 Reading symbols from /usr/lib/libcupsimage.so.2...done. Loaded symbols for /usr/lib/libcupsimage.so.2 Reading symbols from /usr/lib/libtiff.so.3...done. Loaded symbols for /usr/lib/libtiff.so.3 Reading symbols from /usr/lib/libjpeg.so.62...done. Loaded symbols for /usr/lib/libjpeg.so.62 Reading symbols from /usr/lib/libpng.so.3...done. Loaded symbols for /usr/lib/libpng.so.3 Reading symbols from /lib/tls/libm.so.6...done. Loaded symbols for /lib/tls/libm.so.6 Reading symbols from /usr/lib/libcups.so.2...done. Loaded symbols for /usr/lib/libcups.so.2 Reading symbols from /usr/lib/libssl.so.0.9.7...done. Loaded symbols for /usr/lib/libssl.so.0.9.7 Reading symbols from /usr/lib/libcrypto.so.0.9.7...done. Loaded symbols for /usr/lib/libcrypto.so.0.9.7 Reading symbols from /lib/libnsl.so.1...done. Loaded symbols for /lib/libnsl.so.1 Reading symbols from /usr/lib/libstdc++.so.6...done. Loaded symbols for /usr/lib/libstdc++.so.6 Reading symbols from /lib/libdl.so.2...done. Loaded symbols for /lib/libdl.so.2 Reading symbols from /lib/tls/libc.so.6...done. Loaded symbols for /lib/tls/libc.so.6 Reading symbols from /lib/ld-linux.so.2...done. Loaded symbols for /lib/ld-linux.so.2 Reading symbols from /lib/libgcc_s.so.1...done. Loaded symbols for /lib/libgcc_s.so.1 Reading symbols from /usr/lib/ghostscript/8.15/X11.so...done. Loaded symbols for /usr/lib/ghostscript/8.15/X11.so Reading symbols from /usr/X11R6/lib/libXt.so.6...done. Loaded symbols for /usr/X11R6/lib/libXt.so.6 Reading symbols from /usr/X11R6/lib/libSM.so.6...done. Loaded symbols for /usr/X11R6/lib/libSM.so.6 Reading symbols from /usr/X11R6/lib/libICE.so.6...done. Loaded symbols for /usr/X11R6/lib/libICE.so.6 Reading symbols from /usr/X11R6/lib/libXext.so.6...done. Loaded symbols for /usr/X11R6/lib/libXext.so.6 Reading symbols from /usr/X11R6/lib/libX11.so.6...done. Loaded symbols for /usr/X11R6/lib/libX11.so.6

0 0x08308e1a in gsijs_fill_rectangle (dev=0x8681904, x=0, y=0, w=5100,

h=6600, color=1) at ./src/gdevijs.c:179

179 ./src/gdevijs.c: No such file or directory. in ./src/gdevijs.c (gdb) backtrace

0 0x08308e1a in gsijs_fill_rectangle (dev=0x8681904, x=0, y=0, w=5100,

h=6600, color=1) at ./src/gdevijs.c:179

1 0x08357881 in gx_dc_pure_fill_rectangle (pdevc=0x864af6c, x=0, y=0,

w=5100, h=6600, dev=0x8681904, lop=252, source=0x0) at ./src/gxdcolor.c:387

2 0x08337614 in gs_fillpage (pgs=0x864aae4) at ./src/gspaint.c:91

3 0x0813a258 in zfillpage (i_ctx_p=0x865b23c) at ./src/zpaint.c:51

4 0x08109c42 in interp (pi_ctx_p=0x84df5a4, pref=0xbfffe750,

perror_object=0xbfffea30) at ./src/interp.c:1492

5 0x08107272 in gs_call_interp (pi_ctx_p=0x84df5a4, pref=0xbfffe808,

user_errors=1, pexit_code=0xbfffea38, perror_object=0xbfffea30)
at ./src/interp.c:487

6 0x081070d7 in gs_interpret (pi_ctx_p=0x84df5a4, pref=0xbfffe808,

user_errors=1, pexit_code=0xbfffea38, perror_object=0xbfffea30)
at ./src/interp.c:445

7 0x080fca82 in gs_main_interpret (minst=0x84df3a0, pref=0xbfffe9f0,

user_errors=1, pexit_code=0xbfffea38, perror_object=0xbfffea30)
at ./src/imain.c:297

8 0x080fd379 in gs_run_init_file (minst=0x84df3a0, pexit_code=0xbfffea38,

perror_object=0xbfffea30) at ./src/imain.c:531

9 0x080fcbd8 in gs_main_init2 (minst=0x84df3a0) at ./src/imain.c:346

10 0x080fe960 in swproc (minst=0x84df3a0,

arg=0xbffffa54 "LESSKEY=/etc/.less", pal=0xbfffede0)
at ./src/imainarg.c:279

11 0x080fe783 in gs_main_init_with_args (minst=0x84df3a0, argc=14,

---Type to continue, or q to quit--- argv=0xbffff784) at ./src/imainarg.c:216

12 0x08076990 in main (argc=14, argv=0xbffff784) at ./src/gs.c:45

(gdb) quit

[root@localhost g]

michaelrsweet commented 19 years ago

CUPS.org User: till.kamppeter

Works perfectly when one replaces src/gdevijs.c by the file from GPL GhostScript. Problem is that one would ditch HP's KRGB support which means printout quality loss and uneconomic behaviour for most well-spread HP inkjets, but one gets the Epson EPL-xxxxL series working.

So a real fix is needed, both HP and Epson users should be served.

michaelrsweet commented 19 years ago

CUPS.org User: till.kamppeter

Reported problem to David Suffield and Cory Meisch from HP, as they have written the KRGB patch.

michaelrsweet commented 19 years ago

CUPS.org User: till.kamppeter

Here is Dave Suffields answer to the problem:


Hi Till,

Given the following test case. KRGB mode should never be enabled for monochrome. KRGB mode will only work for RGB.

cat /usr/share/cups/data/testprint.ps | gs -dBATCH -dSAFER -dNOPAUSE -sProcessColorModel=DeviceGray -dBitsPerSample=1 -sDEVICE=ijs -sIjsServer=ijs_server_epsonepl -dIjsUseOutputFD -sDeviceManufacturer=Epson -sDeviceModel=EPL6100L -sIjsParams="EplFlowControl=off,EplDpi=600,EplDensity=3,EplRitech=on,Epl TonerSav e=off," -sOutputFile=- - > testfile

The gsijs_set_krgb_mode() must not be working. This function does two checks; RGB mode and ijs server KRGB support, before it enables krgb_mode.

Your traceback looks like it sigfaults in gsijs_fill_rectangle, but gsijs_fill_rectangle should never get called for this test case.

The KRGB patch worked find in gpl gs 7.07, but I personally have never checked the patch on gpl gs 8.01. I will try looking at the patch in gs 8.01.

-dave

-----Original Message----- From: Till Kamppeter [mailto:till.kamppeter@gmx.net] Sent: Wednesday, February 16, 2005 3:12 PM To: Meisch, Cory; Suffield, David Subject: KRGB support breaks IJS device of GhostScript 8.15

Oi,

I am working with Mike Sweet on ESP GhostScript 8.15. We have applied your KRGB support patch from GhostScript 7.x times there. But this patch causes a problem with other IJS drivers. See this bug report:

http://www.cups.org/espgs/str.php?L1077+P0+S-2+C0+I0+E0+Q

Especially note that removing the KRGB support would fix this bug. Can you have a look at this? Would be very great if I could include a fix in

Mandrakelinux 10.2 (release of Community Edition by the end of this month). Would be even more important than having parallel port support in HPLIP.

Thank you very much in advance.

Till
michaelrsweet commented 19 years ago

CUPS.org User: till.kamppeter

Here a comment from Hin-Tak Leung:


Hi Till,

That's interesting. The segfault problem with some version of ghostscript 7.0x has only ever been reported from Debian users; and our general recommendation used to be ungrade to AFPL 8.00/8.14 with our patch of the "black-page" problem (the fix for the "black-page" problem was integrated into GNU gs 8.15 or AFPL gs 8.50 onwards). I was thinking of building every version of ghostscript, ESP/GNU versions between 7.x and 8.x I can get hold of to isolate the problem. (I myself uses AFPL ghostscript against the printer most of the time so that's eliminated).

If you haven't really taken any notice about the issues surrounding the "black-page" problem with 8.00/8.14, it was for a very similiar issue to what you seems to have discovered with the KRGB patch. Basically around gs 7.22, some change was made in src/gdevijs.c (same file) to expand the data structure to accommodate the upcoming new feature for color separations with DeviceN, and overlooked the fact that there is an ijs-based driver (the epsonepl driver) which uses only one color (black), rather than 3 or 4 like gimpprint or hpijs. The one-line fix was to fill in the extra-expanded details to honour how many color the switches "-sProcessColorModel=DeviceGray -dBitsPerSample=1" actually says, rather than just blindly assume the ijs driver drives a multi-color device - that's why the page comes out black for unpatched 8.00/8.14 - it is 0 for white and 1 for black for b/w, but the opposite, 0,0,0 for black and 11111111,11111111,11111111 for whites for 24-bit color - something like that, I think, if you get the color model wrong; the clue/patch was discovered when I printed something with some blue texts among black texts with unpatched 8.00 and only the blue text was visible as grays among blacks.

Regards, Hin-Tak

Till Kamppeter wrote:

I have done further investigation on the problem of ESP GhostScript 8.15 crashing. See here:

http://qa.mandrakesoft.com/show_bug.cgi?id=12371 http://www.cups.org/espgs/str.php?L1077

The second link contains gdb backtraces.

What I have found out is that the problem appeared when HP's patch for KRGB was added to ESP GhostScript 8.15 (it was not added to GPL and AFPL GhostScript). I removed the patch in ESP GhostScript and it worked again.

So I contacted Dave Suffield from HP who has created the patch. See his answer below.

Till


Suffield, David wrote:

Hi Till,

Given the following test case. KRGB mode should never be enabled for monochrome. KRGB mode will only work for RGB.

cat /usr/share/cups/data/testprint.ps | gs -dBATCH -dSAFER -dNOPAUSE -sProcessColorModel=DeviceGray -dBitsPerSample=1 -sDEVICE=ijs -sIjsServer=ijs_server_epsonepl -dIjsUseOutputFD -sDeviceManufacturer=Epson -sDeviceModel=EPL6100L -sIjsParams="EplFlowControl=off,EplDpi=600,EplDensity=3,EplRitech=on,Epl TonerSav e=off," -sOutputFile=- - > testfile

The gsijs_set_krgb_mode() must not be working. This function does two checks; RGB mode and ijs server KRGB support, before it enables krgb_mode. Your traceback looks like it sigfaults in gsijs_fill_rectangle, but gsijs_fill_rectangle should never get called for this test case. The KRGB patch worked find in gpl gs 7.07, but I personally have never checked the patch on gpl gs 8.01. I will try looking at the patch in gs 8.01.

-dave

-----Original Message----- From: Till Kamppeter [mailto:till.kamppeter@gmx.net] Sent: Wednesday, February 16, 2005 3:12 PM To: Meisch, Cory; Suffield, David Subject: KRGB support breaks IJS device of GhostScript 8.15

Oi,

I am working with Mike Sweet on ESP GhostScript 8.15. We have applied your KRGB support patch from GhostScript 7.x times there. But this patch causes a problem with other IJS drivers. See this bug report:

http://www.cups.org/espgs/str.php?L1077+P0+S-2+C0+I0+E0+Q

Especially note that removing the KRGB support would fix this bug. Can you have a look at this? Would be very great if I could include a fix in

Mandrakelinux 10.2 (release of Community Edition by the end of this month). Would be even more important than having parallel port support in HPLIP.

Thank you very much in advance.

Till
michaelrsweet commented 19 years ago

CUPS.org User: mike

Fixed in Subversion repository. See attached patch...

michaelrsweet commented 19 years ago

CUPS.org User: till.kamppeter

I have tested it and works for me now. I have updated the GhostScript package for Mandrakelinux now.

michaelrsweet commented 19 years ago

CUPS.org User: mike

Great!

michaelrsweet commented 19 years ago

"str1077.patch":

Index: gdevijs.c

--- gdevijs.c (revision 50) +++ gdevijs.c (working copy) @@ -34,6 +34,10 @@