tag 354095 patch pending thanks * Julien BLACHE [Thu, 23 Feb 2006 12:11:50 +0100]:
> Package: gs-afpl > Version: 8.53-0.1 > Severity: important > Hi, > gs-afpl segfaults at startup on powerpc: Patch that fixes the issue attached an uploaded. Cheers, -- Adeodato Simó dato at net.com.org.es Debian Developer adeodato at debian.org America may be unique in being a country which has leapt from barbarism to decadence without touching civilization. -- John O'Hara
diff -u gs-afpl-8.53/debian/changelog gs-afpl-8.53/debian/changelog --- gs-afpl-8.53/debian/changelog +++ gs-afpl-8.53/debian/changelog @@ -1,3 +1,11 @@ +gs-afpl (8.53-0.2) unstable; urgency=low + + * NMU. + * Apply patch from #324796 against gs-gpl to fix identical segfault in + powerpc. (Closes: #354095) + + -- Adeodato Simó <[EMAIL PROTECTED]> Thu, 23 Mar 2006 02:14:11 +0100 + gs-afpl (8.53-0.1) unstable; urgency=low * NMU. (DELAYED/14-day) diff -u gs-afpl-8.53/debian/patches/00list gs-afpl-8.53/debian/patches/00list --- gs-afpl-8.53/debian/patches/00list +++ gs-afpl-8.53/debian/patches/00list @@ -8,0 +9 @@ +10_powerpc_crash_fix only in patch2: unchanged: --- gs-afpl-8.53.orig/debian/patches/10_powerpc_crash_fix.dpatch +++ gs-afpl-8.53/debian/patches/10_powerpc_crash_fix.dpatch @@ -0,0 +1,122 @@ +#! /bin/sh -e +## 10_powerpc_crash_fix.dpatch by Ian Jackson <[EMAIL PROTECTED]> +## +## * 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. +## +## * Patch found at http://bugs.debian.org/324796 and reformatted to dpatch by +## Jonas Smedegaard <[EMAIL PROTECTED]> +## * Patch included into gs-afpl source by Adeodato Simó <[EMAIL PROTECTED]> +## on 2006-03-23 to close #354095. + +if [ $# -ne 1 ]; then + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +fi +case "$1" in + -patch) patch -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -p1 < $0 +;; + -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;; + *) + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1;; +esac + +exit 0 + +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 ------ */ +