#65630 closed enhancement (fixed)

GraphicsMagick: add debug variant

Reported by: mascguy (Christopher Nielsen) Owned by: mascguy (Christopher Nielsen)
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: debug Cc: ryandesign (Ryan Carsten Schmidt), parafin
Port: GraphicsMagick

Description (last modified by mascguy (Christopher Nielsen))

Presently, we're trying to diagnose a crash occurring for darktable, which appears to be originating from within this port:

issue:64252

There are two barriers, though:

  • The GraphicsMagick library installs a SIGSEGV handler, preventing the app from catching/handling the condition;
  • No +debug variant, which would assist with diagnostics.

For the debug variant, that should be reasonably straightforward, and would be beneficial.

Change History (13)

comment:1 Changed 21 months ago by mascguy (Christopher Nielsen)

Cc: ryandesign removed
Owner: changed from mascguy to ryandesign

Too much on my plate, I'll let Ryan tackle this

comment:2 Changed 21 months ago by mascguy (Christopher Nielsen)

Resolution: wontfix
Status: assignedclosed

issue:64252 has been resolved, so this is no longer needed.

If there's user demand, we can always reopen.

comment:3 Changed 21 months ago by jmroot (Joshua Root)

There is still the valid issue raised in the other ticket that GraphicsMagick installs its own SIGSEGV handler when used as a library. Up to you if you want to open a ticket for that, here or upstream.

comment:4 Changed 21 months ago by mascguy (Christopher Nielsen)

Description: modified (diff)
Resolution: wontfix
Status: closedreopened
Summary: GraphicsMagick: add debug variantGraphicsMagick: disable SIGSEGV handler in library; add debug variant

Let's expand the scope of this ticket to include the lib signal handler, per @jmroot in comment:3

comment:5 Changed 21 months ago by mascguy (Christopher Nielsen)

Cc: ryandesign added
Owner: changed from ryandesign to mascguy
Status: reopenedassigned

comment:6 in reply to:  description Changed 21 months ago by ryandesign (Ryan Carsten Schmidt)

Replying to mascguy:

Relative to the signal handler, we should consider patching the code to disable that, for the library. Along with engaging with upstream, for a longer-term fix.

Yes, please consult with upstream before attempting that.

comment:7 Changed 21 months ago by mascguy (Christopher Nielsen)

Cc: parafin added

Relative to the signal handlers, it looks like apps can now explicitly disable those. Functionality was added to the GraphicsMagick API in version 1.3.35, released 2020-02-23:

InitializeMagickEx(): New function which may be used in place of InitializeMagick() to initialize GraphicsMagick. This initialization function returns an error status value, may update a passed ExceptionInfo structure with error information, and provides an options parameter which supports simple bit-flags to tailor initialization. The signal handler registrations are skipped if the MAGICK_OPT_NO_SIGNAL_HANDER flag is set in the options.

@parafin, is that something you folks want to try, for darktable?

comment:8 Changed 21 months ago by mascguy (Christopher Nielsen)

Since apps now have control over signal handler registration, we can take that off of our plate.

As for the debug variant: Based on local testing, the debug portgroup does the trick for this port. Are there any concerns/gotchas with utilizing that?

comment:9 Changed 21 months ago by mascguy (Christopher Nielsen)

Description: modified (diff)
Summary: GraphicsMagick: disable SIGSEGV handler in library; add debug variantGraphicsMagick: add debug variant

comment:10 in reply to:  8 Changed 21 months ago by mascguy (Christopher Nielsen)

Replying to mascguy:

As for the debug variant: Based on local testing, the debug portgroup does the trick for this port. Are there any concerns/gotchas with utilizing that?

My only concern, is that pg debug unconditionally adds -mtune=native for non-debug builds. And ideally the pg shouldn't touch anything in that case.

I'm wondering if we should eliminate that behavior...?

comment:11 in reply to:  7 Changed 21 months ago by parafin

Replying to mascguy:

Relative to the signal handlers, it looks like apps can now explicitly disable those. Functionality was added to the GraphicsMagick API in version 1.3.35, released 2020-02-23:

InitializeMagickEx(): New function which may be used in place of InitializeMagick() to initialize GraphicsMagick. This initialization function returns an error status value, may update a passed ExceptionInfo structure with error information, and provides an options parameter which supports simple bit-flags to tailor initialization. The signal handler registrations are skipped if the MAGICK_OPT_NO_SIGNAL_HANDER flag is set in the options.

@parafin, is that something you folks want to try, for darktable?

PR submitted to darktable to be tested. IMHO it's still backwards, signal handler installation should be opt-in, not opt-out. But I do understand that it's more a question for upstream, not macports.

comment:12 Changed 20 months ago by Christopher Nielsen <mascguy@…>

In 99e1ff5d9dfe31857e559eb60eb360f4504b8e66/macports-ports (master):

pg debug: drop mtune=native for non-debug builds

  • More generally, ensure non-debug builds not affected, period
  • Also ensure flags are set for ObjC/Cxx

Fixes: #65132
See: #65630

comment:13 Changed 20 months ago by Christopher Nielsen <mascguy@…>

Resolution: fixed
Status: assignedclosed

In f75883c91850f2d782c6549b1fc50d4314a78611/macports-ports (master):

GraphicsMagick: add pg debug
Fixes: #65630

Note: See TracTickets for help on using tickets.