all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "enquiries@vsm.in" <enquiries@vsm.in>
To: "Jan Djärv" <jan.h.d@swipnet.se>
Cc: 18573@debbugs.gnu.org
Subject: bug#18573: 24.3.93; set-face-attribute crashes Emacs when started with -nw
Date: Sun, 28 Sep 2014 14:24:21 +0200	[thread overview]
Message-ID: <5427FDF5.6040908@vsm.in> (raw)
In-Reply-To: <5CAB16D6-ECC8-4D23-A0E2-FCEADF48C1B0@swipnet.se>

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






  reply	other threads:[~2014-09-28 12:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-27 16:13 bug#18573: 24.3.93; set-face-attribute crashes Emacs on OS X 10.9.4 enquiries
2014-09-28  8:44 ` bug#18573: 24.3.93; set-face-attribute crashes Emacs when started with -nw Jan Djärv
2014-09-28 12:24   ` enquiries [this message]
2014-10-01 16:49     ` Glenn Morris
2014-10-01 17:55       ` Stefan Monnier
2014-09-29 17:18   ` Eli Zaretskii
2014-09-29 17:34     ` enquiries
2014-10-01 17:43     ` Jan Djärv
2014-10-01 17:49       ` Eli Zaretskii
2014-10-01 18:11         ` Jan Djärv
2014-10-01 18:16           ` Eli Zaretskii
2019-09-26 20:57 ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5427FDF5.6040908@vsm.in \
    --to=enquiries@vsm.in \
    --cc=18573@debbugs.gnu.org \
    --cc=jan.h.d@swipnet.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.