Subject: Re: bug#28176: 26.0.50; Emacs hangs on entering a specific article in gnus

From: [email-masked] (Charles A. Roelli)
Date: Wed, 23 Aug 2017 21:56:15 +0200

> Date: Wed, 23 Aug 2017 20:10:50 +0100
> From: Alan Third <[email-masked]>
> 
> On Wed, Aug 23, 2017 at 04:29:35PM +0200, Charles A. Roelli wrote:
> > Seems like this may be a side effect of a recent change adding GIF
> > support in macOS (I'm CCing the author, Alan Third).
> 
> I’m quite confused. I tested this against gifs and jpegs, and they
> both worked fine. I never tested against pngs as I assumed, being
> a single image format like jpeg, it would work the same. It seems that
> jpegs are handled differently, though, as I stuck an fprintf in
> ns_load_image and it didn’t print anything when I loaded a jpeg.
> 
> Anyway, I’ve pushed a modification which fixes pngs while keeping
> animated gifs working.

Thanks!
 
> > In nsimage.m:111 (ns_load_image), there is this call to add_to_log:
> > 
> > add_to_log ("Unable to set index %d for image %s", index, img->spec);
> > 
> > but img->spec is a Lisp_Object:
> > 
> > (gdb) ptype img->spec
> > type = struct Lisp_Object {
> >     EMACS_INT i;
> > }
> > 
> > Maybe "%s" doesn't cover Lisp_Objects?  At any rate, that seems to be
> > what the error message is about.
> 
> This looks like it’s the same way it’s handled in image.c, so I don’t
> know why it doesn’t work here.
> 
> Unless it’s actually index that’s at fault since it’s *not* a
> Lisp_Object?

I think you're right.  This prevents the PNG error from causing a
hang for me (adding a call to make_number):

  add_to_log ("Unable to set index %d for image %s", make_number (index), img->spec);

And *Messages* ends up with the right error:

  Unable to set index 0 for image (image :type png :data \211PNG^M...
  (followed by the raw image bytes)