Package: ghostscript
Version: 8.71~dfsg-2
Severity: normal

When building freefem++ I encoutered the following problem

epstopdf figures/mesh_sample.eps --outfile=cpfigs/mesh_sample.pdf
GPL Ghostscript 8.71: ./psi/iscan.c(333): Can't refill scanner input buffer!GPL 
Ghostscript 8.71: Unrecoverable error, exit code 255

After some googling I found that this problem has been reported in Ubuntu
with a patch by Till Kamppeter. See 
http://www.mail-archive.com/lucid-chan...@lists.ubuntu.com/msg06544.html

I had to slightly modify the patch to solve the problem.
Proposed patch is attached


-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-trunk-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages ghostscript depends on:
ii  debconf [debc 1.5.28                     Debian configuration management sy
ii  debianutils   3.2.2                      Miscellaneous utilities specific t
ii  defoma        0.11.10-4                  Debian Font Manager -- automatic f
ii  ghostscript [ 8.71~dfsg-2                The GPL Ghostscript PostScript/PDF
ii  gs-common     8.71~dfsg-2                Dummy package depending on ghostsc
ii  gsfonts       1:8.11+urwcyr1.0.7~pre44-4 Fonts for the Ghostscript interpre
ii  libc6         2.10.2-6                   Embedded GNU C Library: Shared lib
ii  libgs8        8.71~dfsg-2                The Ghostscript PostScript/PDF int

Versions of packages ghostscript recommends:
ii  psfontmgr                     0.11.10-4  PostScript font manager -- part of

ghostscript suggests no packages.

-- no debconf information
Index: ghostscript-8.71~dfsg/base/seexec.c
===================================================================
--- ghostscript-8.71~dfsg.orig/base/seexec.c	2010-03-04 10:51:10.000000000 +0100
+++ ghostscript-8.71~dfsg/base/seexec.c	2010-03-04 10:53:19.000000000 +0100
@@ -165,7 +165,11 @@
 	    r.limit = r.ptr + ss->hex_left;
 	status = s_hex_process(&r, pw, &ss->odd, 
 	  (ss->is_leading_space ? hex_ignore_leading_whitespace : hex_break_on_whitespace));
-        ss->is_leading_space = (status == 2);
+	if (status == 2) {
+	    ss->is_leading_space = true;
+	    status = 1;
+	} else
+	    ss->is_leading_space = false;
 	pr->ptr = r.ptr;
 	ss->hex_left -= r.ptr - start;
 	/*
Index: ghostscript-8.71~dfsg/base/sstring.c
===================================================================
--- ghostscript-8.71~dfsg.orig/base/sstring.c	2010-03-04 10:51:19.000000000 +0100
+++ ghostscript-8.71~dfsg/base/sstring.c	2010-03-04 10:52:13.000000000 +0100
@@ -355,8 +355,12 @@
 /* ------ Utilities ------ */
 
 /*
- * Convert hex data to binary.  Return 1 if we filled the string, 0 if
- * we ran out of input data before filling the string, or ERRC on error.
+ * Convert hex data to binary. 
+ * Return 1 if we filled the string,
+ *	   0 if we ran out of input data before filling the string,
+ *	   2 if hex_break_on_whitespace is on and we encounrered
+ *	     a white space.
+ *	   ERRC on error.
  * The caller must set *odd_digit to -1 before the first call;
  * after each call, if an odd number of hex digits has been read (total),
  * *odd_digit is the odd digit value, otherwise *odd_digit = -1.
Index: ghostscript-8.71~dfsg/psi/iscan.c
===================================================================
--- ghostscript-8.71~dfsg.orig/psi/iscan.c	2010-03-04 10:51:59.000000000 +0100
+++ ghostscript-8.71~dfsg/psi/iscan.c	2010-03-04 10:52:13.000000000 +0100
@@ -329,9 +329,9 @@
 					       rstate, 1, cont);
 	    }
     }
-    /* No more data available, but no exception.  How can this be? */
-    lprintf("Can't refill scanner input buffer!");
-    return_error(e_Fatal);
+    /* No more data available, but no exception. */
+    /* A filter is consuming headers but returns nothing. */
+    return 0;
 }
 
 /*

Reply via email to