I think the gs-gpl on ppc coredump showing up here is probably related
to the gs-esp on ppc coredump that I discuss in the attached message.

Regards,
Ian.

--- Begin Message ---
I have been investigating problems with gs that show up with gs-esp in
Ubuntu.  There turns out to be a bug in gs which causes problems for
gs's memory management system.

For your edification I enclose the patch that I've just uploaded into
Ubuntu Breezy.  I think something like this patch is likely to be
necessary for Debian gs's too.

The top of the patch, below, contains URLs for the references I
found.  The core bug for which my patch is a workaround is recorded in
the gs bugzilla.

I hope you find this mail helpful.  Thank you for your attention.

Ian.

diff -x '*~' -ruN ../orig/gs-esp-7.07.1/debian/changelog 
gs-esp-7.07.1/debian/changelog
--- ../orig/gs-esp-7.07.1/debian/changelog      2005-08-30 18:56:12.000000000 
+0100
+++ gs-esp-7.07.1/debian/changelog      2005-08-30 18:55:44.000000000 +0100
@@ -1,3 +1,30 @@
+gs-esp (7.07.1-9ubuntu5) breezy; urgency=low
+
+  * Fix coredumping bug on ppc: Ubuntu bugzilla:
+     http://bugzilla.ubuntu.com/show_bug.cgi?id=13771
+    This is the same issue as
+     http://bugs.ghostscript.com/show_bug.cgi?id=687643
+     http://bugs.ghostscript.com/show_bug.cgi?id=687730
+    discussed in
+     http://ghostscript.com/pipermail/gs-code-review/2004-September/004649.html
+    and probably the same as Debian bug #324796 and perhaps others in
+    Debian's gs-esp.
+
+    This bug is due to gs's incorrect assumption that (where ref is an
+    important struct inside gs) sizeof(ref) % alignof(jmp_buf) == 0.  This
+    is not true on ppc and apparently not necessarily on Itanium either.
+
+    The `fix' I have applied is to wrap setjmp/longjmp up in macros which
+    arrange for jmp_buf to have alignment 1, as sketched out in the URLs
+    above.  A previous attempt to fix it by padding ref out to the
+    alignment of jmp_buf failed and I don't know why; but I suspect other
+    unjustified assumptions in gs.
+
+    GhostScript's algorithms ought to be repaired not to assume
+    falsehoods.
+
+ -- Ian Jackson <[EMAIL PROTECTED]>  Tue, 30 Aug 2005 18:55:44 +0100
+
 gs-esp (7.07.1-9ubuntu4) breezy; urgency=low
 
   * Rebuild for new C++ ABI
diff -x '*~' -ruN ../orig/gs-esp-7.07.1/src/genarch.c 
gs-esp-7.07.1/src/genarch.c
--- ../orig/gs-esp-7.07.1/src/genarch.c 2003-08-19 16:32:25.000000000 +0100
+++ gs-esp-7.07.1/src/genarch.c 2005-08-30 18:46:40.000000000 +0100
@@ -28,7 +28,8 @@
  */
 #include <string.h>
 #include <time.h>
-#include <setjmp.h>
+
+#include "gsfix-setjmp.h"
 
 /* We should write the result on stdout, but the original Turbo C 'make' */
 /* can't handle output redirection (sigh). */
diff -x '*~' -ruN ../orig/gs-esp-7.07.1/src/gp_os2.c gs-esp-7.07.1/src/gp_os2.c
--- ../orig/gs-esp-7.07.1/src/gp_os2.c  2003-07-13 05:43:17.000000000 +0100
+++ gs-esp-7.07.1/src/gp_os2.c  2005-08-30 18:46:40.000000000 +0100
@@ -72,7 +72,7 @@
 
 #ifdef __DLL__
 /* use longjmp instead of exit when using DLL */
-#include <setjmp.h>
+#include "gsfix-setjmp.h"
 extern jmp_buf gsdll_env;
 
 #endif
diff -x '*~' -ruN ../orig/gs-esp-7.07.1/src/gsfix-setjmp.h 
gs-esp-7.07.1/src/gsfix-setjmp.h
--- ../orig/gs-esp-7.07.1/src/gsfix-setjmp.h    1970-01-01 01:00:00.000000000 
+0100
+++ gs-esp-7.07.1/src/gsfix-setjmp.h    2005-08-30 18:46:40.000000000 +0100
@@ -0,0 +1,35 @@
+#ifndef GSFIX_SETJMP_H
+#define GSFIX_SETJMP_H
+
+#include <setjmp.h>
+
+typedef struct {
+  char c;
+  jmp_buf j;
+} gsfix_jmp_buf_test;
+
+#define gsfix_jmp_buf_align ((size_t)&((gsfix_jmp_buf_test*)0)->j)
+
+typedef struct {
+  unsigned char stuff[sizeof(jmp_buf) + gsfix_jmp_buf_align];
+} gsfix_jmp_buf;
+
+#define gsfix_orig_jmp_buf      jmp_buf
+#define gsfix_orig_setjmp(x)    setjmp(x)
+#define gsfix_orig_longjmp(x,y) longjmp((x),(y))
+
+#undef jmp_buf
+#undef setjmp
+#undef longjmp
+
+#define jmp_buf        gsfix_jmp_buf
+#define setjmp(x)      (gsfix_orig_setjmp(find_jmp_buf((x))))
+#define longjmp(x,val) (gsfix_orig_longjmp(find_jmp_buf((x)),(val)))
+
+#define find_jmp_buf(gsfjb)                            \
+  (                                                    \
+   ((size_t)(gsfjb).stuff + gsfix_jmp_buf_align)       \
+   & ~(size_t)(gsfix_jmp_buf_align-1)                  \
+  )
+
+#endif /*GSFIX_SETJMP_H*/
diff -x '*~' -ruN ../orig/gs-esp-7.07.1/src/sdct.h gs-esp-7.07.1/src/sdct.h
--- ../orig/gs-esp-7.07.1/src/sdct.h    2002-04-23 12:58:47.000000000 +0100
+++ gs-esp-7.07.1/src/sdct.h    2005-08-30 18:46:40.000000000 +0100
@@ -21,7 +21,7 @@
 #ifndef sdct_INCLUDED
 #  define sdct_INCLUDED
 
-#include <setjmp.h>            /* for jmp_buf */
+#include "gsfix-setjmp.h"              /* for jmp_buf */
 
 /* ------ DCT filters ------ */
 

--- End Message ---

Reply via email to