From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: switching font backends in .emacs.desktop causes crash Date: Fri, 08 Feb 2019 13:09:22 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="227497"; mail-complaints-to="usenet@blaine.gmane.org" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 08 13:10:12 2019 Return-path: Envelope-to: ged-emacs-devel@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 1gs4yx-000x3C-Qm for ged-emacs-devel@m.gmane.org; Fri, 08 Feb 2019 13:10:12 +0100 Original-Received: from localhost ([127.0.0.1]:55470 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gs4yw-00027Y-L9 for ged-emacs-devel@m.gmane.org; Fri, 08 Feb 2019 07:10:10 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:43801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gs4yG-00025w-2q for emacs-devel@gnu.org; Fri, 08 Feb 2019 07:09:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gs4yF-0004Z9-6y for emacs-devel@gnu.org; Fri, 08 Feb 2019 07:09:28 -0500 Original-Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:43812) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gs4yE-0004Xp-Qf for emacs-devel@gnu.org; Fri, 08 Feb 2019 07:09:27 -0500 Original-Received: by mail-wr1-x436.google.com with SMTP id r2so3268527wrv.10 for ; Fri, 08 Feb 2019 04:09:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:mail-followup-to:mail-copies-to:gmane-reply-to-list :date:message-id:mime-version; bh=idtwwHNe8vJSWo3EDVhZcBJh5KvadfSMvZmocOwjLvU=; b=IZJ641LrogJ4Mcqi1T7AnuuQm/h0/u3zmT5gd6WezIKJgU4/KCOzNhIn1KWpudsHQs 4N31doQCn9waTtBLxcPzh/52Pbvd4vEjYV/XJbwNux5JPJkyfygAqaAN58Z/R9P5qbPO 14JUHWn6txUaInNW9OzbXEQ8J0/DYyhokoCXmm+Hh+ASFSrBM3lGNMzBW2Rii9n86GuO ydn7Uiu6xp8tHsASUbrO85nygR0KmafUaYHGxN/G3JE4Dhr6vbQeJibIauL8sKMnQtoa cJhuVKUgf8PTCGWh9VNLs3WvkiGpbip0+8eREm3j6TE0Pa1slbu+kxowmzs2c+2ToijP 1Akw== 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:mail-followup-to:mail-copies-to :gmane-reply-to-list:date:message-id:mime-version; bh=idtwwHNe8vJSWo3EDVhZcBJh5KvadfSMvZmocOwjLvU=; b=lNzLm49AioipwsP7fI/XfeCr4QD5ndihpPZVwSD0G9xWs39fDx1pHFCJqEizq2VJTV rIiE6Hgss0mx6/jympCGc3IIQZiulbZ+wwpII4nBIV+cq7GiZUYLgHk1rQ84Ec2c/ct+ nu3A1jiDXLqd5mIwhOJfPBZmmyFdQNWNxGVU/7pOEvBDxS0CGjw1iIFt0NK/zb5mp8Nf 8YVY2ypgopB3+++rFEghmXbVcNeAmOTgE3vLRwLVH+7BTBM8BtaeIQJvwkU4Nd09iPAP e8sMBYWus6Li/sepdXpAHDbZ10yYQmqSt2S4A+i7QvkvmS2nzoNj2wwjDMZ0LRy+D/Aa eRqw== X-Gm-Message-State: AHQUAuYBUw5q5BRQBn1vNS4et8NIO4y9priDO172EVCaQPlGEe0aZSa8 n4heshg8u/eVfwlBE2/VlqDuKwDHScA= X-Google-Smtp-Source: AHgI3IbyZxh2141sCFeyXCi2jYiZZDYcSYduUjKNjIx4wJhyHBhpRXmRJtF88nsfSKujIR2Sfq7Utg== X-Received: by 2002:a5d:4ecd:: with SMTP id s13mr8309615wrv.110.1549627764934; Fri, 08 Feb 2019 04:09:24 -0800 (PST) Original-Received: from rpluim-mac ([2a01:e34:ecfc:a860:508e:f5c1:5162:8e85]) by smtp.gmail.com with ESMTPSA id b15sm1376795wrm.47.2019.02.08.04.09.23 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 08 Feb 2019 04:09:23 -0800 (PST) Mail-Followup-To: emacs-devel@gnu.org Mail-Copies-To: never Gmane-Reply-To-List: yes X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::436 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:233117 Archived-At: Playing around with the various X font backend build options resulted in me having a .emacs.desktop like so: ;; -*- mode: emacs-lisp; lexical-binding:t; coding: utf-8-emacs; -*- ;; -------------------------------------------------------------------------- ;; Desktop File for Emacs ;; -------------------------------------------------------------------------- ;; Created Fri Feb 8 09:02:42 2019 ;; Desktop file format version 208 ;; Emacs version 27.0.50 ;; Global section: (setq desktop-saved-frameset [frameset 1 (23645 14242 497425 32000) (desktop . "208") "rpluim@rpluim-ubuntu" nil nil ((((minibuffer . t) (undecorated) (override-redirect) (font-backend x))))]) and .emacs: (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(desktop-save-mode t) ) I rebuilt with the XFT and X backends (default configuration), and got: $ ./emacs Fatal error 11: Segmentation fault Backtrace: ./emacs(+0x1338ce)[0x5568bfc208ce] ./emacs(+0x119e4a)[0x5568bfc06e4a] ./emacs(+0x131c9e)[0x5568bfc1ec9e] ./emacs(+0x131f48)[0x5568bfc1ef48] ./emacs(+0x131fcc)[0x5568bfc1efcc] /lib/x86_64-linux-gnu/libpthread.so.0(+0x12890)[0x7ff5f243f890] /usr/lib/x86_64-linux-gnu/libXft.so.2(XftCharIndex+0xd)[0x7ff5f5c5568d] Poking around with gdb, I see that the xftfont field of xftfont_info is NULL, so I set a watchpoint: $ gdb emacs (gdb) l xftfont.c:320 315 ASET (font_object, FONT_FILE_INDEX, filename); 316 font = XFONT_OBJECT (font_object); 317 font->pixel_size = size; 318 font->driver = &xftfont_driver; 319 font->encoding_charset = font->repertory_charset = -1; 320 321 xftfont_info = (struct font_info *) font; 322 xftfont_info->display = display; 323 xftfont_info->xftfont = xftfont; 324 xftfont_info->x_display_id = FRAME_DISPLAY_INFO (f)->x_id; (gdb) b 324 Breakpoint 3 at 0x204b47: file xftfont.c, line 324. (gdb) r Starting program: /home/rpluim/repos/emacs-real-master/src/emacs [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7fffe4a29700 (LWP 12037)] [New Thread 0x7fffdf41b700 (LWP 12039)] [New Thread 0x7fffdea0d700 (LWP 12040)] Thread 1 "emacs" hit Breakpoint 3, xftfont_open (f=0x55555646b2a0, entity=XIL(0x5555560a6975), pixel_size=27) at xftfont.c:324 324 xftfont_info->x_display_id = FRAME_DISPLAY_INFO (f)->x_id; (gdb) watch -l xftfont_info->xftfont Hardware watchpoint 4: -location xftfont_info->xftfont (gdb) d 3 (gdb) c Continuing. Thread 1 "emacs" hit Hardware watchpoint 4: -location xftfont_info->xftfont Old value = (XftFont *) 0x5555564738e0 New value = (XftFont *) 0x0 xftfont_close (font=0x5555560a6a60) at xftfont.c:464 464 } (gdb) bt #0 0x000055555575914e in xftfont_close (font=0x5555560a6a60) at xftfont.c:464 #1 0x00005555556fd454 in font_clear_cache (cache=XIL(0x555555e4c8b3), driver=driver@entry=0x5555559e11e0 , f=0x55555646b2a0) at font.c:2643 #2 0x0000555555702e35 in font_finish_cache (driver=0x5555559e11e0 , f=0x55555646b2a0) at font.c:2588 #3 0x0000555555702e35 in font_update_drivers (f=f@entry=0x55555646b2a0, new_drivers=new_drivers@entry=XIL(0x555558155c13)) at font.c:3545 #4 0x00005555555a2a0f in x_set_font_backend (f=0x55555646b2a0, new_value=, old_value=XIL(0x555555e4c7b3)) at frame.c:4400 #5 0x00005555555a1408 in x_set_frame_parameters (f=f@entry=0x55555646b2a0, alist=alist@entry=XIL(0x55555815b603)) at frame.c:3933 #6 0x00005555555a1e9c in Fmodify_frame_parameters (frame=, alist=XIL(0x55555815b603)) at frame.c:3197 Lisp Backtrace: "modify-frame-parameters" (0xffffb898) "frameset--restore-frame" (0xffffbc90) "frameset-restore" (0xffffc1f0) "desktop-restore-frameset" (0xffffc458) "desktop-read" (0xffffc7e0) 0x563cec70 PVEC_COMPILED "run-hooks" (0xffffcae0) "command-line" (0xffffd388) "normal-top-level" (0xffffd700) So it looks like we're closing the xft font backend, because of the (font-backend x) in the desktop file, and flushing the font cache. Looking at where it crashes exactly: (gdb) c Continuing. Thread 1 "emacs" received signal SIGSEGV, Segmentation fault. 0x00007ffff446468d in XftCharIndex () from /usr/lib/x86_64-linux-gnu/libXft.so.2 (gdb) bt #0 0x00007ffff446468d in XftCharIndex () at /usr/lib/x86_64-linux-gnu/libXft.so.2 #1 0x0000555555758689 in xftfont_encode_char (font=, c=) at xftfont.c:532 #2 0x00005555555d60a9 in get_char_glyph_code (char2b=, font=0x555557b49470, c=) at xdisp.c:25915 #3 0x00005555555d60a9 in x_produce_glyphs (it=0x7fffffff9b00) at xdisp.c:28294 Here we're using xftfont_encode_char, even though we've just closed the XFT font backend and should be using the X one for the minibuffer? Is the 'it' there caching XFT information? I have no idea how to fix this. I can reproduce at will if more gdb info is needed (BTW, emacs-26 has the same issue). Lisp Backtrace: "message" (0xffffc458) "desktop-read" (0xffffc7e0) 0x563cec70 PVEC_COMPILED "run-hooks" (0xffffcae0) "command-line" (0xffffd388) "normal-top-level" (0xffffd700)