[tex-k] epstopdf: %%BoundingBox: (atend)

Reinhard Kotucha reinhard.kotucha at web.de
Tue Aug 25 23:09:53 CEST 2009

On 25 August 2009 Martin von Gagern wrote:

 > Karl Berry wrote:
 > > My guess is that the current maintainer of epstopdf (Gerben Wierda)
 > > would accept a clean patch for these things, but is unlikely to write it
 > > himself.  Any interest?  Anyway, I'll ask him.  (I don't have the
 > > time/inclination/energy to do it myself either, I'm afraid.)
 > I wrote a patch, to address this issue and fix some others I noticed in
 > the passing. Will you forward the patch to Gerben Wierda, or are you
 > certain that he does follow this list here and will take notice? I don't
 > have a mail address of him. I have given my new version some cursory
 > testing, but some more testing would of course be appreciated.

Hi Martin,
since you are working on it, there are two other bugs.

The first one can't be be fixed easily without re-organizing the code
completely:  The pipe to gs is opened before the BoundingBox is found.
With other words, an existing PDF file is destroyed before epstopdf
knows that it can generate a new one at all.  However, it's too
difficult to fix this bug and make sure at the same time that everything
else works as before.  Too many people rely on epstopdf already.

However, the second bug can be fixed easily.  The exit code of
epstopdf is always the exit code of the Perl script itself, even if gs

| $ epstopdf foo.eps 
| Error: /undefined in linetooooo
| Operand stack:
|    100   100
| Execution stack:
|    %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1846   1   3   %oparray_pop   1845   1   3   %oparray_pop   1829   1   3   %oparray_pop   1723   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
| Dictionary stack:
|    --dict:1154/1684(ro)(G)--   --dict:0/20(G)--   --dict:69/200(L)--
| Current allocation mode is local
| Last OS error: 2
| GPL Ghostscript 8.64: Unrecoverable error, exit code 1
| $ echo $?
| 0

Though gs crashes with exit code 1, epstopdf returns 0.

This makes makefiles believe that the PDF file was created sucessfully.

This little patch fixes the problem:

--- epstopdf.pl	2009-07-20 02:59:05.000000000 +0200
+++ epstopdf.pl-new	2009-08-25 22:58:06.000000000 +0200
@@ -427,5 +427,6 @@
 print OUT "\ngrestore\n" if $BBCorrected;
+exit ($?/256) if $?;
 warning "BoundingBox not found" unless $BBCorrected;
 debug "Ready.";

Do you want to apply this patch before you send yours to Gerben or
shall I ask Gerben myself?


Reinhard Kotucha			              Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover	                      mailto:reinhard.kotucha at web.de
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.

More information about the tex-k mailing list