Till Kamppeter | 5 Jan 2011 15:38
Picon

How to do a minimum CUPS build for compiling GS with "cups" device on non-Linux machines

Hi,

on the IRC came up the problem that most Ghostscript upstream developers 
are not able to test and debug the CUPS Raster output device of 
Ghostscript as it needs the CUPS libraries and these are usually not 
available on non-Linux systems.

Compiling the CUPS libraries from source is not trivial as they come in 
the CUPS package which also contains a daemon which interacts with a lot 
of Linux' system services and backends which interact with Linux' 
hardware interfaces. For Ghostscript we do not need all this. We only 
need the libraries and these do their job already when compiled in a 
configuration without use of any system services of Linux.

I have already worked with minimum configurations of the CUPS libraries 
to make LSB packages of printer drivers and the LSB does not cover most 
of the system services of a modern Linux system.

Below are the commands to get minimum configurations of the static CUPS 
libraries. The commands are for Linux (I do not have any other OS 
available), they can differ a little bit on other systems. I have tested 
this with CUPS 1.4.5. Change into the main directory of the CUPS source 
before running the commands. Here we go:

./configure --enable-static --without-shared --disable-dbus 
--without-php --disable-slp --disable-gssapi --disable-ldap 
--disable-ssl --disable-cdsassl --disable-gnutls --disable-openssl 
--disable-pam --disable-dnssd --disable-launchd
cd cups
make libcups.a
(Continue reading)

Jonathan Nieder | 21 Jan 2011 12:25
Picon

Re: gs-esp's lx5000 driver runs into infinite loop with mozilla's postscript files

Hi Peter,

I was trying to debug an old hang with ghostscript's lx5000 driver and
am stuck.  [1] has the original report and test file.

Sebastian Schmidt wrote:

> gs produced 94MB output after 10 seconds or so, but what's notable about
> it is the following (hexdump -C):
> 05d13f70  00 02 02 00 18 00 ec 19  13 e8 00 00 00 00 2b 70  |......ì..è....+p|
> 05d13f80  62 77 01 1b 2a 03 00 00  1b 2a 04 00 00 00 1a 00  |bw..*....*......|
> 05d13f90  02 02 00 18 00 ec 19 13  e8 00 00 00 00 2b 70 62  |.....ì..è....+pb|
> 05d13fa0  77 01 1b 2a 03 00 00 1b  2a 04 00 00 00 1a 00 02  |w..*....*.......|
> 05d13fb0  02 00 18 00 ec 19 13 e8  00 00 00 00 2b 70 62 77  |....ì..è....+pbw|
> 05d13fc0  01 1b 2a 03 00 00 1b 2a  04 00 00 00 1a 00 02 02  |..*....*........|
> 05d13fd0  00 18 00 ec 19 13 e8 00  00 00 00 2b 70 62 77 01  |...ì..è....+pbw.|
> 05d13fe0  1b 2a 03 00 00 1b 2a 04  00 00 00 1a 00 02 02 00  |.*....*.........|
> 05d13ff0  18 00 ec 19 13 e8 00 00  00 00 2b 70 62 77 01 1b  |..ì..è....+pbw..|
> [... and so on ...]
>
> This pattern gets repeated all the time.

Using http://pbw.id.au/lexmark/protocol.html we can decode this.

Starting at 05d13f83:

	VERTICAL MOVE (1b 2a 03) by 0
	SWIPE PRINT (1b 2a 04) of length 26 (00 00 00 1a):
		unidirectional, 600x600 dpi (00 02)
		color (02 00)
(Continue reading)

Jonathan Nieder | 22 Jan 2011 22:52
Picon

Re: gs-esp's lx5000 driver runs into infinite loop with mozilla's postscript files

Hi again,

Just an update (no patch yet).  Thanks for the advice.

 $ git clone git://git.ghostscript.com/ghostscript.git
 $ cd ghostscript/gs
 $ git apply debug-lx5000.patch
 $ autoreconf -fis
 $ ./configure
 $ make

| $ bin/gs -dSAFER -sDEVICE=lx5000 -sOutputFile=/dev/null /tmp/mozilla.ps
| GPL Ghostscript SVN PRE-RELEASE 9.01 (2010-09-14)
| Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
| This software comes with NO WARRANTY: see the file PUBLIC for details.
| Loading NimbusRomNo9L-Regu font from %rom%Resource/Font/NimbusRomNo9L-Regu... 2592440 1272826
8750092 7452670 1 done
[...]
| Loading StandardSymL font from %rom%Resource/Font/StandardSymL... 3878968 2514682 8850572 7498285
1 done.
| trace: refresh buffer, 4 colors.
| trace: color 0, pen 0: line 6663
| trace: color 1, pen 0: line 6663
| trace: color 2, pen 0: line 6663
| trace: color 3, pen 0: line 6663
| trace: first printable line: 6663
| trace: next line to get: 0
| trace: color 0: line 32
| trace: done getting lines.  next line to get: 288

(Continue reading)

Jonathan Nieder | 23 Jan 2011 05:58
Picon

[RFC/PATCH] ps2pdfwr: pass -dEPSCrop to gs when converting EPS files

From: François Fleuret <francois.fleuret <at> idiap.ch>
Date: Mon, 28 May 2007 13:50:26 +0200

When converting an eps file with ps2pdfwr, the bounding box is
lost. Just passing the -dEPSCrop option to gv does the trick.
---
From <http://bugs.debian.org/426386>.  Is this change needed nowadays?
Desirable?

 gs/lib/ps2pdfwr |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gs/lib/ps2pdfwr b/gs/lib/ps2pdfwr
index 47c440d..8c2c4c5 100755
--- a/gs/lib/ps2pdfwr
+++ b/gs/lib/ps2pdfwr
 <at>  <at>  -32,7 +32,7  <at>  <at>  if [ $# -eq 1 ]
 then
 	case "${infile}" in
 	  -)		outfile=- ;;
-	  *.eps)	base=`basename "${infile}" .eps`; outfile="${base}.pdf" ;;
+	  *.eps)	base=`basename "${infile}" .eps`; outfile="${base}.pdf"; OPTIONS="${OPTIONS}
-dEPSCrop" ;;
 	  *.ps)		base=`basename "${infile}" .ps`; outfile="${base}.pdf" ;;
 	  *)		base=`basename "${infile}"`; outfile="${base}.pdf" ;;
 	esac
--

-- 
1.7.4.rc2

_______________________________________________
(Continue reading)

NikolaNovak | 31 Jan 2011 11:26
Picon
Gravatar

Strange GS error


Hello,
I'm not sure which list to post this to, so sorry if this is the wrong one.
I'm using GS (actually ps2pdf, which uses ghostscript) to generate a
document of some 3200 pages. 20 pages before the end (although it varies
depending on version of GS), I get the following error:

ERROR: /stackoverflow in {.findcategory}
Operand stack:
   --nostringval--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--  
--nostringval--   2   %stopped_push   --nostringval--   --nostringval--  
--nostringval--   false   1   %stopped_push   1   3   %oparray_pop   1   3  
%oparray_pop   --nostringval--   1   3   %oparray_pop   1   3   %oparray_pop  
.runexec2   --nostringval--   --nostringval--   --nostringval--   2  
%stopped_push   --nostringval--   --nostringval--   50352   3   %oparray_pop  
50353   3   %oparray_pop   --nostringval--   --nostringval--   50356   3  
%oparray_pop   --nostringval--
Dictionary stack:
   --dict:1120/1686(ro)(G)--   --dict:0/20(G)--   --dict:224/302(L)--
Current allocation mode is local
Current file position is 19015430
ESP Ghostscript 815.02: Unrecoverable error, exit code 1

Each odd page of the document contains an image which was converted from
JPEG. It's the same image every time. This code:

/RawData currentfile
/ASCII85Decode filter def
(Continue reading)

Ken Sharp | 31 Jan 2011 13:58
Favicon

Re: Strange GS error

Hello Nikola,

At 02:26 31/01/2011 -0800, you wrote:

>I'm not sure which list to post this to, so sorry if this is the wrong one.

There is currently no good place to post these kinds of questions, though 
we are actively investigating other solutions.

I think your problem is not specific to Ghostscript however, so you might 
care to try posting in the Usenet group 'comp.lang.postscript' where there 
are a number of knowledgeable PostScript developers.

>I'm using GS (actually ps2pdf, which uses ghostscript) to generate a
>document of some 3200 pages. 20 pages before the end (although it varies
>depending on version of GS), I get the following error:
>
>ERROR: /stackoverflow in {.findcategory}
>Operand stack:
>    --nostringval--

[snip]

>Current allocation mode is local
>Current file position is 19015430
>ESP Ghostscript 815.02: Unrecoverable error, exit code 1

This is a very elderly version of Ghostscript, and one which I believe was 
never supported by Artifex. The current version is 9.0 and we are about to 
release 9.01. I would recommend that you upgrade to start with.
(Continue reading)

Nikola Novak | 31 Jan 2011 15:25
Picon
Gravatar

Re: Strange GS error

Hi Ken,

On Mon, Jan 31, 2011 at 1:58 PM, Ken Sharp <ken.sharp <at> artifex.com> wrote:
Hello Nikola,

At 02:26 31/01/2011 -0800, you wrote:

I'm not sure which list to post this to, so sorry if this is the wrong one.

There is currently no good place to post these kinds of questions, though we are actively investigating other solutions.

I think your problem is not specific to Ghostscript however, so you might care to try posting in the Usenet group 'comp.lang.postscript' where there are a number of knowledgeable PostScript developers.

I'm using GS (actually ps2pdf, which uses ghostscript) to generate a
document of some 3200 pages. 20 pages before the end (although it varies
depending on version of GS), I get the following error:

ERROR: /stackoverflow in {.findcategory}
Operand stack:
  --nostringval--

[snip]

Current allocation mode is local
Current file position is 19015430
ESP Ghostscript 815.02: Unrecoverable error, exit code 1

This is a very elderly version of Ghostscript, and one which I believe was never supported by Artifex. The current version is 9.0 and we are about to release 9.01. I would recommend that you upgrade to start with.

Some of the systems this is supposed to work on I can't change. I can upgrade my own system, but I can't say the same for the others. On my own I'm using 8.71 and the crash happens much later with the following message:

Error: /stackoverflow in /findfont
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1878   1   3   %oparray_pop   1877   1   3   %oparray_pop   --nostringval--   1861   1   3   %oparray_pop   1755   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   1836   300198   3   %oparray_pop
Dictionary stack:
   --dict:1154/1684(ro)(G)--   --dict:0/20(G)--   --dict:192/200(L)--
Current allocation mode is local
Current file position is 112114568
GPL Ghostscript 8.71: Unrecoverable error, exit code 1

Note the file position here is an order of magnitude greater than the one in 815.02 (I only just noticed that, I misread and thought 815.02 crashed later in the document. I re-checked where it crashes, it is about 500 pages in, which is just about the stack size. 8.71 crashes 30 pages before the end, which is 3170 pages in. Has the stack size been changed in this version?)
 
Each odd page of the document contains an image which was converted from
JPEG. It's the same image every time. This code:

/RawData currentfile
/ASCII85Decode filter def
/Data RawData << >> /DCTDecode filter def
        1.000000000 imageScale

imaegScale is not defined anywhere in this code, so presumably you are including it from somewhere else ?

Sorry, I didn't notice this when pasting. imageScale is defined thus:

/NextWidth 0 def
/NextHeight 0 def

/imageScale {
 dup NextWidth mul exch NextHeight mul scale
} def

/NextWidth and /NextHeight are changed in another part of the code (they are not always 0).

/DeviceRGB setcolorspace
{ << /ImageType 1
 /Width 885
 /Height 150
 /ImageMatrix [ 885 0 0 -150 0 150 ]
 /DataSource Data
 /BitsPerComponent 8
 /Decode [0 1 0 1 0 1]
 >> image
 Data closefile
 RawData flushfile
} exec
%(here comes the Base64 of the converted image)

is all I ever push onto the execution stack.

Actually, the objects are created on the operand stack, before being transferred to a dictionary (eg def), used (eg setcolorspace) or moved to the execution stack by the 'exec' operator.

[snip]
 
Can someone point me in the right direction?

Your code is leaving something on the operand stack, presumably after every invocation. IIRC the operand stack has a limit of 500 objects, in which case it can't reasonably be happening on every page. From your description it seems that approsimately every 6 or 7th page is leaving something on the operand stack.

The operand stack was printed when the execution stopped and as you can see from the printout I sent it contained only one element. This is why I ruled out operand stack from being the cause. Are you saying that this is not really what the operand stack looks like at the moment of overflow?

You have only supplied a part of the job you are running, as you state your code above is used for every *odd* page. Presumably something else is generating the even pages.

I assumed the execution stack was the problem, so I posted the only part of the code that did something to the execution stack. If as you say the operand stack got overflown, then I should be able to track down the leak on my own.

Without seeing a complete example its impossible for me to offer any more concrete information however.

It's OK. The complete example is 113MB large, and I wouldn't know how to narrow it down to where the problem is because if I did, I'd probably know how to solve it. ;)

I'm just asking for a general direction in which to turn to look for my problem. Knowing that it's not the execution stack that overflows helps somewhat, and remembering the changes I made to the program that generates this postscript gives me a fairly vague idea of where to look (and this is much better than what I had to go on before your reply came in).
 
[snip]


               Ken

 
Thanks,
Nikola
_______________________________________________
gs-devel mailing list
gs-devel <at> ghostscript.com
http://ghostscript.com/cgi-bin/mailman/listinfo/gs-devel
Ken Sharp | 31 Jan 2011 15:45
Favicon

Re: Strange GS error

At 15:25 31/01/2011 +0100, Nikola Novak wrote:

>Some of the systems this is supposed to work on I can't change. I can 
>upgrade my own system, but I can't say the same for the others. On my own 
>I'm using 8.71 and the crash happens much later with the following message:

This isn't a crash, its an orderly exit caused by an error in the incoming 
PostScript.

>Error: /stackoverflow in /findfont
>Operand stack:

Still the same problem, the operand stack overflows whil eprocessing 
findfont. Since findfont needs to put a font dictionary on the stack, the 
likelihood is that the stack was full before the execution of findfont, and 
attempting to return the dictionary caused the problem.

>only just noticed that, I misread and thought 815.02 crashed later in the 
>document. I re-checked where it crashes, it is about 500 pages in, which 
>is just about the stack size. 8.71 crashes 30 pages before the end, which 
>is 3170 pages in. Has the stack size been changed in this version?)

Not that I am aware of, no. But 8.15 long predates my own experience of 
Ghostscript. Note that parts of Ghostscript are themselves written in 
PostScript, and so may require 'working' stack space.

>The operand stack was printed when the execution stopped and as you can 
>see from the printout I sent it contained only one element. This is why I 
>ruled out operand stack from being the cause. Are you saying that this is 
>not really what the operand stack looks like at the moment of overflow?

Its possible, without seeing the job I can't really tell. Its also possible 
that something else is returning an error and returning the wrong error 
code of course.

>I'm just asking for a general direction in which to turn to look for my 
>problem. Knowing that it's not the execution stack that overflows helps 
>somewhat, and remembering the changes I made to the program that generates 
>this postscript gives me a fairly vague idea of where to look (and this is 
>much better than what I had to go on before your reply came in).

You may also find it useful to print the number of items on each stack 
after every page, see the operators count, countdictstack and countexecstack.

Note that the other stacks generally have lower maxima, 20 for the 
dictionary stack and 250 for the execution stack.

             Ken
Nikola Novak | 31 Jan 2011 16:49
Picon
Gravatar

Re: Strange GS error

> From: Ken Sharp
> Sent: Monday, January 31, 2011 3:46 PM
> 
> >Some of the systems this is supposed to work on I can't change. I can
> >upgrade my own system, but I can't say the same for the others. On my
> >own I'm using 8.71 and the crash happens much later with the following
> message:
> 
> This isn't a crash, its an orderly exit caused by an error in the incoming
> PostScript.

Right. I meant overflow.

[snip]

> You may also find it useful to print the number of items on each stack
> after every page, see the operators count, countdictstack and
> countexecstack.
> 
> Note that the other stacks generally have lower maxima, 20 for the
> dictionary stack and 250 for the execution stack.
> 
> 
>              Ken

Will do. Thanks for all the help and tips,

Nikola

Gmane