GNU bug report logs - #51012
29.0.50; Problems with emojis and vertical-motion

Previous Next

Package: emacs;

Reported by: Lars Ingebrigtsen <larsi <at> gnus.org>

Date: Mon, 4 Oct 2021 15:04:02 UTC

Severity: normal

Tags: fixed

Found in version 29.0.50

Fixed in version 28.1

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 51012 in the body.
You can then email your comments to 51012 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#51012; Package emacs. (Mon, 04 Oct 2021 15:04:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lars Ingebrigtsen <larsi <at> gnus.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 04 Oct 2021 15:04:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: bug-gnu-emacs <at> gnu.org
Cc: Robert Pluim <rpluim <at> gmail.com>
Subject: 29.0.50; Problems with emojis and vertical-motion
Date: Mon, 04 Oct 2021 17:02:58 +0200
The following signals an error:

(with-temp-buffer
  (insert "🏳️‍🌈")
  (vertical-motion 1))

Args out of range: 0

In some circumstances (when edebug is in action or it's running from an
async callback), it'll freeze Emacs altogether, so it's not totally safe
to eval.

I'm assuming it has something to do with the new emoji stuff, but I
haven't tried to debug.


In GNU Emacs 29.0.50 (build 9, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)
 of 2021-10-04 built on elva
Repository revision: 3f14418b1152e8455b0fcd28f496187dec9b4257
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
X11 XDBE XIM XPM GTK3 ZLIB


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51012; Package emacs. (Mon, 04 Oct 2021 16:45:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: 29.0.50; Problems with emojis and vertical-motion
Date: Mon, 04 Oct 2021 18:43:53 +0200
>>>>> On Mon, 04 Oct 2021 17:02:58 +0200, Lars Ingebrigtsen <larsi <at> gnus.org> said:

    Lars> The following signals an error:

    Lars> (with-temp-buffer
    Lars>   (insert "🏳️‍🌈")
    Lars>   (vertical-motion 1))

    Lars> Args out of range: 0

    Lars> In some circumstances (when edebug is in action or it's running from an
    Lars> async callback), it'll freeze Emacs altogether, so it's not totally safe
    Lars> to eval.

    Lars> I'm assuming it has something to do with the new emoji stuff, but I
    Lars> haven't tried to debug.

Gaah. What are the three most important problems in computer science
today?

1. Dependencies in code, especially when moving it
2. Off by one errors

This fixes it for me:

diff --git a/src/font.c b/src/font.c
index 82a1dffc01..83f0f8296a 100644
--- a/src/font.c
+++ b/src/font.c
@@ -3918,7 +3918,7 @@ font_range (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t *limit,
 	    val = XCAR (val);
 	  else if (VECTORP (val))
 	    val = AREF (val, 0);
-	  font_object = font_for_char (face, XFIXNAT (val), pos - 1, string);
+	  font_object = font_for_char (face, XFIXNAT (val), pos, string);
 	}
     }
 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51012; Package emacs. (Mon, 04 Oct 2021 16:52:01 GMT) Full text and rfc822 format available.

Message #11 received at 51012 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 51012 <at> debbugs.gnu.org
Subject: Re: 29.0.50; Problems with emojis and vertical-motion
Date: Mon, 04 Oct 2021 18:51:01 +0200
Robert Pluim <rpluim <at> gmail.com> writes:

> 1. Dependencies in code, especially when moving it
> 2. Off by one errors
>
> This fixes it for me:

That was quick.  :-)

> -	  font_object = font_for_char (face, XFIXNAT (val), pos - 1, string);
> +	  font_object = font_for_char (face, XFIXNAT (val), pos, string);

I can confirm that this fixes the issue for me, too.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51012; Package emacs. (Mon, 04 Oct 2021 17:01:01 GMT) Full text and rfc822 format available.

Message #14 received at 51012 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 51012 <at> debbugs.gnu.org
Subject: Re: 29.0.50; Problems with emojis and vertical-motion
Date: Mon, 04 Oct 2021 19:00:44 +0200
tags 51012 fixed
close 51012 28.1
quit

>>>>> On Mon, 04 Oct 2021 18:51:01 +0200, Lars Ingebrigtsen <larsi <at> gnus.org> said:

    Lars> Robert Pluim <rpluim <at> gmail.com> writes:
    >> 1. Dependencies in code, especially when moving it
    >> 2. Off by one errors
    >> 
    >> This fixes it for me:

    Lars> That was quick.  :-)

It was one of those "Uhm, that was dumb Robert, better save some face
by getting a move on" moments.

    >> -	  font_object = font_for_char (face, XFIXNAT (val), pos - 1, string);
    >> +	  font_object = font_for_char (face, XFIXNAT (val), pos, string);

    Lars> I can confirm that this fixes the issue for me, too.

Thanks for testing.

Closing.
Committed as 9750e78202




Added tag(s) fixed. Request was from Robert Pluim <rpluim <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 04 Oct 2021 17:01:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 51012 <at> debbugs.gnu.org and Lars Ingebrigtsen <larsi <at> gnus.org> Request was from Robert Pluim <rpluim <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 04 Oct 2021 17:01:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51012; Package emacs. (Mon, 04 Oct 2021 17:06:02 GMT) Full text and rfc822 format available.

Message #21 received at 51012 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 51012 <at> debbugs.gnu.org, larsi <at> gnus.org
Subject: Re: bug#51012: 29.0.50; Problems with emojis and vertical-motion
Date: Mon, 04 Oct 2021 20:04:50 +0300
> From: Robert Pluim <rpluim <at> gmail.com>
> Date: Mon, 04 Oct 2021 18:43:53 +0200
> Cc: 51012 <at> debbugs.gnu.org
> 
> This fixes it for me:
> 
> diff --git a/src/font.c b/src/font.c
> index 82a1dffc01..83f0f8296a 100644
> --- a/src/font.c
> +++ b/src/font.c
> @@ -3918,7 +3918,7 @@ font_range (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t *limit,
>  	    val = XCAR (val);
>  	  else if (VECTORP (val))
>  	    val = AREF (val, 0);
> -	  font_object = font_for_char (face, XFIXNAT (val), pos - 1, string);
> +	  font_object = font_for_char (face, XFIXNAT (val), pos, string);
>  	}
>      }

Sounds obvious to me.  Why was there a minus there in the first place?
some remnant of debugging or the previous version?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51012; Package emacs. (Mon, 04 Oct 2021 17:09:02 GMT) Full text and rfc822 format available.

Message #24 received at 51012 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 51012 <at> debbugs.gnu.org, larsi <at> gnus.org
Subject: Re: bug#51012: 29.0.50; Problems with emojis and vertical-motion
Date: Mon, 04 Oct 2021 19:08:05 +0200
>>>>> On Mon, 04 Oct 2021 20:04:50 +0300, Eli Zaretskii <eliz <at> gnu.org> said:

    >> From: Robert Pluim <rpluim <at> gmail.com>
    >> Date: Mon, 04 Oct 2021 18:43:53 +0200
    >> Cc: 51012 <at> debbugs.gnu.org
    >> 
    >> This fixes it for me:
    >> 
    >> diff --git a/src/font.c b/src/font.c
    >> index 82a1dffc01..83f0f8296a 100644
    >> --- a/src/font.c
    >> +++ b/src/font.c
    >> @@ -3918,7 +3918,7 @@ font_range (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t *limit,
    >> val = XCAR (val);
    >> else if (VECTORP (val))
    >> val = AREF (val, 0);
    >> -	  font_object = font_for_char (face, XFIXNAT (val), pos - 1, string);
    >> +	  font_object = font_for_char (face, XFIXNAT (val), pos, string);
    >> }
    >> }

    Eli> Sounds obvious to me.  Why was there a minus there in the first place?
    Eli> some remnant of debugging or the previous version?

The previous version ran that code after pos had been incremented. So
when I moved it up I forgot to undo the adjustment of 'pos'.

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51012; Package emacs. (Mon, 04 Oct 2021 17:21:01 GMT) Full text and rfc822 format available.

Message #27 received at 51012 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 51012 <at> debbugs.gnu.org
Subject: Re: 29.0.50; Problems with emojis and vertical-motion
Date: Mon, 04 Oct 2021 19:19:59 +0200
Robert Pluim <rpluim <at> gmail.com> writes:

> It was one of those "Uhm, that was dumb Robert, better save some face
> by getting a move on" moments.

:-)

I'm cherry-picking the patch for master, too, because it locks up Emacs
in some circumstances (and waiting until the next merge is too long).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51012; Package emacs. (Mon, 04 Oct 2021 18:36:02 GMT) Full text and rfc822 format available.

Message #30 received at 51012 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 51012 <at> debbugs.gnu.org, Robert Pluim <rpluim <at> gmail.com>
Subject: Re: bug#51012: 29.0.50; Problems with emojis and vertical-motion
Date: Mon, 04 Oct 2021 14:35:35 -0400
Lars Ingebrigtsen wrote:

> I'm cherry-picking the patch for master, too, because it locks up Emacs
> in some circumstances (and waiting until the next merge is too long).

Anyone should free to merge emacs-28 to master at any time.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 02 Nov 2021 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 169 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.