From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alex Gramiak Newsgroups: gmane.emacs.bugs Subject: bug#35803: 26.2; Segfault when setting font-backend frame parameter from Xft to X on the initial frame Date: Sun, 19 May 2019 15:25:16 -0600 Message-ID: <87r28u6ssj.fsf@gmail.com> 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="5284"; mail-complaints-to="usenet@blaine.gmane.org" To: 35803@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 19 23:30:11 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.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hSTNi-0001F6-JK for geb-bug-gnu-emacs@m.gmane.org; Sun, 19 May 2019 23:30:10 +0200 Original-Received: from localhost ([127.0.0.1]:53888 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSTNh-0006lW-Fb for geb-bug-gnu-emacs@m.gmane.org; Sun, 19 May 2019 17:30:09 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:33172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSTJk-0003Kt-TP for bug-gnu-emacs@gnu.org; Sun, 19 May 2019 17:26:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSTJi-0007k3-Eg for bug-gnu-emacs@gnu.org; Sun, 19 May 2019 17:26:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50339) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hSTJi-0007jv-AQ for bug-gnu-emacs@gnu.org; Sun, 19 May 2019 17:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hSTJi-0007ZH-5f for bug-gnu-emacs@gnu.org; Sun, 19 May 2019 17:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alex Gramiak Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 May 2019 21:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 35803 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.155830112729047 (code B ref -1); Sun, 19 May 2019 21:26:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 May 2019 21:25:27 +0000 Original-Received: from localhost ([127.0.0.1]:35650 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hSTJ8-0007YQ-PV for submit@debbugs.gnu.org; Sun, 19 May 2019 17:25:27 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:46876) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hSTJ6-0007YD-EF for submit@debbugs.gnu.org; Sun, 19 May 2019 17:25:24 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:37804) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hSTJ1-00077U-AP for submit@debbugs.gnu.org; Sun, 19 May 2019 17:25:19 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:33025) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSTIz-0002bD-Me for bug-gnu-emacs@gnu.org; Sun, 19 May 2019 17:25:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSTIy-00075L-4n for bug-gnu-emacs@gnu.org; Sun, 19 May 2019 17:25:17 -0400 Original-Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:39904) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hSTIx-00073y-TA for bug-gnu-emacs@gnu.org; Sun, 19 May 2019 17:25:16 -0400 Original-Received: by mail-pf1-x432.google.com with SMTP id z26so6197509pfg.6 for ; Sun, 19 May 2019 14:25:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=420hGf6M7eceSiN/eHMwqVkYzsIVpjpmZXhH8DCdabg=; b=CXvxAcKJkHKRnyT3/1lEfzgseVJb0O5texUsa6U5R+bkRKh1dbyDFzN2QhXeM3b5wI aiG/tkrWCqNCZARP2gKbFGEcKih4VEBBG24UXSWg/GNsK30OX0F0vg6vPLAbsIPMYbhk 3kPGrJ5Z++1NT8rgucOSZG9DVXdu/cR6hcwTZc6jvguDA/wZcWvkPxNo4HEKDq4uZzz0 Icktbf/LBMXua6bI1VewL7rgIuwg28mMVIYnbERYk7gknA5GgJJXD10HGDi87k0u7w1g kwCY/0wrhFP0X9mOL3fBoGx+rJh3CW0A7FOb0xJgrR6j0iKpo6oE3dYnlz8vZeEEYivf jgVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=420hGf6M7eceSiN/eHMwqVkYzsIVpjpmZXhH8DCdabg=; b=jjym2eo2fNNaUuqTkh1S3DMLFmzvjxDEp//3fc4xwyioiz02eSSdRDC1mH4dwVZsxV DBWjWVZ0/3U+/izusxLetUudlMKnSxhUZSEZn8UZQGRg8dMv98TsfDxtBcgE9izv4UeJ e2wT8tpIeL+w7P1Cc4dOLAvK7BeFPS/pJwwHy5/me/Go/dcSNwaKshsMFboUYonDGEfZ JDIqm4XG8Ng+UTZjO22v76RrttTb8uX5TVWfr8e1sEP1PyHae5i2aARAmaBQ/DDxCzWb PSoXhRmYc69XqPqK8XIzKjHvFQtqOM7lj1PLpMq+vUOWNZJqUy2RDDH0nfAGIMkPT9iy rCow== X-Gm-Message-State: APjAAAXr+lHoz3FTD+GvmURPwwngpZVDXZygspwiCA0hCjakwTbBGPFg bwhH36vihVUpAbJPsDDvNE5jAaIX X-Google-Smtp-Source: APXvYqzBQiz8QwOoxrcDkuMkC0IZ+d5PignNJGIOCGTN0uWfr+GkFj1Lh0rqRLbvlGhXH90JU807Ew== X-Received: by 2002:a63:ee0b:: with SMTP id e11mr18812263pgi.453.1558301113583; Sun, 19 May 2019 14:25:13 -0700 (PDT) Original-Received: from lylat ([2604:3d09:e37f:1500:1a72:4878:e793:7302]) by smtp.gmail.com with ESMTPSA id u66sm17936792pfb.76.2019.05.19.14.25.12 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 19 May 2019 14:25:12 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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:159571 Archived-At: Recipe: 0. Use an Xft build of Emacs. 1. emacs -Q 2. (set-frame-parameter nil 'font-backend '(x)) 3. Segfault. This happens for me on both 26.2 and master. The crash only occurs on the initial frame; attempting this on other frames just results in the following error: (error "Font =E2=80=98-ADBO-Source Code Pro-normal-normal-normal-*-13-*-*= -*-m-0-iso10646-1=E2=80=99 is not defined") It should be noted that the other frames do otherwise switch to the Xfont backend. This also occurs with the following fonts: =E2=80=98-PfEd-DejaVu Sans Mono-normal-normal-normal-*-15-*-*-*-m-0-iso1064= 6-1=E2=80=99 =E2=80=98-GOOG-Noto Sans Mono-normal-normal-normal-*-16-*-*-*-*-0-iso10646-1 Here's the xbacktrace: (gdb) xbacktrace=20 "message" (0xffffb6f8) "debug" (0xffffbe48) "modify-frame-parameters" (0xffffc588) "set-frame-parameter" (0xffffc970) "progn" (0xffffcb68) "eval" (0xffffce20) "elisp--eval-last-sexp" (0xffffd2a8) "eval-last-sexp" (0xffffd850) "funcall-interactively" (0xffffd848) "call-interactively" (0xffffdbe0) "command-execute" (0xffffe0e8) Below is a bt showing that xftfont_info->xftfont is NULL in xftfont_text_extents, which seems to be the culprit. gui_set_font_backend sets the font-backend of the frame to '(x) and calls gui_set_font, which triggers the error above. For some reason, only non-initial frames handle the error semi-correctly. The solution is likely to unwind_protect around gui_set_font in gui_set_font_backend and reset Qfont_backend if an error occurs. It might help for the future to figure out the exact issue here, though. (gdb) sel 1 (gdb) p xftfont_info->display=20 $1 =3D (Display *) 0x555555d78c30 (gdb) p xftfont_info->xftfont=20 $2 =3D (XftFont *) 0x0 (gdb) bt #0 0x00007ffff6b5a160 in XftCharIndex () at /usr/lib/libXft.so.2 #1 0x000055555583cd8d in xftfont_encode_char (font=3D0x555556019290, c=3D9= 2) at xftfont.c:532 #2 0x00005555555fdf98 in get_char_glyph_code (c=3D92, font=3D0x55555601929= 0, char2b=3D0x7fffffff8a8e) at xdisp.c:26097 #3 0x0000555555607a29 in gui_produce_glyphs (it=3D0x7fffffff8c20) at xdisp= .c:28475 #4 0x000055555560657e in produce_special_glyphs (it=3D0x7fffffffa020, what= =3DIT_CONTINUATION) at xdisp.c:28106 #5 0x00005555555ba649 in init_iterator (it=3D0x7fffffffa020, w=3D0x555555f= f5a20, charpos=3D1, bytepos=3D1, row=3D0x0, base_face_id=3DDEFAULT_FACE_ID)= at xdisp.c:2958 #6 0x00005555555d3865 in resize_mini_window (w=3D0x555555ff5a20, exact_p= =3Dfalse) at xdisp.c:11323 #7 0x00005555555d330a in display_echo_area_1 (a1=3D93825003379232, a2=3D0x= 0) at xdisp.c:11211 #8 0x00005555555d2a46 in with_echo_area_buffer (w=3D0x555555ff5a20, which= =3D0, fn=3D0x5555555d32d4 , a1=3D93825003379232, a2=3D= 0x0) at xdisp.c:10981 #9 0x00005555555d327d in display_echo_area (w=3D0x555555ff5a20) at xdisp.c= :11177 #10 0x00005555555d44f3 in echo_area_display (update_frame_p=3Dtrue) at xdis= p.c:11664 #11 0x00005555555d1f18 in message3_nolog (m=3D0x5555565b0e34) at xdisp.c:10= 683 #12 0x00005555555d1c4e in message3 (m=3D0x5555565b0e34) at xdisp.c:10612 #13 0x0000555555794de7 in Fmessage (nargs=3D1, args=3D0x7fffffffb6f8) at ed= itfns.c:2891 #14 0x00005555557a284d in funcall_subr (subr=3D0x555555c1aae0 , n= umargs=3D1, args=3D0x7fffffffb6f8) at eval.c:2856 #15 0x00005555557a2509 in Ffuncall (nargs=3D2, args=3D0x7fffffffb6f0) at ev= al.c:2803 #16 0x00005555557ee00a in exec_byte_code (bytestr=3D0x5555565b0d74, vector= =3D0x5555564c7c25, maxdepth=3D0xa6, args_template=3D0x202, nargs=3D2, args= =3D0x7fffffffbe48) at bytecode.c:633 #17 0x00005555557a2fb3 in funcall_lambda (fun=3D0x5555565bdb05, nargs=3D2, = arg_vector=3D0x7fffffffbe48) at eval.c:2998 #18 0x00005555557a254d in Ffuncall (nargs=3D3, args=3D0x7fffffffbe40) at ev= al.c:2805 #19 0x00005555557a177c in Fapply (nargs=3D2, args=3D0x7fffffffbef0) at eval= .c:2425 #20 0x00005555557a1d2f in apply1 (fn=3D0x49b0, arg=3D0x555555d60de3) at eva= l.c:2641 #21 0x000055555579cba7 in call_debugger (arg=3D0x555555d60de3) at eval.c:340 #22 0x000055555579fa2a in maybe_call_debugger (conditions=3D0x7ffff0fc06cb,= sig=3D0x56d0, data=3D0x555555d60e53) at eval.c:1827 #23 0x000055555579f4fb in signal_or_quit (error_symbol=3D0x56d0, data=3D0x5= 55555d60e53, keyboard_quit=3Dfalse) at eval.c:1663 #24 0x000055555579f199 in Fsignal (error_symbol=3D0x56d0, data=3D0x555555d6= 0e53) at eval.c:1565 #25 0x00005555556e397e in xsignal (error_symbol=3D0x56d0, data=3D0x555555d6= 0e53) at lisp.h:4083 #26 0x000055555579f684 in xsignal1 (error_symbol=3D0x56d0, arg=3D0x55555657= f574) at eval.c:1704 #27 0x000055555579fc3d in verror (m=3D0x555555871dd9 "Font `%s' is not defi= ned", ap=3D0x7fffffffc0f0) at eval.c:1884 #28 0x000055555579fcee in error (m=3D0x555555871dd9 "Font `%s' is not defin= ed") at eval.c:1896 #29 0x00005555555abad2 in gui_set_font (f=3D0x555555ff5570, arg=3D0x555555f= f6854, oldval=3D0x0) at frame.c:4390 #30 0x00005555555ac0a5 in gui_set_font_backend (f=3D0x555555ff5570, new_val= ue=3D0x555555d61033, old_value=3D0x555556051983) at frame.c:4524 #31 0x00005555555aa497 in gui_set_frame_parameters (f=3D0x555555ff5570, ali= st=3D0x0) at frame.c:4044 #32 0x00005555555a8a25 in Fmodify_frame_parameters (frame=3D0x555555ff5575,= alist=3D0x555555d61043) at frame.c:3271 #33 0x00005555557a296c in funcall_subr (subr=3D0x555555c0dde0 , numargs=3D2, args=3D0x7fffffffc588) at eval.c:2878 #34 0x00005555557a2509 in Ffuncall (nargs=3D3, args=3D0x7fffffffc580) at ev= al.c:2803 #35 0x00005555557ee00a in exec_byte_code (bytestr=3D0x7ffff0f570c4, vector= =3D0x7ffff0f57065, maxdepth=3D0x1e, args_template=3D0xc0e, nargs=3D3, args= =3D0x7fffffffc988) at bytecode.c:633 #36 0x00005555557a2fb3 in funcall_lambda (fun=3D0x7ffff0f57035, nargs=3D3, = arg_vector=3D0x7fffffffc970) at eval.c:2998 #37 0x00005555557a2d17 in apply_lambda (fun=3D0x7ffff0f57035, args=3D0x5555= 55d61153, count=3D15) at eval.c:2935 #38 0x00005555557a1088 in eval_sub (form=3D0x555555d61173) at eval.c:2319 #39 0x000055555579ce96 in Fprogn (body=3D0x0) at eval.c:463 #40 0x00005555557a0ab5 in eval_sub (form=3D0x555555d610c3) at eval.c:2227 #41 0x00005555557a04cc in Feval (form=3D0x555555d610c3, lexical=3D0xc8d0) a= t eval.c:2103 #42 0x00005555557a296c in funcall_subr (subr=3D0x555555c1b520 , numa= rgs=3D2, args=3D0x7fffffffce20) at eval.c:2878 #43 0x00005555557a2509 in Ffuncall (nargs=3D3, args=3D0x7fffffffce18) at ev= al.c:2803 #44 0x00005555557ee00a in exec_byte_code (bytestr=3D0x7ffff11034dc, vector= =3D0x7ffff1102c3d, maxdepth=3D0x42, args_template=3D0x406, nargs=3D1, args= =3D0x7fffffffd2b0) at bytecode.c:633 #45 0x00005555557a2fb3 in funcall_lambda (fun=3D0x7ffff1102c0d, nargs=3D1, = arg_vector=3D0x7fffffffd2a8) at eval.c:2998 #46 0x00005555557a254d in Ffuncall (nargs=3D2, args=3D0x7fffffffd2a0) at ev= al.c:2805 #47 0x00005555557ee00a in exec_byte_code (bytestr=3D0x7ffff110362c, vector= =3D0x7ffff1102bb5, maxdepth=3D0x12, args_template=3D0x406, nargs=3D1, args= =3D0x7fffffffd858) at bytecode.c:633 #48 0x00005555557a2fb3 in funcall_lambda (fun=3D0x7ffff1102b7d, nargs=3D1, = arg_vector=3D0x7fffffffd850) at eval.c:2998 #49 0x00005555557a254d in Ffuncall (nargs=3D2, args=3D0x7fffffffd848) at ev= al.c:2805 #50 0x0000555555799d44 in Ffuncall_interactively (nargs=3D2, args=3D0x7ffff= fffd848) at callint.c:253 #51 0x00005555557a284d in funcall_subr (subr=3D0x555555c1ad60 , numargs=3D2, args=3D0x7fffffffd848) at eval.c:2856 #52 0x00005555557a2509 in Ffuncall (nargs=3D3, args=3D0x7fffffffd840) at ev= al.c:2803 #53 0x000055555579c24d in Fcall_interactively (function=3D0x2aaa9b471a08, r= ecord_flag=3D0x0, keys=3D0x7ffff14c94bd) at callint.c:781 #54 0x00005555557a299e in funcall_subr (subr=3D0x555555c1ada0 , numargs=3D3, args=3D0x7fffffffdbe0) at eval.c:2881 #55 0x00005555557a2509 in Ffuncall (nargs=3D4, args=3D0x7fffffffdbd8) at ev= al.c:2803 #56 0x00005555557ee00a in exec_byte_code (bytestr=3D0x7ffff105bd84, vector= =3D0x7ffff105b915, maxdepth=3D0x36, args_template=3D0x1006, nargs=3D1, args= =3D0x7fffffffe0f0) at bytecode.c:633 #57 0x00005555557a2fb3 in funcall_lambda (fun=3D0x7ffff105b8e5, nargs=3D1, = arg_vector=3D0x7fffffffe0e8) at eval.c:2998 #58 0x00005555557a254d in Ffuncall (nargs=3D2, args=3D0x7fffffffe0e0) at ev= al.c:2805 #59 0x00005555557a1da4 in call1 (fn=3D0x41a0, arg1=3D0x2aaa9b471a08) at eva= l.c:2656 #60 0x00005555556ebd2b in command_loop_1 () at keyboard.c:1461 #61 0x000055555579ec15 in internal_condition_case (bfun=3D0x5555556eb4ff , handlers=3D0x56d0, hfun=3D0x5555556eacb4 ) at ev= al.c:1352