From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#28633: bug#28518: Daemon mode only renders the first image file loaded Date: Mon, 16 Oct 2017 23:57:01 -0700 Organization: UCLA Computer Science Department Message-ID: References: <87mv4rxycd.fsf@cassou.me> <87r2u3tj2d.fsf@petton.fr> <87mv4rux1o.fsf@petton.fr> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------DF6FBBCAFFF4712B27717FA0" X-Trace: blaine.gmane.org 1508223498 17361 195.159.176.226 (17 Oct 2017 06:58:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 17 Oct 2017 06:58:18 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 Cc: 28518@debbugs.gnu.org, 28770@debbugs.gnu.org, 28632@debbugs.gnu.org, 28633@debbugs.gnu.org, 28626@debbugs.gnu.org, Waleed Yousef , Joseph Mingrone , Noam Postavsky , Matt Lundin To: Nicolas Petton , Damien Cassou , s brown Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 17 08:58:12 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e4LpK-0003NR-3n for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Oct 2017 08:58:10 +0200 Original-Received: from localhost ([::1]:36856 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4LpR-0001qj-9b for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Oct 2017 02:58:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4LpF-0001p5-RJ for bug-gnu-emacs@gnu.org; Tue, 17 Oct 2017 02:58:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4LpD-00020o-OE for bug-gnu-emacs@gnu.org; Tue, 17 Oct 2017 02:58:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36008) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e4LpD-00020i-Ki for bug-gnu-emacs@gnu.org; Tue, 17 Oct 2017 02:58:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e4LpD-00072Y-Dv for bug-gnu-emacs@gnu.org; Tue, 17 Oct 2017 02:58:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Oct 2017 06:58:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28633 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Original-Received: via spool by 28633-submit@debbugs.gnu.org id=B28633.150822344526987 (code B ref 28633); Tue, 17 Oct 2017 06:58:03 +0000 Original-Received: (at 28633) by debbugs.gnu.org; 17 Oct 2017 06:57:25 +0000 Original-Received: from localhost ([127.0.0.1]:44684 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e4Lob-000717-4S for submit@debbugs.gnu.org; Tue, 17 Oct 2017 02:57:25 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:50604) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e4LoX-00070O-99; Tue, 17 Oct 2017 02:57:22 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 3D7091601EF; Mon, 16 Oct 2017 23:57:15 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id kagpNs7WwESc; Mon, 16 Oct 2017 23:57:14 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E1422160E30; Mon, 16 Oct 2017 23:57:13 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id m-sJPlZJyIBS; Mon, 16 Oct 2017 23:57:13 -0700 (PDT) Original-Received: from [192.168.1.9] (unknown [47.154.18.85]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id EBB521601EF; Mon, 16 Oct 2017 23:57:12 -0700 (PDT) In-Reply-To: <87mv4rux1o.fsf@petton.fr> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:138583 Archived-At: This is a multi-part message in MIME format. --------------DF6FBBCAFFF4712B27717FA0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable 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=20 workaround so benign, that I installed the attached into the emacs-26 bra= nch to=20 do that. Although Fedora will probably upgrade its ImageMagick version s= oon and=20 this upgrade will eventually filter out to users, the testing hassles are= =20 significant in the meantime. --------------DF6FBBCAFFF4712B27717FA0 Content-Type: text/x-patch; name="0001-Work-around-ImageMagick-bug-825.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-Work-around-ImageMagick-bug-825.patch" =46rom b38724ab675ac02dec865930a35abd8e06ee8e76 Mon Sep 17 00:00:00 2001 From: Paul Eggert 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 i= mage *img, char hint_buffer[MaxTextExtent]; char *filename_hint =3D NULL; =20 + /* Initialize the ImageMagick environment. */ + static bool imagemagick_initialized; + if (!imagemagick_initialized) + { + imagemagick_initialized =3D true; + MagickWandGenesis (); + } + /* Handle image index for image types who can contain more than one im= age. 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 im= age to find out things about it. */ =20 - /* Initialize the imagemagick environment. */ - MagickWandGenesis (); image =3D image_spec_value (img->spec, QCindex, NULL); ino =3D INTEGERP (image) ? XFASTINT (image) : 0; image_wand =3D NewMagickWand (); @@ -8859,8 +8865,10 @@ imagemagick_load_image (struct frame *f, struct im= age *img, DestroyMagickWand (image_wand); if (bg_wand) DestroyPixelWand (bg_wand); =20 - /* `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. = */ =20 return 1; =20 @@ -8868,7 +8876,6 @@ imagemagick_load_image (struct frame *f, struct ima= ge *img, DestroyMagickWand (image_wand); if (bg_wand) DestroyPixelWand (bg_wand); =20 - MagickWandTerminus (); /* TODO more cleanup. */ image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec); return 0; --=20 2.7.4 --------------DF6FBBCAFFF4712B27717FA0--