From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#48732: 28.0.50; lisp_string_width segfaults on startup under macOS Date: Sat, 29 May 2021 23:32:42 +0300 Message-ID: <83y2bx46xh.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4122"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 48732@debbugs.gnu.org To: Naofumi Yasufuku Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 29 22:33:10 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ln5dt-0000su-W3 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 29 May 2021 22:33:09 +0200 Original-Received: from localhost ([::1]:41880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ln5dt-0006Zz-24 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 29 May 2021 16:33:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ln5dm-0006Zf-DF for bug-gnu-emacs@gnu.org; Sat, 29 May 2021 16:33:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46224) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ln5dm-00073t-56 for bug-gnu-emacs@gnu.org; Sat, 29 May 2021 16:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ln5dm-0000Pj-19 for bug-gnu-emacs@gnu.org; Sat, 29 May 2021 16:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 29 May 2021 20:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48732 X-GNU-PR-Package: emacs Original-Received: via spool by 48732-submit@debbugs.gnu.org id=B48732.16223203641568 (code B ref 48732); Sat, 29 May 2021 20:33:01 +0000 Original-Received: (at 48732) by debbugs.gnu.org; 29 May 2021 20:32:44 +0000 Original-Received: from localhost ([127.0.0.1]:57770 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ln5dT-0000PD-OR for submit@debbugs.gnu.org; Sat, 29 May 2021 16:32:44 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:58748) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ln5dR-0000Oz-CF for 48732@debbugs.gnu.org; Sat, 29 May 2021 16:32:42 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:53280) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ln5dL-0006ml-Gf; Sat, 29 May 2021 16:32:35 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4934 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ln5dL-0005AQ-0F; Sat, 29 May 2021 16:32:35 -0400 In-Reply-To: (message from Naofumi Yasufuku on Sun, 30 May 2021 04:28:11 +0900) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:207549 Archived-At: > From: Naofumi Yasufuku > Date: Sun, 30 May 2021 04:28:11 +0900 > > After changes for auto-composition aware string-width (*), > emacs segfaults frequently on startup under macOS. > > gdb 'bt full’ is attached: > emacs_crash-lisp_string_width-gdb_bt_full.txt > emacs_crash-lisp_string_width-macOS_report.txt > > On my machine, crash occurrence frequency can be increased with > attached init.el. Unfortunately, I cannot reproduce the crash with > `--enable-checking='yes,glyphs' --enable-check-lisp-object-type` > configure options. > > Sometimes emacs starts without crash, but font setting is corrupted > like the attached screenshot: after-lisp_string_width-autocmp.png I cannot reproduce using your init.el. > (gdb) p sym > $1 = (Lisp_Object) 0x104621ba0 > (gdb) p XSYMBOL(sym) > [New Thread 0x1b1f of process 79812] > [New Thread 0x2a03 of process 79812] > $2 = (struct Lisp_Symbol *) 0x204e4a730 > (gdb) p XSYMBOL(sym)->u > Cannot access memory at address 0x204e4a730 > (gdb) p XSYMBOL(sym)->u.s > Cannot access memory at address 0x204e4a730 > (gdb) p XSYMBOL(sym)->u.s.name > Cannot access memory at address 0x204e4a738 So it's some kind of invalid "symbol". > (gdb) up > #2 0x00000001002976de in font_select_entity (f=0x10433f230, > entities=0x1048cb913, attrs=0x103778800, pixel_size=12, c=-1) > at font.c:3159 > 3159 FONT_SET_STYLE (prefer, FONT_WIDTH_INDEX, attrs[LFACE_SWIDTH_INDEX]); > (gdb) up > #3 0x00000001002971b9 in font_find_for_lface (f=0x10433f230, > attrs=0x103778800, spec=0x10422c7ed, c=-1) at font.c:3302 > 3302 val = font_select_entity (f, entities, What is 'spec' in this frame? (gdb) pp spec > (gdb) up > #4 0x000000010033905e in fontset_find_font (fontset=0x104419835, c=1603, > face=0x103778800, charset_id=-1, fallback=false) at fontset.c:660 > 660 font_entity = font_find_for_lface (f, face->lface, What is 'fontset' in this frame? > #8 0x0000000100324fce in autocmp_chars (rule=0x105f2311d, charpos=308, > bytepos=334, limit=312, win=0x104342e20, face=0x0, string=0x1033e79c4, > direction=0x0) at composite.c:923 > 923 font_object = font_range (charpos, bytepos, &to, win, face, string); > (gdb) up > #9 0x0000000100325f1d in find_automatic_composition (pos=308, limit=308, > start=0x7ffeefbf15a8, end=0x7ffeefbf15a0, gstring=0x7ffeefbf15b8, > string=0x1033e79c4) at composite.c:1612 > 1612 *gstring = autocmp_chars (elt, check.pos, check.pos_byte, > (gdb) up > #10 0x00000001001248c8 in lisp_string_width (string=0x1033e79c4, from=0, > to=479, precision=-1, nchars=0x7ffeefbf1a28, nbytes=0x7ffeefbf1a20) > at character.c:375 > 375 && find_automatic_composition (i, -1, &ignore, &end, &val, string) This seems to indicate Emacs is asking string-width to compute width of a string that has 479 characters? How come we have such a long string here? (gdb) pp string > (gdb) up > #11 0x00000001002514db in styled_format (nargs=2, args=0x7ffeefbf74c0, > message=false) at editfns.c:3392 > 3392 width = lisp_string_width (arg, 0, nchars_string, prec, > (gdb) up > #12 0x000000010024f48f in Fformat (nargs=2, args=0x7ffeefbf74c0) > at editfns.c:3061 > 3061 return styled_format (nargs, args, false); What are the arguments to 'format' here? (gdb) pp args[0] (gdb) pp args[1] > (gdb) up > #13 0x000000010026b23b in call3 (fn=0x100420bf5, arg1=0x1000000000, > arg2=0x7ffeefbf73f0, arg3=0x10026ec04 ) at eval.c:2912 > 2912 { What function is being called here, and with what arguments? (gdb) pp fn (gdb) pp arg1 (gdb) pp arg2 (gdb) pp arg3 The command 'pp' is defined in src/.gdbinit, you may need to source that file before you could use the command. Thanks.