Subject: 27.1; Emacs crash in font handling with font-backend ns

From: Pieter van Oostrum <[email-masked]>
Date: Tue, 24 Nov 2020 19:09:55 +0100

Emacs 27 crashes with the following init.el file:

(setq default-frame-alist
    '((ns-appearance . darkgray)
	  (tool-bar-lines . 0)
	  (width . 100)
	  (top . 1)
	  (fullscreen . fullheight)
	  (modeline . t)
	  (mouse-color . "black")
	  (background-mode . light)
	  (menu-bar-lines . 1)
	  (cursor-color . "darkblue")
	  (background-color . "White")
	  (foreground-color . "Black")
	  (font . "-apple-Monaco-medium-normal-normal-*-12-*-*-*-m-0-iso10646-1")
	  (fontsize . 12)
	  (font-backend ns)
	  (left-fringe)
	  (right-fringe)))

I have been using this construction for years, but recently it caused
emacs to crash. I recently switched over to Emacs 27.1.1 after having
used an older Emacs 27 version for months.

The offending line is '(font-backend ns)', without this line there is no
crash.
Also if I start Emacs with -Q and eval this expression directly or load
.init.el there is no problem, only when it is used in the init file.

I read somewhere that font-backend 'ns' is deprecated, but Emacs
shouldn't crash. If this font-backend is wrong it should give en error
message.

As this is the distributed Emacs from
https://emacsformacosx.com/emacs-builds/Emacs-27.1-1-universal.dmg there
is no symbol table information

Thread 3 received signal SIGSEGV, Segmentation fault.
0x000000010020aa0c in macfont_get_glyph_for_character ()
(gdb) bt full
#0  0x000000010020aa0c in macfont_get_glyph_for_character ()
No symbol table info available.
#1  0x0000000100208084 in macfont_encode_char ()
No symbol table info available.
#2  0x000000010003bfd4 in gui_produce_glyphs ()
No symbol table info available.
#3  0x0000000100025f29 in produce_special_glyphs ()
No symbol table info available.
#4  0x00000001000254b7 in init_iterator ()
No symbol table info available.
#5  0x000000010002ca8b in resize_mini_window ()
No symbol table info available.
#6  0x000000010002a90b in with_echo_area_buffer ()
No symbol table info available.
#7  0x000000010002a585 in resize_echo_area_exactly ()
No symbol table info available.
#8  0x00000001000ca4fa in command_loop_1 ()
No symbol table info available.
#9  0x0000000100155d97 in internal_condition_case ()
No symbol table info available.
#10 0x00000001000dcc80 in command_loop_2 ()
No symbol table info available.
#11 0x00000001001556ee in internal_catch ()
No symbol table info available.
#12 0x00000001000c9ace in command_loop ()
No symbol table info available.
#13 0x00000001000c99e3 in recursive_edit_1 ()
No symbol table info available.
#14 0x00000001000c9c12 in Frecursive_edit ()
No symbol table info available.
#15 0x00000001000c8808 in main ()
No symbol table info available.
(gdb) xbacktrace
Undefined command: "xbacktrace".  Try "help".
(gdb) 

In GNU Emacs 27.1 (build 1, x86_64-apple-darwin14.5.0, NS appkit-1348.17 Version 10.10.5 (Build 14F2511))
 of 2020-08-12 built on builder10-10.porkrind.org
Windowing system distributor 'Apple', version 10.3.1561
System Description:  Mac OS X 10.13.6

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list...

Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES
THREADS JSON PDUMPER

Important settings:
  value of $LC_CTYPE: UTF-8
  value of $LANG: en_NL.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  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
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: 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
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
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 timer select scroll-bar mouse
jit-lock font-lock syntax facemenu 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 loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
threads kqueue cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 47309 7327)
 (symbols 48 6705 1)
 (strings 32 16213 1922)
 (string-bytes 1 516049)
 (vectors 16 10337)
 (vector-slots 8 135883 7144)
 (floats 8 19 42)
 (intervals 56 206 0)
 (buffers 1000 13))

-- 
Pieter van Oostrum <[email-masked]>
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]