From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "enquiries@vsm.in" Newsgroups: gmane.emacs.bugs Subject: bug#18573: 24.3.93; set-face-attribute crashes Emacs when started with -nw Date: Sun, 28 Sep 2014 14:24:21 +0200 Message-ID: <5427FDF5.6040908@vsm.in> References: <5426E238.6060301@vsm.in> <5CAB16D6-ECC8-4D23-A0E2-FCEADF48C1B0@swipnet.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1411908071 2574 80.91.229.3 (28 Sep 2014 12:41:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 28 Sep 2014 12:41:11 +0000 (UTC) Cc: 18573@debbugs.gnu.org To: Jan =?UTF-8?Q?Dj=C3=A4rv?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Sep 28 14:41:06 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XYDmj-0002ER-1C for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 Sep 2014 14:41:05 +0200 Original-Received: from localhost ([::1]:59652 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYDmi-00041D-Ml for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 Sep 2014 08:41:04 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYDmc-00040y-8P for bug-gnu-emacs@gnu.org; Sun, 28 Sep 2014 08:41:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XYDmX-0003AE-GB for bug-gnu-emacs@gnu.org; Sun, 28 Sep 2014 08:40:58 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34353) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYDmX-00039m-C6 for bug-gnu-emacs@gnu.org; Sun, 28 Sep 2014 08:40:53 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XYDXC-0001bF-4V for bug-gnu-emacs@gnu.org; Sun, 28 Sep 2014 08:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "enquiries@vsm.in" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Sep 2014 12:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18573 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18573-submit@debbugs.gnu.org id=B18573.14119070716105 (code B ref 18573); Sun, 28 Sep 2014 12:25:02 +0000 Original-Received: (at 18573) by debbugs.gnu.org; 28 Sep 2014 12:24:31 +0000 Original-Received: from localhost ([127.0.0.1]:54149 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XYDWg-0001aN-KK for submit@debbugs.gnu.org; Sun, 28 Sep 2014 08:24:31 -0400 Original-Received: from mail.forumcivico.org ([176.58.106.92]:51755) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XYDWb-0001a9-Cz for 18573@debbugs.gnu.org; Sun, 28 Sep 2014 08:24:29 -0400 Original-Received: from dummy.name; Sun, 28 Sep 2014 14:24:24 +0200 In-Reply-To: <5CAB16D6-ECC8-4D23-A0E2-FCEADF48C1B0@swipnet.se> X-TagToolbar-Keys: D20140928142421898 X-Mailer: CommuniGate Pro WebUser v5.4.8 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:93820 Archived-At: On 28/09/2014 10:44, Jan Djärv wrote: > Hello. > > 27 sep 2014 kl. 18:13 skrev enquiries@vsm.in: > >> >> When launched via terminal (cli), Emacs crashes by just having this single line in init.el: >> >> (set-face-attribute 'default nil :font "Menlo-16") >> >> Emacs does /not/ crash when launched from the Finder (same init.el) >> > > This seems to be a generic error in xfaces.c. It tries to load a font without checking the type > of frame. The type is tty, but it tries to load a font anyway, and eventually ends up in (font.c) font_pixel_size, which does: > > #define FRAME_RES_Y(f) \ > (eassert (FRAME_WINDOW_P (f)), FRAME_DISPLAY_INFO (f)->resy) > > Now, FRAME_DISPLAY_INFO for a NS compiled Emacs is > > #define FRAME_DISPLAY_INFO(f) ((f)->output_data.ns->display_info) > > but the frame is not an NS frame, it is a tty frame, so bad things happen. > It is the same for X, but there it just happens to return a nonsense value, so the code continues without crashing, and eventually discovers that there are no font dirvers and the load font fails. > > The code is in xfaces.c, Finternal_set_lisp_face_attribute, around line 3120 where it calls > font_load_for_lface. > > The code in question is not called if compiled for a tty (#ifdef:ed out), but it is called when the frame is a tty frame on a non-tty compiled Emacs. > > I think these cases should be the same, i.e. font_load_for_lface not called for tty frames. > > Jan D. Hi, Thank you, that sounds like the reason, although I am not fluent with C nor gdb to check and confirm it. I can add that Emacs just crashes printing this error: Fatal error 11: Segmentation fault[1] 51512 abort /Applications/Emacs.app/Contents/MacOS/Emacs -nw Also, if that line is wrapped with condition-case err, like this: (condition-case err (set-face-attribute 'default nil :font "Menlo-16") (error (message "Whoops!"))) I experience the same crash with same error message. No additional elisp-originating messages. I have tried with GNU Emacs 24.3.1 (x86_64-apple-darwin, NS apple-appkit-1038.36) of 2013-03-13 on bob.porkrind.org, from emacsformacosx.com, and Emacs does not crash. So, it must be a bug in later versions. I am of course aware that in any case Emacs will inherit whatever font and font size is specified in the terminal app (basically, that line is not meaningful in the cli). Sam