Control: reassign -1 libgnudatalanguage0
Control: retitle -1 Need to initialize GraphicsMagick on library load

Hi Bob, Ole,

On Thu, Apr 18, 2019 at 6:41 PM Bob Friesenhahn
<bfrie...@simple.dallas.tx.us> wrote:
> > Between the version which worked and the version which is failing, the
> > implementation of magick/resource.c was changed to allocate a semaphore for
> > each resource limit rather than using a single global semaphore across all
> > resource limits.
 Indeed, while GM got stricter it became more grained.

> Something else which changed since the changeset version which is
> reported as "working" is that when an Image is constructed it caches
> certain resource limits to be used later.  It does this in order to
> improve performance.  This means that the resource limit code is being
> invoked now whereas if an Image was statically constructed, it would
> not have been invoked before.
 This is confirmed, GDL (via g++ 8 allocator) calls
Magick::Image::Image() on library load due to static variable
initialization. See the backtrace snippet:
#9  0x00007ffff63f155c in Magick::Image::Image (
    this=0x7ffff7fafc60 <lib::gImage>) at Magick++/lib/Image.cpp:278
#10 0x00007ffff740b1d0 in __static_initialization_and_destruction_0 (
    __initialize_p=1, __priority=65535)
    at /usr/include/c++/8/ext/new_allocator.h:86
#11 _GLOBAL__sub_I_magick_cl.cpp(void) () at ./src/magick_cl.cpp:1086
#12 0x00007ffff7fe430a in call_init (l=<optimized out>, argc=argc@entry=1,
    argv=argv@entry=0x7fffffffecc8, env=env@entry=0x7fffffffecd8)
    at dl-init.c:72

> There is no proper fix other than to make sure that InitializeMagick()
> has been invoked before any other API elments are used.
 The attached patch for GDL fixes this issue by calling
Magick::InitializeMagick(NULL) via its START_MAGICK macro. Please
apply this to your package Ole.

Thanks,
Laszlo/GCS
Description: initialize GraphicsMagick on library load
 GNU Data Language library uses GraphicsMagick via static variables as well.
 These get initialized and used on its library load and initialization. For
 this reason GM library needs to be initialized on GDL library load.
Author: Laszlo Boszormenyi (GCS) <g...@debian.org>
Bug-Debian: https://bugs.debian.org/927307
Forwarded: no
Last-Update: 2019-04-19

---

--- gnudatalanguage-0.9.9.orig/src/magick_cl.cpp
+++ gnudatalanguage-0.9.9/src/magick_cl.cpp
@@ -66,6 +66,10 @@ namespace lib {
   unsigned int gCount = 0;
   static bool notInitialized = true;
 
+  __attribute__((constructor)) static void init(void) {
+    START_MAGICK;
+  }
+
   void magick_setup() {
     int i;
     for (i = 0; i < 40; ++i) gValid[i] = 0;

Reply via email to