Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#57740 closed defect (fixed)

ImageMagick @6.9.9-40_5: convert crashed when converting pdf to png

Reported by: pgee70 Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.5.4
Keywords: Cc: Dave-Allured (Dave Allured), nstanger (Nigel Stanger), basmac, joostdekeijzer (joost de keijzer)
Port: ImageMagick

Description

Hi Been using imagemagick/convert for years. I have been running automated tests.

After upgrading to version ImageMagick 6.9.9-40 i get an error when running the image magick convert command. Abort trap: 6

on converting an image that had previously worked using older versions.

I note that this is not the most recent version of imagmagic, also i don't appear to be able to downgrade to an earlier version using ports.

the same command works fine on ubuntu using Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114

mbp2016:Desktop pgee$ /opt/local/bin/convert --version
Version: ImageMagick 6.9.9-40 Q16 x86_64 2018-12-07 http://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules
Delegates (built-in): bzlib djvu fftw fontconfig freetype gslib jbig jng jp2 jpeg lcms ltdl lzma openexr png ps raw tiff webp x xml zlib
mbp2016:Desktop pgee$ /opt/local/bin/convert test.pdf[0] -geometry 32 -channel rgba -alpha on PNG32:qum.png
Abort trap: 6
port -v 
MacPorts 2.5.4

Attachments (4)

test.pdf (80.3 KB) - added by pgee70 6 years ago.
test.pdf
convert_debug.txt (8.0 KB) - added by nstanger (Nigel Stanger) 5 years ago.
Debug output from convert
convert_2019-11-04-094423_sobmac0011.crash (15.4 KB) - added by nstanger (Nigel Stanger) 5 years ago.
convert crash log
blank.pdf (1.2 KB) - added by nstanger (Nigel Stanger) 5 years ago.
PDF used to generate the crash log

Download all attachments as: .zip

Change History (25)

Changed 6 years ago by pgee70

Attachment: test.pdf added

test.pdf

comment:1 Changed 6 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: imagemagick removed
Owner: set to ryandesign
Port: ImageMagick added
Status: newaccepted
Summary: ImageMagick bugImageMagick @6.9.9-40_5: convert crashed when converting pdf to png

I can confirm the crash when running the command you provided (though a more basic convert test.pdf test.png works).

I've been meaning to update ImageMagick to the latest version of 6.x. But because the library versions change, it means I have to identify and revbump all the ports that link with those libraries, which is tedious and time-consuming.

comment:2 Changed 6 years ago by Dave-Allured (Dave Allured)

Cc: Dave-Allured added

comment:3 Changed 5 years ago by nstanger (Nigel Stanger)

I can confirm the same behaviour when converting a PDF to any of PNG, JPEG, and GIF. I did some digging and found that convert is failing to delete a temporary file under /var/folders (see attached debug log). I’m not sure whether this is because the file no longer exists or some other reason, but it looks like the former (the file is definitely not there after the fact). The temporary files it’s creating appear to be symlinks to the source image(s) being converted.

The problem is definitely in convert — I used convert -verbose to extract the generated GhostScript command and that worked fine.

This broke one of my video processing tools (see https://github.com/nstanger/process_podcast/issues/36) so it’s good to see that there is at least a ticket open for it.

Changed 5 years ago by nstanger (Nigel Stanger)

Attachment: convert_debug.txt added

Debug output from convert

comment:4 Changed 5 years ago by nstanger (Nigel Stanger)

Cc: nstanger added

comment:5 Changed 5 years ago by basmac

Cc: basmac added

comment:6 Changed 5 years ago by basmac

macports convert fails after clean and uninstall install

convert colorcir.ps colorcir.jpg
Abort trap: 6

Version 7 seems just fine on linux for the same file

-bash-4.1$ convert -version
Version: ImageMagick 7.0.8-36 Q16 x86_64 2019-04-02 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP
Delegates (built-in): bzlib fftw fontconfig freetype jng jpeg ltdl lzma pangocairo png tiff x xml zlib
-bash-4.1$ convert colorcir.ps colorcir.jpg
-bash-4.1$

Can we get the Version 7 installed ?

comment:7 Changed 5 years ago by basmac

I built Imagemagick from source and convert works on macOS 10.14

bash-3.2# /usr/local/bin/convert -version
Version: ImageMagick 7.0.8-62 Q16 x86_64 2019-09-17 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules
Delegates (built-in): bzlib djvu fftw fontconfig freetype gvc jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png raw tiff webp wmf x xml zlib
bash-3.2#

mac02:~ apsd$ which convert
/opt/local/bin/convert
mac02:~ apsd$ ls -l /usr/local/bin/convert
lrwxr-xr-x  1 root  admin  6 Sep 17 16:01 /usr/local/bin/convert -> magick
mac02:~ apsd$ cp /home/bmcinnes/colorcir.ps .
mac02:~ apsd$ /usr/local/bin/convert colorcir.ps colorcir.jpg
mac02:~ apsd$ ls -l colo*
-rw-r--r--  1 apsd  staff  245603 Sep 17 16:02 colorcir.jpg
-rw-r--r--  1 apsd  staff    1829 Sep 17 16:02 colorcir.ps
mac02:~ apsd$

If this helps I built it using dir=/usr/local

./configure \
CPPFLAGS="-w -m64 -fPIC" \
CFLAGS="-w -m64 -fPIC" \
CC=clang \
CXX=clang++ \
LDFLAGS="-L/opt/local/lib -L$dir/anaconda3/lib -L$dir/lib" \
LIBS="-lSM -luuid" \
--prefix=$dir \
--with-modules

comment:8 Changed 5 years ago by machielbos

Same problem here. After moving to Catalina I upgraded my MacPorts to darwin19. Reinstalled imagemagick using port install

ImageMagick-6.9.9-40_6+rsvg+x11.darwin_19.x86_64.tbz2 from https://packages.macports.org/ImageMagick

Xcode 11.2
Apple clang version 11.0.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin19.0.0
Thread model: posix

Example of call:

convert woa13_density_compr_0.25.eps woa13_density_compr_0.25.png
Abort trap: 6

worked perfectly before on darwin18

Last edited 5 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:9 in reply to:  6 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to basmac:

Can we get the Version 7 installed ?

ImageMagick 7 is not in MacPorts yet. See #51310.

comment:10 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

It would be good if someone could attach a crash log. But the first step we should probably take is updating ImageMagick to the latest 6.x version. See #57903.

comment:11 in reply to:  10 Changed 5 years ago by nstanger (Nigel Stanger)

Replying to ryandesign:

It would be good if someone could attach a crash log.

Is this different from the convert -debug log I attached a few months back (convert_debug.txt)? If so, what would you prefer and how do I generate it?

Last edited 5 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:12 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Yes. Whenever a program crashes, macOS writes a crash log to Library/Logs/DiagnosticReports/.

Changed 5 years ago by nstanger (Nigel Stanger)

convert crash log

Changed 5 years ago by nstanger (Nigel Stanger)

Attachment: blank.pdf added

PDF used to generate the crash log

comment:13 in reply to:  12 Changed 5 years ago by nstanger (Nigel Stanger)

Replying to ryandesign:

Yes. Whenever a program crashes, macOS writes a crash log to Library/Logs/DiagnosticReports/.

Aha! Easy :). See attached, the command was convert blank.pdf blank.png (I’ve also attached the PDF).

comment:14 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

It looks like a problem with Ghostscript:

9   ???                                 0x0000ffff00001fa0 0 + 281470681751456
10  libgs.9.27.dylib                    0x000000010e5ada59 gs_malloc_init_with_context + 34

From the Ghostscript library's gs_malloc_init_with_context function it tries to jump to an unreasonable memory address.

This has also been reported as #58595.

comment:15 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Looks like as of Ghostscript 9.27, a change is needed in ImageMagick when initializing Ghostscript. We need to update to ImageMagick 6.9.10-71 6.9.10-39 or later to get the fix.

Last edited 5 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:16 Changed 5 years ago by joostdekeijzer (joost de keijzer)

Cc: joostdekeijzer added

comment:17 Changed 5 years ago by joostdekeijzer (joost de keijzer)

For me, as a quick fix, downgrading Ghostscript to v9.26 works fine. See wiki:howto/InstallingOlderPort for the howto.

When building from source you'll need to checkout commit af11993aab38d7ba77c2df895aa5ce9b405c5681

https://github.com/macports/macports-ports/tree/af11993aab38d7ba77c2df895aa5ce9b405c5681

Last edited 5 years ago by joostdekeijzer (joost de keijzer) (previous) (diff)

comment:18 in reply to:  17 Changed 5 years ago by nstanger (Nigel Stanger)

Replying to joostdekeijzer:

For me, as a quick fix, downgrading Ghostscript to v9.26 works fine. See wiki:howto/InstallingOlderPort for the howto.

Handy workaround, thanks!

The Ghostscript port was recently updated to 9.5, but still dies in the same way (as I pretty much expected).

Last edited 5 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:19 in reply to:  15 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to ryandesign:

We need to update to ImageMagick 6.9.10-71 6.9.10-39 or later to get the fix.

And #57903 is about getting that update done.

comment:20 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: acceptedclosed

ImageMagick has been updated to 6.9.10-71 and should no longer have this bug. If you had downgraded ghostscript to 9.26 to work around this bug, remember to reactivate ghostscript 9.50 before upgrading everything else.

comment:21 in reply to:  20 Changed 5 years ago by nstanger (Nigel Stanger)

Replying to ryandesign:

ImageMagick has been updated to 6.9.10-71 and should no longer have this bug.

Yes! Working correctly now. Thanks!

Note: See TracTickets for help on using tickets.