unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#28518: Daemon mode only renders the first image file loaded
@ 2017-09-19 19:49 s brown
  2017-10-16  8:59 ` Damien Cassou
  2017-10-16 10:42 ` Noam Postavsky
  0 siblings, 2 replies; 12+ messages in thread
From: s brown @ 2017-09-19 19:49 UTC (permalink / raw)
  To: 28518

[-- Attachment #1: Type: text/plain, Size: 6404 bytes --]

Hi there,

When running emacs in daemon mode if I open an image file it will be
rendered in a window. If I try to open a second image file it will not
be rendered and in its place there will be a square. The size of the
square is constant and appears unrelated to the size of the image.

This issue can also be reproduced by closing the emacsclient, starting it
again and trying to open the image file for a second time.

For the purposes or reproducing this issue I downloaded the following
two files

https://lists.gnu.org/archive/html/emacs-devel/2015-10/png8Z1ZsfVurU.png
https://www.gnu.org/graphics/gnu-head.jpg

as test.png and test.jpg respectively

* Image rendering works in normal mode

$ emacs -Q
C-x C-f ~/test.png
...image loads
C-x C-f ~/test.jpg
...image loads
C-x C-c
$ emacs -Q
C-x C-f ~/test.png
...image loads
C-x C-f ~/test.jpg
...image loads

* Second image file fails to load

$ emacs --daemon -Q
$ emacsclient -c
C-x C-f ~/test.png
...image loads
C-x C-f ~/test.jpg
...image fails to load properly

It doesn't matter which image is loaded first, the second always fails
to render

* Loading same file in two different client sessions

$ emacs --daemon -Q
$ emacsclient -c
C-x C-f ~/test.png
...image loads
C-x C-c
$ emacsclient -c
C-x C-f ~/test.png
...image fails to load properly

In both of the failure cases I can see imagemagick errors in *messages*

Starting Emacs daemon.
When done with this frame, type C-x 5 0
Type C-c C-c to view the image as text.
When done with this frame, type C-x 5 0
Quit
QuitImageMagick error: no decode delegate for this image format `PNG' @ error/constitute.c/ReadImage/504
ImageMagick error: no decode delegate for this image format `PNG' @ error/constitute.c/ReadImage/504 [7 times]

I'm running Arch Linux and I can see from pacman that I have the
required libs for png and jpg support

$ uname -a
Linux OxBEEFED 4.12.13-1-ARCH #1 SMP PREEMPT Fri Sep 15 06:36:43 UTC 2017 x86_64 GNU/Linux

$ pacman -Qi imagemagick
Name            : imagemagick
Version         : 6.9.9.14-1
Description     : An image viewing/manipulation program
Architecture    : x86_64
URL             : http://www.imagemagick.org/
Licenses        : custom
Groups          : None
Provides        : None
Depends On      : libltdl  lcms2  libxt  fontconfig  libxext  liblqr  libraqm  opencl-icd-loader  perl>=5.26  perl<5.27
Optional Deps   : imagemagick-doc: for additional information
                  ghostscript: for Ghostscript support [installed]
                  openexr: for OpenEXR support
                  openjpeg2: for JP2 support [installed]
                  libwmf: for WMF support
                  librsvg: for SVG support [installed]
                  libxml2: for XML support [installed]
                  libpng: for PNG support [installed]
                  libwebp: for WEBP support [installed]
                  libraw: for DNG support
Required By     : emacs
Optional For    : feh
Conflicts With  : None
Replaces        : None
Installed Size  : 9.43 MiB
Packager        : Antonio Rojas <arojas@archlinux.org>
Build Date      : Mon 18 Sep 2017 16:01:53 BST
Install Date    : Mon 18 Sep 2017 19:19:33 BST
Install Reason  : Installed as a dependency for another package
Install Script  : No
Validated By    : Signature




In GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.19)
 of 2017-09-16 built on juergen
Windowing system distributor 'The X.Org Foundation', version 11.0.11903000
Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-modules
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong
 -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES

Important settings:
  value of $LC_COLLATE:
  value of $LC_CTYPE:
  value of $LC_MESSAGES:
  value of $LC_MONETARY:
  value of $LC_NUMERIC:
  value of $LC_TIME:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Text

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message idna dired format-spec rfc822
mml mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode easymenu
cl-loaddefs pcase cl-lib mail-prsvr mail-utils time-date mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 89565 4765)
 (symbols 48 19839 0)
 (miscs 40 164 121)
 (strings 32 14521 4513)
 (string-bytes 1 414412)
 (vectors 16 11838)
 (vector-slots 8 432375 4931)
 (floats 8 170 125)
 (intervals 56 254 0)
 (buffers 976 21))



[-- Attachment #2: Type: text/html, Size: 9274 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#28518: Daemon mode only renders the first image file loaded
  2017-09-19 19:49 bug#28518: Daemon mode only renders the first image file loaded s brown
@ 2017-10-16  8:59 ` Damien Cassou
  2017-10-16 11:42   ` Nicolas Petton
  2017-10-16 10:42 ` Noam Postavsky
  1 sibling, 1 reply; 12+ messages in thread
From: Damien Cassou @ 2017-10-16  8:59 UTC (permalink / raw)
  To: s brown; +Cc: 28518, Paul Eggert

I have a similar problem with a similar message

    ImageMagick error: no decode delegate for this image format `PNG' @ error/constitute.c/ReadImage/504

My setup:

- Fedora 26
- Emacs 25 and 26

However, I don't use the Emacs daemon and can reproduce with emacs -Q
directly:

$ emacs -Q
C-x C-f ~/test.png
...image loads
C-x C-f ~/test.jpg
...image DOES NOT load
C-x C-c

Even opening the same image again fails. It used to work. I guess the
problem comes from an update of my system but I don't know for how long it
has been broken.

I'm CC'ing Paul as he has been involved in some changes that might be
related, especially:

commit 3c2c50260e19deff2a0a054882eaea4049f25a2f
Author: Paul Eggert <eggert@cs.ucla.edu>
Date:   Thu Sep 29 20:09:37 2016 -0700

    Fix problems found by static checking --with-ns
    
    This is for Fedora 24 when configured with --enable-gcc-warnings.
    Although it does not fix all the problems, it fixes many of them.
    * src/frame.c (XParseGeometry):
    * src/nsterm.m (mouseDown:):
    Mark locals with UNINIT to pacify --enable-gcc-warnings.
    * src/image.c (PIX_MASK_DRAW, DefaultDepthOfScreen):
    Remove unused macros.
    (slurp_file xbm_scan, xbm_read_bitmap_data, xbm_load_image)
    (xbm_file_p, xbm_load, xpm_scan, xpm_make_color_table_v)
    (xpm_put_color_table_v, xpm_get_color_table_v)
    (xpm_make_color_table_h, xpm_put_color_table_h)
    (xpm_get_color_table_h, xpm_load_image, xpm_load)
    (pbm_next_char, pbm_scan_number, pbm_load, svg_load)
    (svg_load_image):
    * src/nsfns.m (x_get_string_resource):
    * src/nsimage.m (ns_image_from_XBM):
    Fix pointer signedness problems.
    * src/image.c (xpm_load_image, x_build_heuristic_mask, pbm_load)
    (imagemagick_load_image): Omit unused locals.
    * src/nsfns.m (ns_send_types, ns_return_types, ns_drag_types)
    (Fx_open_connection):
    * src/nsfont.m (ns_antialias_threshold):
    Move extern decl to nsterm.h so it can be checked.
    * src/nsmenu.m (svcsMenu, dockMenu):
    Move to the only file that uses them, so they can be static.
    * src/nsterm.h (find_and_call_menu_selection):
    * src/nsterm.m (x_set_frame_alpha):
    Omit duplicate decls.
    * src/nsterm.h (ns_dump_glyphstring): Mark as EXTERNALLY_VISIBLE.
    * src/nsfns.m (ns_tooltip, ns_display_info_for_name)
    (ns_set_name_as_filename, x_set_menu_bar_lines)
    (x_set_tool_bar_lines, x_set_internal_border_width):
    * src/nsterm.m (ns_drag_types, ns_draw_text_decoration):
    Now static.
    * src/nsfns.m (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp):
    * src/nsterm.m (ns_free_indexed_color, ns_color_to_lisp):
    Remove; unused.
    * src/nsfont.m (ns_dump_glyphstring):
    * src/nsterm.m (hide_bell, ns_get_color, ns_color_to_lisp)
    (ns_clear_frame, keyDown:):
    Fix signedness problem with printf arg.
    * src/nsterm.h (ns_input_events, ns_finish_events):
    * src/nsterm.m (ns_finish_events, hide_bell):
    Prototype the decls.
    * src/nsterm.m (NSMenuDidBeginTrackingNotification):
    Omit unnecessary decl.
    (dockMenu):
    (mainMenu) [NS_IMPL_COCOA]: Now static, and in this file.
    (ns_dumpglyphs_box_or_relief, changeFont:, initFrameFromEmacs:)
    (toggleFullScreen:): Use FACE_FROM_ID instead of
    FACE_FROM_ID_OR_NULL in contexts where the caller expects the
    result to be non-null.
    (applicationShouldTerminate:): Fix misleading indentation.

commit cbb2e845187bfbcc62e2accc9df7891a2326608a
Author: Mark Oteiza <mvoteiza@udel.edu>
Date:   Wed Sep 28 13:08:12 2016 -0400

    Turn on more lexical-binding
    
    * lisp/dom.el:
    * lisp/faces.el:
    * lisp/htmlfontify.el: Turn on lexical-binding.
    (htmlfontify-string): Use pushnew instead of add-to-list.
    * lisp/info-xref.el:
:

^

^commit 3c2c50260e19deff2a0a054882eaea4049f25a2f
Author: Paul Eggert <eggert@cs.ucla.edu>
Date:   Thu Sep 29 20:09:37 2016 -0700

    Fix problems found by static checking --with-ns
    
    This is for Fedora 24 when configured with --enable-gcc-warnings.
    Although it does not fix all the problems, it fixes many of them.
    * src/frame.c (XParseGeometry):
    * src/nsterm.m (mouseDown:):
    Mark locals with UNINIT to pacify --enable-gcc-warnings.
    * src/image.c (PIX_MASK_DRAW, DefaultDepthOfScreen):
    Remove unused macros.
    (slurp_file xbm_scan, xbm_read_bitmap_data, xbm_load_image)
    (xbm_file_p, xbm_load, xpm_scan, xpm_make_color_table_v)
    (xpm_put_color_table_v, xpm_get_color_table_v)
    (xpm_make_color_table_h, xpm_put_color_table_h)
    (xpm_get_color_table_h, xpm_load_image, xpm_load)
    (pbm_next_char, pbm_scan_number, pbm_load, svg_load)
    (svg_load_image):
    * src/nsfns.m (x_get_string_resource):
    * src/nsimage.m (ns_image_from_XBM):
    Fix pointer signedness problems.
    * src/image.c (xpm_load_image, x_build_heuristic_mask, pbm_load)
    (imagemagick_load_image): Omit unused locals.
    * src/nsfns.m (ns_send_types, ns_return_types, ns_drag_types)
    (Fx_open_connection):
    * src/nsfont.m (ns_antialias_threshold):
    Move extern decl to nsterm.h so it can be checked.
    * src/nsmenu.m (svcsMenu, dockMenu):
    Move to the only file that uses them, so they can be static.
    * src/nsterm.h (find_and_call_menu_selection):
    * src/nsterm.m (x_set_frame_alpha):
:

^

^commit 3c2c50260e19deff2a0a054882eaea4049f25a2f
Author: Paul Eggert <eggert@cs.ucla.edu>
Date:   Thu Sep 29 20:09:37 2016 -0700

    Fix problems found by static checking --with-ns
    
    This is for Fedora 24 when configured with --enable-gcc-warnings.
    Although it does not fix all the problems, it fixes many of them.
    * src/frame.c (XParseGeometry):
    * src/nsterm.m (mouseDown:):
    Mark locals with UNINIT to pacify --enable-gcc-warnings.
    * src/image.c (PIX_MASK_DRAW, DefaultDepthOfScreen):
    Remove unused macros.
    (slurp_file xbm_scan, xbm_read_bitmap_data, xbm_load_image)
    (xbm_file_p, xbm_load, xpm_scan, xpm_make_color_table_v)
    (xpm_put_color_table_v, xpm_get_color_table_v)
    (xpm_make_color_table_h, xpm_put_color_table_h)
    (xpm_get_color_table_h, xpm_load_image, xpm_load)
    (pbm_next_char, pbm_scan_number, pbm_load, svg_load)
    (svg_load_image):
    * src/nsfns.m (x_get_string_resource):
    * src/nsimage.m (ns_image_from_XBM):
    Fix pointer signedness problems.
    * src/image.c (xpm_load_image, x_build_heuristic_mask, pbm_load)
    (imagemagick_load_image): Omit unused locals.
    * src/nsfns.m (ns_send_types, ns_return_types, ns_drag_types)
    (Fx_open_connection):
    * src/nsfont.m (ns_antialias_threshold):
    Move extern decl to nsterm.h so it can be checked.
    * src/nsmenu.m (svcsMenu, dockMenu):
    Move to the only file that uses them, so they can be static.
    * src/nsterm.h (find_and_call_menu_selection):
    * src/nsterm.m (x_set_frame_alpha):
    Omit duplicate decls.
    * src/nsterm.h (ns_dump_glyphstring): Mark as EXTERNALLY_VISIBLE.
    * src/nsfns.m (ns_tooltip, ns_display_info_for_name)
    (ns_set_name_as_filename, x_set_menu_bar_lines)
    (x_set_tool_bar_lines, x_set_internal_border_width):
    * src/nsterm.m (ns_drag_types, ns_draw_text_decoration):
    Now static.
    * src/nsfns.m (ns_lisp_to_cursor_type, ns_cursor_type_to_lisp):
    * src/nsterm.m (ns_free_indexed_color, ns_color_to_lisp):
    Remove; unused.
    * src/nsfont.m (ns_dump_glyphstring):
    * src/nsterm.m (hide_bell, ns_get_color, ns_color_to_lisp)
    (ns_clear_frame, keyDown:):
    Fix signedness problem with printf arg.
    * src/nsterm.h (ns_input_events, ns_finish_events):
    * src/nsterm.m (ns_finish_events, hide_bell):
    Prototype the decls.
    * src/nsterm.m (NSMenuDidBeginTrackingNotification):
    Omit unnecessary decl.
    (dockMenu):
    (mainMenu) [NS_IMPL_COCOA]: Now static, and in this file.
    (ns_dumpglyphs_box_or_relief, changeFont:, initFrameFromEmacs:)
    (toggleFullScreen:): Use FACE_FROM_ID instead of
    FACE_FROM_ID_OR_NULL in contexts where the caller expects the
    result to be non-null.
    (applicationShouldTerminate:): Fix misleading indentation.


-- 
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#28518: Daemon mode only renders the first image file loaded
  2017-09-19 19:49 bug#28518: Daemon mode only renders the first image file loaded s brown
  2017-10-16  8:59 ` Damien Cassou
@ 2017-10-16 10:42 ` Noam Postavsky
  2017-10-16 11:37   ` Damien Cassou
  2017-10-16 15:14   ` Eli Zaretskii
  1 sibling, 2 replies; 12+ messages in thread
From: Noam Postavsky @ 2017-10-16 10:42 UTC (permalink / raw)
  To: s brown; +Cc: damien, 28518

forcemerge 28770 28518
quit

s brown <sjbrown@live.co.uk> writes:

> $ pacman -Qi imagemagick
> Name            : imagemagick
> Version         : 6.9.9.14-1

Damien Cassou <damien@cassou.me> writes:

> I have a similar problem with a similar message
>
>     ImageMagick error: no decode delegate for this image format `PNG' @ error/constitute.c/ReadImage/504
>
> My setup:
>
> - Fedora 26
> - Emacs 25 and 26

Please try updating imagemagick to 6.9.9.18-1.

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28633#13







^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#28518: Daemon mode only renders the first image file loaded
  2017-10-16 10:42 ` Noam Postavsky
@ 2017-10-16 11:37   ` Damien Cassou
  2017-10-16 15:14   ` Eli Zaretskii
  1 sibling, 0 replies; 12+ messages in thread
From: Damien Cassou @ 2017-10-16 11:37 UTC (permalink / raw)
  To: Noam Postavsky, s brown; +Cc: 28518

Noam Postavsky <npostavs@users.sourceforge.net> writes:
> Please try updating imagemagick to 6.9.9.18-1.
>
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28633#13

thank you very much Noam. For reference, I created a ticket for Fedora
26: https://bugzilla.redhat.com/show_bug.cgi?id=1502636.

It is however strange that it works for a colleague using exactly the
same version of ImageMagick and distribution and Emacs version as me.

-- 
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#28518: Daemon mode only renders the first image file loaded
  2017-10-16  8:59 ` Damien Cassou
@ 2017-10-16 11:42   ` Nicolas Petton
  2017-10-16 11:55     ` Nicolas Petton
  0 siblings, 1 reply; 12+ messages in thread
From: Nicolas Petton @ 2017-10-16 11:42 UTC (permalink / raw)
  To: Damien Cassou, s brown; +Cc: 28518, Paul Eggert

[-- Attachment #1: Type: text/plain, Size: 300 bytes --]

Damien Cassou <damien@cassou.me> writes:

> I have a similar problem with a similar message

I can reproduce the problem with `emacs -Q' on Fedora 26 with Emacs 25.3
from the official repository.

However, with my .emacs.d loaded, the problem disappears.  I'll
investigate.

Cheers,
Nico

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#28518: Daemon mode only renders the first image file loaded
  2017-10-16 11:42   ` Nicolas Petton
@ 2017-10-16 11:55     ` Nicolas Petton
  2017-10-17  6:57       ` bug#28633: " Paul Eggert
  0 siblings, 1 reply; 12+ messages in thread
From: Nicolas Petton @ 2017-10-16 11:55 UTC (permalink / raw)
  To: Damien Cassou, s brown; +Cc: 28518, Paul Eggert

[-- Attachment #1: Type: text/plain, Size: 433 bytes --]

Nicolas Petton <nicolas@petton.fr> writes:

> I can reproduce the problem with `emacs -Q' on Fedora 26 with Emacs 25.3
> from the official repository.

I could actually reproduce after restarting Emacs.

The problem appears to come from ImageMagick 6.9.9.15, which is the
version currently shipped in Fedora 26.

https://bugzilla.redhat.com/show_bug.cgi?id=1502636

Apparently, the issue has been resolved in 6.9.9-18.

Cheers,
Nico

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#28518: Daemon mode only renders the first image file loaded
  2017-10-16 10:42 ` Noam Postavsky
  2017-10-16 11:37   ` Damien Cassou
@ 2017-10-16 15:14   ` Eli Zaretskii
  1 sibling, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2017-10-16 15:14 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: damien, sjbrown, 28518

> From: Noam Postavsky <npostavs@users.sourceforge.net>
> Date: Mon, 16 Oct 2017 06:42:59 -0400
> Cc: damien@cassou.me, 28518@debbugs.gnu.org
> 
> > $ pacman -Qi imagemagick
> > Name            : imagemagick
> > Version         : 6.9.9.14-1
> 
> Damien Cassou <damien@cassou.me> writes:
> 
> > I have a similar problem with a similar message
> >
> >     ImageMagick error: no decode delegate for this image format `PNG' @ error/constitute.c/ReadImage/504
> >
> > My setup:
> >
> > - Fedora 26
> > - Emacs 25 and 26
> 
> Please try updating imagemagick to 6.9.9.18-1.
> 
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28633#13

I think this pops up so frequently that it warrants an entry in
etc/PROBLEMS.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#28633: bug#28518: Daemon mode only renders the first image file loaded
  2017-10-16 11:55     ` Nicolas Petton
@ 2017-10-17  6:57       ` Paul Eggert
  2017-10-17  7:19         ` Damien Cassou
  2017-10-17 14:42         ` bug#28626: " Eli Zaretskii
  0 siblings, 2 replies; 12+ messages in thread
From: Paul Eggert @ 2017-10-17  6:57 UTC (permalink / raw)
  To: Nicolas Petton, Damien Cassou, s brown
  Cc: 28518, 28770, 28632, 28633, 28626, Waleed Yousef, Joseph Mingrone,
	Noam Postavsky, Matt Lundin

[-- Attachment #1: Type: text/plain, Size: 437 bytes --]

Nicolas Petton wrote:

> Apparently, the issue has been resolved in 6.9.9-18.

Yes, that's right. Still, the ImageMagick bug is so easy to work around, and the 
workaround so benign, that I installed the attached into the emacs-26 branch to 
do that.  Although Fedora will probably upgrade its ImageMagick version soon and 
this upgrade will eventually filter out to users, the testing hassles are 
significant in the meantime.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Work-around-ImageMagick-bug-825.patch --]
[-- Type: text/x-patch; name="0001-Work-around-ImageMagick-bug-825.patch", Size: 2371 bytes --]

From b38724ab675ac02dec865930a35abd8e06ee8e76 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Mon, 16 Oct 2017 23:44:32 -0700
Subject: [PATCH] Work around ImageMagick bug 825

This should fix several bugs reported recently against Emacs
(Bug#28518, Bug#28626, Bug#28632, Bug#28633, Bug#28770).
* src/image.c (imagemagick_load_image):
Do not call MagickWandTerminus.
---
 src/image.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/image.c b/src/image.c
index 335a43e..c1c1671 100644
--- a/src/image.c
+++ b/src/image.c
@@ -8552,13 +8552,19 @@ imagemagick_load_image (struct frame *f, struct image *img,
   char hint_buffer[MaxTextExtent];
   char *filename_hint = NULL;
 
+  /* Initialize the ImageMagick environment.  */
+  static bool imagemagick_initialized;
+  if (!imagemagick_initialized)
+    {
+      imagemagick_initialized = true;
+      MagickWandGenesis ();
+    }
+
   /* Handle image index for image types who can contain more than one image.
      Interface :index is same as for GIF.  First we "ping" the image to see how
      many sub-images it contains.  Pinging is faster than loading the image to
      find out things about it.  */
 
-  /* Initialize the imagemagick environment.  */
-  MagickWandGenesis ();
   image = image_spec_value (img->spec, QCindex, NULL);
   ino = INTEGERP (image) ? XFASTINT (image) : 0;
   image_wand = NewMagickWand ();
@@ -8859,8 +8865,10 @@ imagemagick_load_image (struct frame *f, struct image *img,
   DestroyMagickWand (image_wand);
   if (bg_wand) DestroyPixelWand (bg_wand);
 
-  /* `MagickWandTerminus' terminates the imagemagick environment.  */
-  MagickWandTerminus ();
+  /* Do not call MagickWandTerminus, to work around ImageMagick bug 825.  See:
+     https://github.com/ImageMagick/ImageMagick/issues/825
+     Although this bug was introduced in ImageMagick 6.9.9-14 and
+     fixed in 6.9.9-18, it's simpler to work around it in all versions.  */
 
   return 1;
 
@@ -8868,7 +8876,6 @@ imagemagick_load_image (struct frame *f, struct image *img,
   DestroyMagickWand (image_wand);
   if (bg_wand) DestroyPixelWand (bg_wand);
 
-  MagickWandTerminus ();
   /* TODO more cleanup.  */
   image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec);
   return 0;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* bug#28633: bug#28518: Daemon mode only renders the first image file loaded
  2017-10-17  6:57       ` bug#28633: " Paul Eggert
@ 2017-10-17  7:19         ` Damien Cassou
  2017-10-17  8:53           ` bug#28770: " Nicolas Petton
  2017-10-17 14:42         ` bug#28626: " Eli Zaretskii
  1 sibling, 1 reply; 12+ messages in thread
From: Damien Cassou @ 2017-10-17  7:19 UTC (permalink / raw)
  To: Paul Eggert, Nicolas Petton, s brown
  Cc: 28518, 28770, 28632, 28633, 28626, Waleed Yousef, Joseph Mingrone,
	Noam Postavsky, Matt Lundin

Paul Eggert <eggert@cs.ucla.edu> writes:
> Yes, that's right. Still, the ImageMagick bug is so easy to work around, and the 
> workaround so benign, that I installed the attached into the emacs-26 branch to 
> do that.  Although Fedora will probably upgrade its ImageMagick
> version soon

the fixed ImageMagick is already in Fedora-s updates-testing and can be
installed with

    dnf --enablerepo=updates-testing update ImageMagick\*

-- 
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#28770: bug#28518: Daemon mode only renders the first image file loaded
  2017-10-17  7:19         ` Damien Cassou
@ 2017-10-17  8:53           ` Nicolas Petton
  0 siblings, 0 replies; 12+ messages in thread
From: Nicolas Petton @ 2017-10-17  8:53 UTC (permalink / raw)
  To: Damien Cassou, Paul Eggert, s brown
  Cc: 28518, 28770, 28632, 28633, 28626, Waleed Yousef, Joseph Mingrone,
	Noam Postavsky, Matt Lundin

[-- Attachment #1: Type: text/plain, Size: 246 bytes --]

Damien Cassou <damien@cassou.me> writes:

> the fixed ImageMagick is already in Fedora-s updates-testing and can be
> installed with
>
>     dnf --enablerepo=updates-testing update ImageMagick\*

Thanks, that worked for me as well.

Cheers,
Nico

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#28626: bug#28518: Daemon mode only renders the first image file loaded
  2017-10-17  6:57       ` bug#28633: " Paul Eggert
  2017-10-17  7:19         ` Damien Cassou
@ 2017-10-17 14:42         ` Eli Zaretskii
  2017-10-17 18:24           ` bug#28633: " Paul Eggert
  1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2017-10-17 14:42 UTC (permalink / raw)
  To: Paul Eggert
  Cc: sjbrown, 28518, 28770, damien, 28633, nicolas, 28626, wyousef,
	28632, jrm, npostavs, mdl

> Cc: 28518@debbugs.gnu.org, 28626@debbugs.gnu.org, 28632@debbugs.gnu.org,
>  28633@debbugs.gnu.org, 28770@debbugs.gnu.org, Glenn Morris <rgm@gnu.org>,
>  Noam Postavsky <npostavs@users.sourceforge.net>, Eli Zaretskii
>  <eliz@gnu.org>, Waleed Yousef <wyousef@fcih.net>,
>  Matt Lundin <mdl@imapmail.org>, Joseph Mingrone <jrm@ftfl.ca>
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Mon, 16 Oct 2017 23:57:01 -0700
> 
> > Apparently, the issue has been resolved in 6.9.9-18.
> 
> Yes, that's right. Still, the ImageMagick bug is so easy to work around, and the 
> workaround so benign, that I installed the attached into the emacs-26 branch to 
> do that.  Although Fedora will probably upgrade its ImageMagick version soon and 
> this upgrade will eventually filter out to users, the testing hassles are 
> significant in the meantime.

Thanks.  However, IME such workarounds should be conditioned on the
pertinent versions of ImageMagick, otherwise they might get in the way
further down the road.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#28633: bug#28518: Daemon mode only renders the first image file loaded
  2017-10-17 14:42         ` bug#28626: " Eli Zaretskii
@ 2017-10-17 18:24           ` Paul Eggert
  0 siblings, 0 replies; 12+ messages in thread
From: Paul Eggert @ 2017-10-17 18:24 UTC (permalink / raw)
  To: Eli Zaretskii
  Cc: sjbrown, 28518, 28770, damien, 28633, nicolas, 28626, wyousef,
	28632, jrm, npostavs, mdl

On 10/17/2017 07:42 AM, Eli Zaretskii wrote:
> IME such workarounds should be conditioned on the
> pertinent versions of ImageMagick, otherwise they might get in the way
> further down the road.

Normally I'd do that, and I first wrote code to operate that way. 
However, in this particular case the version-number testing code (which 
must be done at runtime, and cannot be done via simple integer 
comparison) was significantly more complicated and error-prone than 
simply working around the bug everywhere. As the workaround changes 
Emacs to use ImageMagick the way most other programs use ImageMagick, 
it's unlikely to cause problems in the future.






^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-10-17 18:24 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-19 19:49 bug#28518: Daemon mode only renders the first image file loaded s brown
2017-10-16  8:59 ` Damien Cassou
2017-10-16 11:42   ` Nicolas Petton
2017-10-16 11:55     ` Nicolas Petton
2017-10-17  6:57       ` bug#28633: " Paul Eggert
2017-10-17  7:19         ` Damien Cassou
2017-10-17  8:53           ` bug#28770: " Nicolas Petton
2017-10-17 14:42         ` bug#28626: " Eli Zaretskii
2017-10-17 18:24           ` bug#28633: " Paul Eggert
2017-10-16 10:42 ` Noam Postavsky
2017-10-16 11:37   ` Damien Cassou
2017-10-16 15:14   ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).