> On May 30, 2021, at 18:06, Naofumi Yasufuku wrote: > >> 2021/05/30 17:38、Eli Zaretskii のメール: >> >> Maybe. At least the user init file is processed during startup after >> the window-system was fully initialized. The fontset you show in your >> crashed session also looks fine to me. So I cannot explain why trying >> to find font for an Arabic character could crash for you. >> >> Therefore, I went ahead and disabled accounting for automatic >> character compositions in 'format' and 'format-message'. Only >> 'string-width' tries to account for that. Please see if that solves >> your problem. >> > > No problem. I’ll try it. ------------------------------------------------------------------------ commit 23ad0f0c5adbeda9a0bd346138e2950cb5e5a136 Author: Eli Zaretskii Date: Sun May 30 11:16:59 2021 +0300 Don't account for character compositions in 'format' and friends 'lisp_string_width' is called from 'format' and 'format-message', which can be called both very early into Emacs initialization and in other contexts where using the font backend is impossible or undesirable. So this commit changes 'lisp_string_width' to try accounting for automatic compositions only when explicitly requested, and only 'string-width' does that; 'format' and 'format-message' don't. * src/character.c (lisp_string_width): Accept an additional argument AUTO_COMP; attempt accounting for auto-compositions only if that argument is non-zero. (Bug#48732) * src/editfns.c (styled_format): * src/character.c (Fstring_width): Callers of 'lisp_string_width' adjusted. ------------------------------------------------------------------------ This workaround works fine. I think this issue can be closed. Access to unrealized 'face->lface' Lisp_Object is not seen anymore on startup, and no segfault happens with both simple reproducing 'tramp-syntax’ init.el and my daily-use more complicated init.el. I comfirmed it on two intel macs which this segfault was observed: - MacBook running the latest macOS 11.4 - Mac mini running macOS 10.14 At the same time, font corruption issue with some themes is also disappeared as Pankaj said on emacs-devel list. (After autocmp string-width commits, I had seen the font corruption issue frequently with doom-tomorrow-night of doom-themes package.) > From: Pankaj Jangid > Subject: Re: This init file is crashing emacs on macos 11.4 > Date: Sun, 30 May 2021 15:34:36 +0530 > Cc: larsi@gnus.org, emacs-devel@gnu.org > > Eli Zaretskii writes: > > >> >>> The attached init file is crashing emacs on macos 11.4. > >> >> > >> >> Could this be the same bug as bug#48732? > >> > > >> > Yes. This could be. Because Naofumi also says that the fonts settings > >> > are corrupted when it doesn’t crash. I observe the same behavior. But I > >> > get the corrupted font only when using modus-operandi theme. > >> > > >> > >> And this could also be related. bug#48714. > > > > Does it still happen with the current master? > > Both the issues disappeared for me. Nice. :-) Regards, --Naofumi ------------------------------------------------------------------------ ## Verification with printf debug logs I tried 10 times gdb session, and no segfault happens. attachment: Bug48732-lisp_string_width-g23ad0f0-gdb-logs.tar.xz . ├── 0001-free_realized_face-printf-logs-for-lisp_string_width.patch ├── 00_before-segfaults │ ├── 00_SEGFAULT-free_realized_face-gdb-grep-0x1032af4a0.txt │ ├── 00_SEGFAULT-free_realized_face-gdb.txt.bz2 │ ├── 01_SEGFAULT-free_realized_face-gdb-grep-0x103435210.txt │ ├── 01_SEGFAULT-free_realized_face-gdb.txt.bz2 │ ├── 10_NO-SEGFAULT-free_realized_face-gdb-grep-0x1032cb260.txt │ ├── 10_NO-SEGFAULT-free_realized_face-gdb.txt.bz2 │ ├── 11_NO-SEGFAULT-free_realized_face-gdb-grep-0x1031a5880.txt │ ├── 11_NO-SEGFAULT-free_realized_face-gdb.txt.bz2 │ ├── after-lisp_string_width-autocmp.png │ └── emacs_crash-lisp_string_width-gdb_bt_full-with-pp.png ├── 10_after │ ├── lisp_string_width-g23ad0f0-gdb-00-grep-0x10cf4fff0.txt │ ├── lisp_string_width-g23ad0f0-gdb-00-grep-0x13e378a40.txt │ ├── lisp_string_width-g23ad0f0-gdb-00-grep-0x7ffeefbef230.txt │ ├── lisp_string_width-g23ad0f0-gdb-00-grep-0x7ffeefbf2c30.txt │ ├── lisp_string_width-g23ad0f0-gdb-00-grep-0x7ffeefbf5ac0.txt │ ├── lisp_string_width-g23ad0f0-gdb-00-grep-0x7ffeefbf8ea0.txt │ ├── lisp_string_width-g23ad0f0-gdb-00-grep-0x7ffeefbf9e90.txt │ ├── lisp_string_width-g23ad0f0-gdb-00-grep-0x7ffeefbfa140.txt │ ├── lisp_string_width-g23ad0f0-gdb-00.txt │ ├── lisp_string_width-g23ad0f0-gdb-01.txt │ ├── lisp_string_width-g23ad0f0-gdb-03.txt │ ├── lisp_string_width-g23ad0f0-gdb-04.txt │ ├── lisp_string_width-g23ad0f0-gdb-05.txt │ ├── lisp_string_width-g23ad0f0-gdb-06.txt │ ├── lisp_string_width-g23ad0f0-gdb-07.txt │ ├── lisp_string_width-g23ad0f0-gdb-08.txt │ └── lisp_string_width-g23ad0f0-gdb-09.txt ├── VERIFICATION_RESULT.txt ├── dot.gdbinit └── init.el logging patch: 0001-free_realized_face-printf-logs-for-lisp_string_width.patch init.el: -------------------------------------------------------------------------------- (custom-set-variables '(tramp-syntax 'default nil (tramp))) -------------------------------------------------------------------------------- Bug48732-lisp_string_width-g23ad0f0-gdb-logs/10_after/lisp_string_width-g23ad0f0-gdb-00.txt -------------------------------------------------------------------------------- GNU gdb (GDB) 10.2 Copyright (C) 2021 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-apple-darwin20.3.0". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./src/emacs... (gdb) r Starting program: /Users/naofumi/_git/git.sv.gnu.org/emacs/src/emacs [New Thread 0x2403 of process 17361] [New Thread 0x2303 of process 17361] warning: unhandled dyld version (17) realize_face: make_realized_face: face=0x103109560: face->lface=0x103109560 realize_face: make_realized_face: face=0x103109680: face->lface=0x103109680 realize_face: make_realized_face: face=0x1031097a0: face->lface=0x1031097a0 realize_face: make_realized_face: face=0x1031098c0: face->lface=0x1031098c0 realize_face: make_realized_face: face=0x1031099e0: face->lface=0x1031099e0 realize_face: make_realized_face: face=0x103109b00: face->lface=0x103109b00 realize_face: make_realized_face: face=0x103109c20: face->lface=0x103109c20 realize_face: make_realized_face: face=0x103109d40: face->lface=0x103109d40 realize_face: make_realized_face: face=0x103109e60: face->lface=0x103109e60 realize_face: make_realized_face: face=0x103109f80: face->lface=0x103109f80 realize_face: make_realized_face: face=0x10310a0a0: face->lface=0x10310a0a0 realize_face: make_realized_face: face=0x10310a1c0: face->lface=0x10310a1c0 realize_face: make_realized_face: face=0x10310a2e0: face->lface=0x10310a2e0 realize_face: make_realized_face: face=0x10310a400: face->lface=0x10310a400 realize_face: make_realized_face: face=0x10310a520: face->lface=0x10310a520 realize_face: make_realized_face: face=0x10310a640: face->lface=0x10310a640 realize_face: make_realized_face: face=0x10310a760: face->lface=0x10310a760 realize_face: make_realized_face: face=0x10310a880: face->lface=0x10310a880 realize_face: make_realized_face: face=0x10310a9a0: face->lface=0x10310a9a0 xfree: block=0x103226150 [..snip..] xfree: block=0x103945c00 free_all_realized_faces: ! NILP (frame) free_realized_faces: frame f=0x10509f830: c->faces_by_id[i] free_realized_face: frame f=0x10509f830: face=0x1031ee8c0 xfree: block=0x1031ee8c0 free_realized_faces: frame f=0x10509f830: c->faces_by_id[i] free_realized_face: frame f=0x10509f830: face=0x1031c4c90 xfree: block=0x1031c4c90 free_realized_faces: frame f=0x10509f830: c->faces_by_id[i] free_realized_face: frame f=0x10509f830: face=0x103169620 xfree: block=0x103169620 free_realized_faces: frame f=0x10509f830: c->faces_by_id[i] free_realized_face: frame f=0x10509f830: face=0x10316bc80 xfree: block=0x10316bc80 free_realized_faces: frame f=0x10509f830: c->faces_by_id[i] free_realized_face: frame f=0x10509f830: face=0x10316c4c0 xfree: block=0x10316c4c0 free_realized_faces: frame f=0x10509f830: c->faces_by_id[i] free_realized_face: frame f=0x10509f830: face=0x1031ef160 xfree: block=0x1031ef160 free_realized_faces: frame f=0x10509f830: c->faces_by_id[i] free_realized_face: frame f=0x10509f830: face=0x1033231e0 xfree: block=0x1033231e0 free_realized_faces: frame f=0x10509f830: c->faces_by_id[i] free_realized_face: frame f=0x10509f830: face=0x103324f10 xfree: block=0x103324f10 free_realized_faces: frame f=0x10509f830: c->faces_by_id[i] free_realized_face: frame f=0x10509f830: face=0x1033254f0 xfree: block=0x1033254f0 free_realized_faces: frame f=0x10509f830: c->faces_by_id[i] free_realized_face: frame f=0x10509f830: face=0x103325ad0 xfree: block=0x103325ad0 free_realized_faces: frame f=0x10509f830: c->faces_by_id[i] free_realized_face: frame f=0x10509f830: face=0x1033260b0 xfree: block=0x1033260b0 free_realized_faces: frame f=0x10509f830: c->faces_by_id[i] free_realized_face: frame f=0x10509f830: face=0x103326690 xfree: block=0x103326690 free_realized_faces: frame f=0x10509f830: c->faces_by_id[i] free_realized_face: frame f=0x10509f830: face=0x103326c70 xfree: block=0x103326c70 free_realized_faces: frame f=0x10509f830: c->faces_by_id[i] free_realized_face: frame f=0x10509f830: face=0x1033274b0 xfree: block=0x1033274b0 free_realized_faces: frame f=0x10509f830: c->faces_by_id[i] free_realized_face: frame f=0x10509f830: face=0x103327cf0 xfree: block=0x103327cf0 free_realized_faces: frame f=0x10509f830: c->faces_by_id[i] free_realized_face: frame f=0x10509f830: face=0x103328530 xfree: block=0x103328530 free_realized_faces: frame f=0x10509f830: c->faces_by_id[i] free_realized_face: frame f=0x10509f830: face=0x103328b10 xfree: block=0x103328b10 free_realized_faces: frame f=0x10509f830: c->faces_by_id[i] free_realized_face: frame f=0x10509f830: face=0x1033290f0 xfree: block=0x1033290f0 free_realized_faces: frame f=0x10509f830: c->faces_by_id[i] free_realized_face: frame f=0x10509f830: face=0x1031f2d90 xfree: block=0x1031f2d90 realize_gui_face: make_realized_face: face=0x103169620: face->lface=0x103169620 xfree: block=0x1049a4000 realize_face: realize_gui_face: face=0x103169620: face->lface=0x103169620 realize_gui_face: make_realized_face: face=0x1031c4c90: face->lface=0x1031c4c90 realize_face: realize_gui_face: face=0x1031c4c90: face->lface=0x1031c4c90 realize_gui_face: make_realized_face: face=0x10316a9c0: face->lface=0x10316a9c0 font_select_entity: frame f=0x10509f830: attrs=0x7ffeefbf2c30 xfree: block=0x104114c00 realize_face: realize_gui_face: face=0x10316a9c0: face->lface=0x10316a9c0 realize_gui_face: make_realized_face: face=0x1032dcc20: face->lface=0x1032dcc20 realize_face: realize_gui_face: face=0x1032dcc20: face->lface=0x1032dcc20 realize_gui_face: make_realized_face: face=0x1032dd460: face->lface=0x1032dd460 realize_face: realize_gui_face: face=0x1032dd460: face->lface=0x1032dd460 realize_gui_face: make_realized_face: face=0x1032ddca0: face->lface=0x1032ddca0 realize_face: realize_gui_face: face=0x1032ddca0: face->lface=0x1032ddca0 realize_gui_face: make_realized_face: face=0x1032de740: face->lface=0x1032de740 realize_face: realize_gui_face: face=0x1032de740: face->lface=0x1032de740 realize_gui_face: make_realized_face: face=0x1032ded20: face->lface=0x1032ded20 realize_face: realize_gui_face: face=0x1032ded20: face->lface=0x1032ded20 realize_gui_face: make_realized_face: face=0x1032df300: face->lface=0x1032df300 realize_face: realize_gui_face: face=0x1032df300: face->lface=0x1032df300 realize_gui_face: make_realized_face: face=0x1032df8e0: face->lface=0x1032df8e0 realize_face: realize_gui_face: face=0x1032df8e0: face->lface=0x1032df8e0 realize_gui_face: make_realized_face: face=0x1032dfec0: face->lface=0x1032dfec0 realize_face: realize_gui_face: face=0x1032dfec0: face->lface=0x1032dfec0 realize_gui_face: make_realized_face: face=0x1032e04a0: face->lface=0x1032e04a0 realize_face: realize_gui_face: face=0x1032e04a0: face->lface=0x1032e04a0 realize_gui_face: make_realized_face: face=0x1032e0a80: face->lface=0x1032e0a80 realize_face: realize_gui_face: face=0x1032e0a80: face->lface=0x1032e0a80 realize_gui_face: make_realized_face: face=0x1032e12c0: face->lface=0x1032e12c0 realize_face: realize_gui_face: face=0x1032e12c0: face->lface=0x1032e12c0 realize_gui_face: make_realized_face: face=0x1032e1b00: face->lface=0x1032e1b00 realize_face: realize_gui_face: face=0x1032e1b00: face->lface=0x1032e1b00 realize_gui_face: make_realized_face: face=0x1032e2340: face->lface=0x1032e2340 realize_face: realize_gui_face: face=0x1032e2340: face->lface=0x1032e2340 realize_gui_face: make_realized_face: face=0x1032e2920: face->lface=0x1032e2920 realize_face: realize_gui_face: face=0x1032e2920: face->lface=0x1032e2920 realize_gui_face: make_realized_face: face=0x1032e2f00: face->lface=0x1032e2f00 font_select_entity: frame f=0x10509f830: attrs=0x7ffeefbf2c30 realize_face: realize_gui_face: face=0x1032e2f00: face->lface=0x1032e2f00 realize_gui_face: make_realized_face: face=0x1032e3740: face->lface=0x1032e3740 font_select_entity: frame f=0x10509f830: attrs=0x7ffeefbf2c30 realize_face: realize_gui_face: face=0x1032e3740: face->lface=0x1032e3740 xfree: block=0x1032e4460 [..snip..] [Inferior 1 (process 17361) exited normally] (gdb) q -------------------------------------------------------------------------------- In GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin20.5.0, NS appkit-2022.50 Version 11.4 (Build 20F71)) of 2021-05-30 built on hyperion.local Repository revision: 23ad0f0c5adbeda9a0bd346138e2950cb5e5a136 Repository branch: master Windowing system distributor 'Apple', version 10.3.2022 System Description: macOS 11.4 Configured using: 'configure --prefix=/Users/naofumi/.local/emacs-head 'CFLAGS=-O0 -g3'' Configured features: ACL DBUS GIF GLIB GMP GNUTLS JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER PNG RSVG THREADS TIFF TOOLKIT_SCROLL_BARS XIM ZLIB Important settings: value of $LANG: ja_JP.UTF-8 locale-coding-system: utf-8-unix Major mode: Fundamental Minor modes in effect: shell-dirtrack-mode: t tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail rmail-loaddefs text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils tramp tramp-loaddefs trampver tramp-integration files-x tramp-compat shell pcomplete comint ansi-color ring parse-time iso8601 time-date ls-lisp format-spec auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs cl-loaddefs cl-lib password-cache json subr-x map seq byte-opt bytecomp byte-compile cconv gv japan-util iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind kqueue cocoa ns lcms2 multi-tty make-network-process emacs) Memory information: ((conses 16 64676 70998) (symbols 48 7901 68) (strings 32 22224 8156) (string-bytes 1 761506) (vectors 16 16018) (vector-slots 8 270817 93429) (floats 8 30 250) (intervals 56 200 91) (buffers 992 11))