Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert/ mogrify aborts (SIGABRT or segfault) when resizing an image. #1134

Closed
dreirund opened this issue May 19, 2018 · 17 comments
Closed

convert/ mogrify aborts (SIGABRT or segfault) when resizing an image. #1134

dreirund opened this issue May 19, 2018 · 17 comments

Comments

@dreirund
Copy link

dreirund commented May 19, 2018

ImageMagick's convert and mogrify does segfault or receive SIGABRT when resizing an image with -resize. (I have noticed that over the last months already.)

Applies to: At least ImageMagick stable release 7.0.7.33, both

(Artix Linux is Arch Linux without systemd, but OpenRC or Runit.)

Way to reproduce:

In the terminal, Aborted will be printed out, and convert exits with exitcode 134.

The converted image has been written to disk, though.

For this bug, it does not really matter which size is passed to -resizè. If no -resize is specified, conversion works fine. Also when running mogrify -resize <size> on the non-resized image does lead to this. Applies also to other images.

The strace output of strace convert wizard.png -resize 16x16 wizard.jpg is pasted there: http://ix.io/1aOh, and the last lines are:

[...]
openat(AT_FDCWD, "/usr/lib/libjpeg.so.8", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360:\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=423696, ...}) = 0
mmap(NULL, 2519064, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fb9f8b0a000
mprotect(0x7fb9f8b71000, 2093056, PROT_NONE) = 0
mmap(0x7fb9f8d70000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x66000) = 0x7fb9f8d70000
close(3)                                = 0
mprotect(0x7fb9f8d70000, 4096, PROT_READ) = 0
mprotect(0x7fb9f9019000, 4096, PROT_READ) = 0
munmap(0x7fb9f8d72000, 641304)          = 0
stat("wizard.jpg", {st_mode=S_IFREG|0644, st_size=496, ...}) = 0
openat(AT_FDCWD, "wizard.jpg", O_RDWR|O_CREAT|O_TRUNC, 0666) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
write(3, "\377\330\377\340\0\20JFIF\0\1\1\2\0v\0v\0\0\377\333\0C\0\3\2\2\2\2\2\3"..., 496) = 496
fstat(3, {st_mode=S_IFREG|0644, st_size=496, ...}) = 0
close(3)                                = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---
rt_sigaction(SIGHUP, {sa_handler=0x7fba014c9ae0, sa_mask=[HUP], sa_flags=SA_RESTORER|SA_ONSTACK|SA_INTERRUPT, sa_restorer=0x7fba00e65b90}, NULL, 8) = 0
rt_sigaction(SIGINT, {sa_handler=0x7fba014c9ae0, sa_mask=[INT], sa_flags=SA_RESTORER|SA_ONSTACK|SA_INTERRUPT, sa_restorer=0x7fba00e65b90}, NULL, 8) = 0
rt_sigaction(SIGPIPE, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fba00e65b90}, NULL, 8) = 0
rt_sigaction(SIGTERM, {sa_handler=0x7fba014c9ae0, sa_mask=[TERM], sa_flags=SA_RESTORER|SA_ONSTACK|SA_INTERRUPT, sa_restorer=0x7fba00e65b90}, NULL, 8) = 0
rt_sigaction(SIGUSR1, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fba00e65b90}, NULL, 8) = 0
rt_sigaction(SIGUSR2, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fba00e65b90}, NULL, 8) = 0
rt_sigaction(SIGILL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fba00e65b90}, NULL, 8) = 0
rt_sigaction(SIGTRAP, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fba00e65b90}, NULL, 8) = 0
rt_sigaction(SIGABRT, {sa_handler=0x7fba014c9ae0, sa_mask=[ABRT], sa_flags=SA_RESTORER|SA_ONSTACK|SA_INTERRUPT, sa_restorer=0x7fba00e65b90}, NULL, 8) = 0
rt_sigaction(SIGFPE, {sa_handler=0x7fba014c9ae0, sa_mask=[FPE], sa_flags=SA_RESTORER|SA_ONSTACK|SA_INTERRUPT, sa_restorer=0x7fba00e65b90}, NULL, 8) = 0
rt_sigaction(SIGBUS, {sa_handler=0x7fba014c9ae0, sa_mask=[BUS], sa_flags=SA_RESTORER|SA_ONSTACK|SA_INTERRUPT, sa_restorer=0x7fba00e65b90}, NULL, 8) = 0
rt_sigaction(SIGSEGV, {sa_handler=0x7fba014c9ae0, sa_mask=[SEGV], sa_flags=SA_RESTORER|SA_ONSTACK|SA_INTERRUPT, sa_restorer=0x7fba00e65b90}, NULL, 8) = 0
rt_sigaction(SIGQUIT, {sa_handler=0x7fba014c9ae0, sa_mask=[QUIT], sa_flags=SA_RESTORER|SA_ONSTACK|SA_INTERRUPT, sa_restorer=0x7fba00e65b90}, NULL, 8) = 0
rt_sigaction(SIGSYS, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fba00e65b90}, NULL, 8) = 0
rt_sigaction(SIGXCPU, {sa_handler=0x7fba014c9ae0, sa_mask=[XCPU], sa_flags=SA_RESTORER|SA_ONSTACK|SA_INTERRUPT, sa_restorer=0x7fba00e65b90}, NULL, 8) = 0
rt_sigaction(SIGXFSZ, {sa_handler=0x7fba014c9ae0, sa_mask=[XFSZ], sa_flags=SA_RESTORER|SA_ONSTACK|SA_INTERRUPT, sa_restorer=0x7fba00e65b90}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, ~[RTMIN RT_1], NULL, 8) = 0
lseek(2, 0, SEEK_CUR)                   = 105595
rt_sigreturn({mask=[]})                 = 93857685377600
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---
rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [SEGV], 8) = 0
getpid()                                = 2363
gettid()                                = 2363
tgkill(2363, 2363, SIGABRT)             = 0
rt_sigprocmask(SIG_SETMASK, [SEGV], NULL, 8) = 0
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=2363, si_uid=1001} ---
rt_sigprocmask(SIG_BLOCK, [ABRT], NULL, 8) = 0
rt_sigaction(SIGABRT, {sa_handler=SIG_DFL, sa_mask=[ABRT], sa_flags=SA_RESTORER|SA_ONSTACK|SA_INTERRUPT, sa_restorer=0x7fba00e65b90}, {sa_handler=0x7fba014c9ae0, sa_mask=[ABRT], sa_flags=SA_RESTORER|SA_ONSTACK|SA_INTERRUPT, sa_restorer=0x7fba00e65b90}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [SEGV], 8) = 0
getpid()                                = 2363
gettid()                                = 2363
tgkill(2363, 2363, SIGABRT)             = 0
rt_sigprocmask(SIG_SETMASK, [SEGV], NULL, 8) = 0
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=2363, si_uid=1001} ---
+++ killed by SIGABRT +++

Some system information:

ImageMagick from Artix Linux has been compiled using:

# Fix up typemaps to match our packages, where possible
patch -Np1 -i ../arch-fonts.diff

./configure \
  --prefix=/usr \
  --sysconfdir=/etc \
  --with-dejavu-font-dir=/usr/share/fonts/TTF \
  --with-gs-font-dir=/usr/share/fonts/gsfonts \
  PSDelegate=/usr/bin/gs \
  XPSDelegate=/usr/bin/gxps \
  PCLDelegate=/usr/bin/gpcl6 \
  --enable-hdri \
  --enable-opencl \
  --with-gslib \
  --with-lqr \
  --with-modules \
  --with-openexr \
  --with-openjp2 \
  --with-perl \
  --with-perl-options=INSTALLDIRS=vendor \
  --with-rsvg \
  --with-webp \
  --with-wmf \
  --with-xml \
  --without-autotrace \
  --without-djvu \
  --without-dps \
  --without-fftw \
  --without-fpx \
  --without-gcc-arch \
  --without-gvc \
  --without-jbig
sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
make

where arch-fonts.diff I have uploaded to http://ix.io/1aP1.

ImageMagick locally compiled, it was compiled using:

./configure \
  --prefix=/usr \
  --sysconfdir=/etc \
  PSDelegate=/usr/bin/gs \
  XPSDelegate=/usr/bin/gxps \
  PCLDelegate=/usr/bin/gpcl6 \
  --enable-opencl \
  --enable-largefile \
  --enable-shared \
  --disable-static \
  --enable-deprecated \
  --enable-cipher \
  --enable-hdri \
  --enable-pipes \
  --enable-hugepages \
  --enable-legacy-support \
  --with-pic \
  --with-modules \
  --with-utilities \
  --with-magick-plus-plus \
  --with-perl \
  --with-perl-options=INSTALLDIRS=vendor \
  --with-jemalloc \
  --with-bzlib \
  --with-x \
  --with-zlib \
  --with-autotrace \
  --without-dps \
  --with-dejavu-font-dir=/usr/share/fonts/TTF \
  --with-fftw \
  --without-flif \
  --with-fpx \
  --with-djvu \
  --with-fontconfig \
  --with-freetype \
  --with-raqm \
  --with-gslib \
  --with-gs-font-dir=/usr/share/fonts/gsfonts \
  --with-gvc \
  --without-heic \
  --with-jbig \
  --with-jpeg \
  --with-lcms \
  --with-openjp2 \
  --with-lqr \
  --with-lzma \
  --with-openexr \
  --with-pango \
  --with-png \
  --with-raw \
  --with-rsvg \
  --with-webp \
  --with-wmf \
  --with-xml
make

uname -r: 4.15.6-pf

env:

LC_ALL=
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
CSF_TObjMessage=/usr/share/opencascade/resources/TObj
LC_MEASUREMENT=C
XDG_CONFIG_HOME=/home/felics/.config
LC_PAPER=de_DE.UTF8
LC_MONETARY=C
CSF_EXCEPTION_PROMPT=1
LANG=C
HISTCONTROL=ignoredups
PROFILEHOME=/home/felics/tmp
DISPLAY=:0
HISTTIMEFORMAT=%F %T 
OLDPWD=/tmp
SHELL_SESSION_ID=bce9818e95954467804c859a427a8930
EDITOR=mcedit
GTK_OVERLAY_SCROLLING=0
GTK_CSD=0
COLORTERM=truecolor
CSF_MIGRATION_TYPES=/usr/share/opencascade/resources/StdResource/MigrationSheet.txt
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
CSF_IGESDefaults=/usr/share/opencascade/resources/XSTEPResource
_PROFILE_D_SOURCED=variable_is_set
QGNOKII_PREFIX=/usr
CSF_XCAFDefaults=/usr/share/opencascade/resources/StdResource
XDG_VTNR=4
CSF_STEPDefaults=/usr/share/opencascade/resources/XSTEPResource
HG=/usr/bin/hg
COPASIDIR=/usr
LC_NAME=C
XDG_SESSION_ID=c4
CSF_XSMessage=/usr/share/opencascade/resources/XSMessage
USER=felics
DRAWDEFAULT=/usr/share/opencascade/resources/DrawResources/DrawDefault
PAGER=less
LC_COLLATE=C
DRAWHOME=/usr/share/opencascade/resources/DrawResources
QT_QPA_PLATFORMTHEME=qt5ct
PWD=/tmp/imagemagick-resize-bug
HOME=/home/felics
LC_CTYPE=en_US.UTF8
BROWSER=/usr/local/bin/vivaldi.my
CSF_PluginDefaults=/usr/share/opencascade/resources/StdResource
XDG_DATA_DIRS=/usr/local/share:/usr/share:/usr/local/share:/usr/share
KONSOLE_DBUS_SESSION=/Sessions/3
LC_ADDRESS=C
CSF_StandardDefaults=/usr/share/opencascade/resources/StdResource
LC_NUMERIC=C
CSF_StandardLiteDefaults=/usr/share/opencascade/resources/StdResource
MMGT_CLEAR=1
SAL_USE_VCLPLUGIN=kde4
MAIL=/var/spool/mail/felics
CSF_TObjDefaults=/usr/share/opencascade/resources/StdResource
WINDOWPATH=13
QT_PLUGIN_PATH=/home/felics/.kde4/lib/kde4/plugins/:/usr/lib/kde4/plugins/
CSF_XmlOcafResource=/usr/share/opencascade/resources/XmlOcafResource
TERM=xterm-256color
SHELL=/bin/bash
KONSOLE_DBUS_SERVICE=:1.19
screen=0
LC_MESSAGES=C
KONSOLE_PROFILE_NAME=o
CASROOT=/usr
display=:0
CSF_ShadersDirectory=/usr/share/opencascade/resources/Shaders
XDG_SEAT=seat0
SHLVL=4
COLORFGBG=0;15
LANGUAGE=
CSF_OCCTResourcePath=/usr/share/opencascade/resources
PLAN9=/usr/lib/plan9
WINDOWID=23068678
LC_TELEPHONE=C
XDG_CACHE_HOME=/home/felics/.cache
LOGNAME=felics
XDG_RUNTIME_DIR=/tmp/XDG-felics
CSF_MDTVTexturesDirectory=/usr/share/opencascade/resources/Textures
XDG_DATA_HOME=/home/felics/.local/share
CSF_DrawPluginDefaults=/usr/share/opencascade/resources/DrawResources
XDG_CONFIG_DIRS=/etc/xdg:/etc/xdg
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/bin/vendor_perl:/usr/local/sbin:/usr/local/bin:/usr/games:/home/felics/bin:/home/felics/local/bin:/home/felics/sbin:/home/felics/local/sbin
LC_IDENTIFICATION=C
CSF_LANGUAGE=us
SDL_AUDIODRIVER=alsa
HISTSIZE=1000
UUTERM_FONT=/usr/share/fonts/ucf/ytty.ucf
HISTFILESIZE=
ETS_TOOLKIT=wx
GTK_IM_MODULE=xim
LC_TIME=C
CSF_SHMessage=/usr/share/opencascade/resources/SHMessage
_=/sbin/env
@fmw42
Copy link

fmw42 commented May 19, 2018

In ImageMagick, the correct syntax is to read the input first. IM 6 is forgiving, but IM 7 is not. For me on Mac OSX Sierra and ImageMagick 6.9.9-45 and ImageMagick 7.0.7-33, the following two commands work fine.

IM6
convert wizard.png -resize 16x16 wizard.jpg

IM7
magick wizard.png -resize 16x16 wizard.jpg

What delegates do you have when you run either

convert -version

or

magick -version

Does it contain JPG and PNG?

@dreirund
Copy link
Author

As I noted, both variants have the problem at my system (and usually I also read the input first, but upon the failure I also tested the other variants).

convert -version:

Version: ImageMagick 7.0.7-33 Q16 x86_64 2018-05-17 https://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: https://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenCL OpenMP 
Delegates (built-in): bzlib cairo fontconfig freetype gslib jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps raw rsvg tiff webp wmf x xml zlib

Yes, it cointains jpeg and png. (If it would have not, I would not have been able at all to convert, I think.)

@dreirund
Copy link
Author

.. e.g. on https://aur.archlinux.org/packages/tftpgui/#news, comment from 2017-12-27, you can see that also others have that problem.

@fmw42
Copy link

fmw42 commented May 19, 2018

Does it fail if you disable OpenMP? One other guess is whether you had pkg-config when you did your install of ImageMagick? Otherwise, I will bow out and leave it to the IM developers.

@dreirund
Copy link
Author

Yes, it fails also with --disable-openmp.
The executable pkg-config is of course there. Compilation is just fine.

@urban-warrior
Copy link
Member

Let's get a stack trace. Post the output from:

gdb convert
run -resize 16x16 wizard.png wizard.jpg
bt

@dreirund
Copy link
Author

gdb convert:

Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from convert...(no debugging symbols found)...done.

(gdb) run wizard.png -resize 16x16 wizard.jpg:

Starting program: /usr/bin/convert wizard.png -resize 16x16 wizard.jpg
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()

(gdb) bt:

#0  0x0000000000000000 in ?? ()
#1  0x00007fffef57ab94 in clReleaseContext () from /usr/lib/libOpenCL.so
#2  0x00007ffff7a10a87 in ?? () from /usr/lib/libMagickCore-7.Q16HDRI.so.6
#3  0x00007ffff79f92c8 in MagickCoreTerminus () from /usr/lib/libMagickCore-7.Q16HDRI.so.6
#4  0x00005555555552d2 in ?? ()
#5  0x00007ffff6fec9a7 in __libc_start_main () from /usr/lib/libc.so.6
#6  0x000055555555506a in ?? ()

(gdb) quit:

A debugging session is active.

        Inferior 1 [process 4087] will be killed.

Quit anyway? (y or n) y

This mentiones OpenCL and HDRI. So I have recompiled ImageMagick without OpenCL or without HDRI, and the problem seems to have to do with OpenCL:

Having ImageMagick compiled with --disable-opencl and --enable-hdri, the problem does not occur.

convert -version in this case:

Version: ImageMagick 7.0.7-33 Q16 x86_64 2018-05-20 https://www.imagemagick.org
[...]
Features: Cipher DPC HDRI Modules OpenMP 
Delegates (built-in): bzlib cairo fontconfig freetype gslib jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps raw rsvg tiff webp wmf x xml zlib

So the problem seems to be related to OpenCL.

(And, some convenience: make check also fails when compiled in such a way that convert wizard.png -resize 16x16 wizard.jpg fails.)

@urban-warrior
Copy link
Member

Disable OpenCL until our OpenCL developer has a chance to debug the code.

@dreirund
Copy link
Author

There seems to be another issue somewhere else:

When I do my customised build with many options, but with --disable-opencl, make check fails. Resizing an image works fine with this build, though. The output of make check, ./test-suite.log, I have ubloaded there: http://ix.io/1aTf; truncated output is the following:

=========================================
   ImageMagick 7.0.7: ./test-suite.log
=========================================

# TOTAL: 86
# PASS:  83
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 3

.. contents:: :depth: 2

ERROR: tests/validate-formats-disk
==================================

1..1
Version: ImageMagick 7.0.7-33 Q16 x86_64 2018-05-20 https://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC

ImageMagick Validation Suite (FormatsDisk)

[pixel-cache: disk] validate image formats in memory:
  test 0: ART/Undefined/TrueColor/8-bits... pass
  [...]
  test 70: CIN/Undefined/PaletteAlpha/8-bits... pass
./tests/validate-formats-disk.tap: line 23:  1565 Aborted                 ${VALIDATE} -validate formats-disk
  test 71: CIN/Undefined/PaletteBilevelAlpha/8-bits... pass
  test 72: CIN/Undefined/Bilevel/1-bitnot ok
ERROR: tests/validate-formats-disk.tap - too few tests run (expected 1, got 0)

ERROR: tests/validate-formats-map
=================================

1..1
Version: ImageMagick 7.0.7-33 Q16 x86_64 2018-05-20 https://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC

ImageMagick Validation Suite (FormatsMap)

[pixel-cache: memory-mapped] validate image formats in memory:
  test 0: ART/Undefined/TrueColor/8-bits... pass
  [...]
  test 70: CIN/Undefined/PaletteAlpha/8-bits... pass
./tests/validate-formats-map.tap: line 23:  4556 Aborted                 ${VALIDATE} -validate formats-map
  test 71: CIN/Undefined/PaletteBilevelAlpha/8-bits... pass
  test 72: CIN/Undefined/Bilevnot ok
ERROR: tests/validate-formats-map.tap - too few tests run (expected 1, got 0)

ERROR: tests/validate-formats-memory
====================================

1..1
Version: ImageMagick 7.0.7-33 Q16 x86_64 2018-05-20 https://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC

ImageMagick Validation Suite (FormatsMemory)

[pixel-cache: memory] validate image formats in memory:
  test 0: ART/Undefined/TrueColor/8-bits... pass
  [...]
  test 70: CIN/Undefined/PaletteAlpha/8-bits... pass
./tests/validate-formats-memory.tap: line 23:  9781 Aborted                 ${VALIDATE} -validate formats-memory
  test 71: CIN/Undefined/PaletteBilevelAlpha/8-bits... pass
  test 72: CIN/Undefined/Bilevel/1not ok
ERROR: tests/validate-formats-memory.tap - too few tests run (expected 1, got 0)

The customised many-options build has been done with:

  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    PSDelegate=/usr/bin/gs \
    XPSDelegate=/usr/bin/gxps \
    PCLDelegate=/usr/bin/gpcl6 \
    --disable-openmp \
    --disable-opencl \
    --enable-largefile \
    --enable-shared \
    --disable-static \
    --enable-deprecated \
    --enable-cipher \
    --enable-hdri \
    --enable-pipes \
    --enable-hugepages \
    --enable-legacy-support \
    --with-pic \
    --without-modules \
    --with-utilities \
    --with-magick-plus-plus \
    --with-perl \
    --with-perl-options=INSTALLDIRS=vendor \
    --with-jemalloc \
    --with-bzlib \
    --with-x \
    --with-zlib \
    --with-autotrace \
    --without-dps \
    --with-dejavu-font-dir=/usr/share/fonts/TTF \
    --with-fftw \
    --without-flif \
    --with-fpx \
    --with-djvu \
    --with-fontconfig \
    --with-freetype \
    --with-raqm \
    --with-gslib \
    --with-gs-font-dir=/usr/share/fonts/gsfonts \
    --with-gvc \
    --without-heic \
    --with-jbig \
    --with-jpeg \
    --with-lcms \
    --with-openjp2 \
    --with-lqr \
    --with-lzma \
    --with-openexr \
    --with-pango \
    --with-png \
    --with-raw \
    --with-rsvg \
    --with-webp \
    --with-wmf \
    --with-xml

Running male check in gdb gives no backtrace.

Whereas the following build (Arch/ Artix Linux, but with --disable-opencl instead of --enable-opencl) will succeed make check:

  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --with-dejavu-font-dir=/usr/share/fonts/TTF \
    --with-gs-font-dir=/usr/share/fonts/gsfonts \
    PSDelegate=/usr/bin/gs \
    XPSDelegate=/usr/bin/gxps \
    PCLDelegate=/usr/bin/gpcl6 \
    --enable-hdri \
    --disable-opencl \
    --with-gslib \
    --with-lqr \
    --with-modules \
    --with-openexr \
    --with-openjp2 \
    --with-perl \
    --with-perl-options=INSTALLDIRS=vendor \
    --with-rsvg \
    --with-webp \
    --with-wmf \
    --with-xml \
    --without-autotrace \
    --without-djvu \
    --without-dps \
    --without-fftw \
    --without-fpx \
    --without-gcc-arch \
    --without-gvc \
    --without-jbig

@urban-warrior
Copy link
Member

These tests pass on our Fedora 28, Centos 7.2, and Windows systems, otherwise the release would be withheld. Can you try ImageMagick 7.0.7-34 Beta? If that fails, the problem may be specific to your OS, or compiler chain. We do not have access to Artix Linux so we cannot debug ourselves.

@dreirund
Copy link
Author

dreirund commented May 21, 2018

ImageMagick 7.0.7-34 is now in Arch Linux (and Artix Linux).

I compiled from https://www.imagemagick.org/download/ImageMagick-7.0.7-34.tar.xz.

Problems persist.

@urban-warrior
Copy link
Member

Thanks for the problem report. We have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ https://www.imagemagick.org/download/beta/ by sometime tomorrow.

@dreirund
Copy link
Author

dreirund commented Jun 2, 2018

With ImageMagick 7.0.7.37 still the Abort-issue when resizing an image. Seems to be related to OpenCL-libraries?

@dlemstra
Copy link
Member

dlemstra commented Jun 3, 2018

Can you add another back trace so we can see where this is happening?

@dreirund
Copy link
Author

dreirund commented Jun 5, 2018

$ convert en57.jpg -resize 16x16 en57.png
Aborted

$ gdb convert
GNU gdb (GDB) 8.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from convert...(no debugging symbols found)...done.

(gdb) run en57.jpg -resize 16x16 en57.png
Starting program: /usr/bin/convert en57.jpg -resize 16x16 en57.png
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()

(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007fffed00db94 in clReleaseContext () from /usr/lib/libOpenCL.so
#2  0x00007ffff761990e in ?? () from /usr/lib/libMagickCore-7.Q16HDRI.so.6
#3  0x00007ffff761c8a7 in ?? () from /usr/lib/libMagickCore-7.Q16HDRI.so.6
#4  0x00007ffff7608937 in MagickCoreTerminus () from /usr/lib/libMagickCore-7.Q16HDRI.so.6
#5  0x000055555555518b in ?? ()
#6  0x00007ffff6bf79a7 in __libc_start_main () from /usr/lib/libc.so.6
#7  0x0000555555554f1a in ?? ()

(gdb) quit
A debugging session is active.

        Inferior 1 [process 5779] will be killed.

Quit anyway? (y or n) y

ImageMagick version:

$ convert --version
Version: ImageMagick 7.0.7-38 Q16 x86_64 2018-06-03 https://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: https://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenCL OpenMP
Delegates (built-in): bzlib cairo fontconfig freetype gslib jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps raw rsvg tiff webp wmf x xml zlib

Information about the OpenCL-library on my system (Arch/ Artix Linux):

$ pacman -Qo /usr/lib/libOpenCL.so
/usr/lib/libOpenCL.so is owned by ocl-icd 2.2.12-1

$ pacman -Qi ocl-icd
Name            : ocl-icd
Version         : 2.2.12-1
Description     : OpenCL ICD Bindings
Architecture    : x86_64
URL             : https://forge.imag.fr/projects/ocl-icd/
Licenses        : BSD
Groups          : None
Provides        : opencl-icd-loader
Depends On      : glibc
Optional Deps   : opencl-driver: packaged opencl driver [installed]
Required By     : clinfo  hashcat  intel-opencl-sdk
Optional For    : libmagick  libmagick6  opencv  wine
Conflicts With  : libcl
Replaces        : libcl
Installed Size  : 240.00 KiB
Packager        : Artix Build Bot
Build Date      : Sun Jan 21 00:59:43 2018
Install Date    : Tue Jan 23 21:24:47 2018
Install Reason  : Installed as a dependency for another package
Install Script  : No
Validated By    : Signature

As always, building ImageMagick without OpenCL produces working convert -resize.

@dreirund
Copy link
Author

Probably in /usr/lib/libOpenCL.so and so probably not an ImageMagick-bug.

@dreirund
Copy link
Author

OK. It has to do with intel-compute-runtime, some Intel OpenCL implementation. If I remove that, it works (though I have only Mesa OpenCL then).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants