From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#37385: 27.0.50; Crash on multibyte assertion violation Date: Wed, 11 Sep 2019 23:24:03 +0300 Organization: LINKOV.NET Message-ID: <87tv9ir38c.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="74602"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) To: 37385@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 11 22:33:54 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i89JJ-000JJo-49 for geb-bug-gnu-emacs@m.gmane.org; Wed, 11 Sep 2019 22:33:53 +0200 Original-Received: from localhost ([::1]:55982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i89JH-0004lk-Se for geb-bug-gnu-emacs@m.gmane.org; Wed, 11 Sep 2019 16:33:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45945) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i89IV-0004Gq-NV for bug-gnu-emacs@gnu.org; Wed, 11 Sep 2019 16:33:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i89IU-00042s-BJ for bug-gnu-emacs@gnu.org; Wed, 11 Sep 2019 16:33:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33980) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i89IU-00042m-81 for bug-gnu-emacs@gnu.org; Wed, 11 Sep 2019 16:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i89IU-0001zp-3l for bug-gnu-emacs@gnu.org; Wed, 11 Sep 2019 16:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 11 Sep 2019 20:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 37385 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15682339447594 (code B ref -1); Wed, 11 Sep 2019 20:33:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Sep 2019 20:32:24 +0000 Original-Received: from localhost ([127.0.0.1]:42801 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i89Hs-0001yP-47 for submit@debbugs.gnu.org; Wed, 11 Sep 2019 16:32:24 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:60570) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i89Hq-0001yH-MK for submit@debbugs.gnu.org; Wed, 11 Sep 2019 16:32:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45651) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i89Ho-0003Vs-Qp for bug-gnu-emacs@gnu.org; Wed, 11 Sep 2019 16:32:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i89Hg-0003Z4-0f for bug-gnu-emacs@gnu.org; Wed, 11 Sep 2019 16:32:15 -0400 Original-Received: from anteater.elm.relay.mailchannels.net ([23.83.212.3]:30115) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i89He-0003VJ-In for bug-gnu-emacs@gnu.org; Wed, 11 Sep 2019 16:32:11 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id CC3C55E190D for ; Wed, 11 Sep 2019 20:32:02 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a53.g.dreamhost.com (100-96-91-237.trex.outbound.svc.cluster.local [100.96.91.237]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 4A86B5E1CA9 for ; Wed, 11 Sep 2019 20:32:02 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a53.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.17.5); Wed, 11 Sep 2019 20:32:02 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Troubled-Wide-Eyed: 38a9bdeb4e63ccf7_1568233922532_4207892381 X-MC-Loop-Signature: 1568233922532:2106337843 X-MC-Ingress-Time: 1568233922531 Original-Received: from pdx1-sub0-mail-a53.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a53.g.dreamhost.com (Postfix) with ESMTP id EAC39837A6 for ; Wed, 11 Sep 2019 13:31:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to :subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=linkov.net; bh=dhIJP/ycg0QfgHXADPf iADruANU=; b=V67PSIt9J5HUS237h5HNOw3N8WI3sOiROSuZyw7SuIXfXyj+TQ1 WviGGP8GOdvR2eB7uPKMtHjEPBd5PPtd3J16a3NKyf/DFPytWuxK1U9upZMX/fC1 uSVSRKhi1wzk2Vdx7+LBJQ2ODNVNriFhYsVjMV3FhB7q4OYKeRkRc0qA= Original-Received: from mail.jurta.org (m91-129-108-240.cust.tele2.ee [91.129.108.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a53.g.dreamhost.com (Postfix) with ESMTPSA id B9487837AB for ; Wed, 11 Sep 2019 13:31:57 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a53 X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: 0 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrtdefgdduvdegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuohffkfgfgggtgfesthekredttderjeenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdekrddvgedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddtkedrvdegtddprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopegsuhhgqdhgnhhuqdgvmhgrtghssehgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgeptd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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: 209.51.188.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:166364 Archived-At: Testing the tabs branch helped to expose a bug in master: In GNU Emacs 27.0.50 (build 6, x86_64-pc-linux-gnu) of 2019-09-11 built on localhost Repository revision: 4d90fadf27ccbb98e0e174304cb4e3008bf364fc Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.1190600= 0 System Description: Linux Mint 19.1 Configured using: 'configure --with-x-toolkit=3Dno --enable-checking=3Dyes,glyphs --enable-check-lisp-object-type 'CFLAGS=3D-O0 -g3'' These steps reproduce the crash in master: 0. emacs -Q 1. Eval: (define-key global-map [menu-bar test] '("Test =E2=AE=BF" keymap= )) 2. Visit an image file, e.g. etc/images/attach.pbm #0 0x00005555557a61b8 in terminate_due_to_signal (sig=3D6, backtrace_lim= it=3D2147483647) at emacs.c:374 #1 0x00005555558c7555 in die (msg=3D0x555555ae73ee "SINGLE_BYTE_CHAR_P (= c)", file=3D0x555555ae4790 "xdisp.c", line=3D7250) at alloc.c:7256 #2 0x00005555555e9e56 in get_next_display_element (it=3D0x7fffffff89b0) = at xdisp.c:7250 #3 0x000055555562938c in display_string (string=3D0x0, lisp_string=3DXIL= (0x5555567a0204), face_string=3DXIL(0), face_string_pos=3D0, start=3D0, i= t=3D0x7fffffff89b0, field_width=3D7, precision=3D0, max_x=3D674, multibyt= e=3D-1) at xdisp.c:25489 #4 0x00005555556239db in display_menu_bar (w=3D0x5555565cae40) at xdisp.= c:23533 #5 0x000055555560d61e in redisplay_window (window=3DXIL(0x5555565cae45),= just_this_one_p=3Dfalse) at xdisp.c:17821 #6 0x0000555555603b79 in redisplay_window_0 (window=3DXIL(0x5555565cae45= )) at xdisp.c:15116 #7 0x0000555555921b23 in internal_condition_case_1 (bfun=3D0x555555603b3= 7 , arg=3DXIL(0x5555565cae45), handlers=3DXIL(0x7fffe= 995aad3), hfun=3D0x555555603aff ) at eval.c:1379 #8 0x0000555555603ad1 in redisplay_windows (window=3DXIL(0x5555565cae45)= ) at xdisp.c:15096 #9 0x00005555556024c2 in redisplay_internal () at xdisp.c:14579 #10 0x00005555555ffea3 in redisplay () at xdisp.c:13806 #11 0x00005555557b7948 in read_char (commandflag=3D1, map=3DXIL(0x555556a= 2aba3), prev_event=3DXIL(0), used_mouse_menu=3D0x7fffffffdd25, end_time=3D= 0x0) at keyboard.c:2472 #12 0x00005555557c930f in read_key_sequence (keybuf=3D0x7fffffffdf10, pro= mpt=3DXIL(0), dont_downcase_last=3Dfalse, can_return_switch_frame=3Dtrue,= fix_current_buffer=3Dtrue, prevent_redisplay=3Dfalse) at keyboard.c:9125 #13 0x00005555557b3d8b in command_loop_1 () at keyboard.c:1345 #14 0x0000555555921a48 in internal_condition_case (bfun=3D0x5555557b390d = , handlers=3DXIL(0x90), hfun=3D0x5555557b2ed7 = ) at eval.c:1355 #15 0x00005555557b34f4 in command_loop_2 (ignore=3DXIL(0)) at keyboard.c:= 1091 #16 0x0000555555920ea2 in internal_catch (tag=3DXIL(0xcdb0), func=3D0x555= 5557b34c7 , arg=3DXIL(0)) at eval.c:1116 #17 0x00005555557b3492 in command_loop () at keyboard.c:1070 #18 0x00005555557b29be in recursive_edit_1 () at keyboard.c:714 #19 0x00005555557b2bb6 in Frecursive_edit () at keyboard.c:786 #20 0x00005555557a8acc in main (argc=3D3, argv=3D0x7fffffffe368) at emacs= .c:2086 An assertion violation is in get_next_display_element: if (! it->multibyte_p && ! ASCII_CHAR_P (c)) { eassert (SINGLE_BYTE_CHAR_P (c)); The menu item uses a multibyte char: c =3D 11199 (#o25677, #x2bbf, ?=E2=AE=BF) But init_iterator sets multibyte_p in the menu-bar window to the value of enable-multibyte-characters in the current buffer where enable-multibyte-characters is nil when an image file is visited in image-mode: /* Are multibyte characters enabled in current_buffer? */ it->multibyte_p =3D !NILP (BVAR (current_buffer, enable_multibyte_chara= cters)); I tried the following fix and it prevents the crash: diff --git a/src/xdisp.c b/src/xdisp.c index 94f969f37c..5730145268 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2984,7 +2984,9 @@ init_iterator (struct it *it, struct window *w, it->dp =3D window_display_table (w); =20 /* Are multibyte characters enabled in current_buffer? */ - it->multibyte_p =3D !NILP (BVAR (current_buffer, enable_multibyte_char= acters)); + it->multibyte_p =3D WINDOW_MENU_BAR_P (w) + || WINDOW_TOOL_BAR_P (w) + || !NILP (BVAR (current_buffer, enable_multibyte_characters)); =20 /* Get the position at which the redisplay_end_trigger hook should be run, if it is to be run at all. */ @@ -6864,7 +6866,9 @@ reseat_1 (struct it *it, struct text_pos pos, bool = set_stop_p) it->method =3D GET_FROM_BUFFER; it->object =3D it->w->contents; it->area =3D TEXT_AREA; - it->multibyte_p =3D !NILP (BVAR (current_buffer, enable_multibyte_char= acters)); + it->multibyte_p =3D WINDOW_MENU_BAR_P (it->w) + || WINDOW_TOOL_BAR_P (it->w) + || !NILP (BVAR (current_buffer, enable_multibyte_characters)); it->sp =3D 0; it->string_from_display_prop_p =3D false; it->string_from_prefix_prop_p =3D false;