Subject: bug#11558: 24.1.50; Image Magick related build failure on bzr revision 108365

From: Kalle Kankare <[email-masked]>
Date: Wed, 11 Jul 2012 23:24:49 +0300

Hi,

I am also seeing the problem of temacs failing to load lisp/image.el
on 64-bit Archlinux during build. It fails with the following output:

...
Loading /home/kopoli/src/emacs/lisp/image.el (source)...
temacs: magick/exception.c:968: ThrowMagickExceptionList: Assertion
`exception->signature == 0xabacadabUL' failed.
/bin/sh: line 6: 27994 Aborted                 `/bin/pwd`/temacs
--batch --load loadup bootstrap
...

By running temacs through gdb it appears that the problem is in the
defun "imagemagick-types". The call to "GetMagickList" receives an
argument of type ExceptionInfo, which, by my interpretation of the
error message, needs to be initialized a certain way. Currently it is
just given an uninitialized local variable as an argument.

By looking through through ImageMagick documentation, the functions
"GetExceptionInfo" and "DestroyExceptionInfo" initialize and
deinitialize the ExceptionInfo-structure, respectively.

I got the build to complete by introducing the following change:

--- src/image.c	2012-07-09 12:02:27 +0000
+++ src/image.c	2012-07-11 19:59:24 +0000
@@ -7968,7 +7968,9 @@
   Lisp_Object typelist = Qnil;
   size_t numf = 0;
   ExceptionInfo ex;
+  GetExceptionInfo(&ex);
   char **imtypes = GetMagickList ("*", &numf, &ex);
+  DestroyExceptionInfo(&ex);
   size_t i;
   Lisp_Object Qimagemagicktype;
   for (i = 0; i < numf; i++)

The generated emacs-binary at least appears to function properly. I
tested this with the following versions:

emacs: bzr:109033
gcc: 4.7.1
ImageMagick: 6.7.8-1