From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Mike Hamrick Newsgroups: gmane.emacs.bugs Subject: bug#38564: 27.0.50; macOS "emacs -nw" git-gutter-mode segfault Date: Tue, 10 Dec 2019 17:33:37 -0800 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="142153"; mail-complaints-to="usenet@blaine.gmane.org" To: 38564@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 11 03:17:18 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.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ierYz-000ara-MI for geb-bug-gnu-emacs@m.gmane.org; Wed, 11 Dec 2019 03:17:17 +0100 Original-Received: from localhost ([::1]:37958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ierYy-0004Dw-AQ for geb-bug-gnu-emacs@m.gmane.org; Tue, 10 Dec 2019 21:17:16 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60562) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ierYp-0004Cy-FT for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2019 21:17:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ierYn-0005mX-Mk for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2019 21:17:07 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50809) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ierYl-0005ja-Bi for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2019 21:17:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ierYk-0000cE-Iv for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2019 21:17:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mike Hamrick Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 11 Dec 2019 02:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 38564 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.15760306212355 (code B ref -1); Wed, 11 Dec 2019 02:17:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Dec 2019 02:17:01 +0000 Original-Received: from localhost ([127.0.0.1]:56781 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ierYi-0000bi-Lw for submit@debbugs.gnu.org; Tue, 10 Dec 2019 21:17:01 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:55286) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ieqtH-0007n1-LI for submit@debbugs.gnu.org; Tue, 10 Dec 2019 20:34:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39632) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ieqtF-0007hz-B4 for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2019 20:34:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ieqtC-0007fE-6a for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2019 20:34:07 -0500 Original-Received: from eidolon.muppetlabs.com ([207.66.255.52]:40450) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ieqtA-0007On-9w for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2019 20:34:05 -0500 Original-Received: from eidolon.muppetlabs.com ([207.66.255.52]) by eidolon.muppetlabs.com with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1ieqsj-0006R9-OP for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2019 17:33:46 -0800 X-Spam_score: -19.8 X-Spam_score_int: -197 X-Spam_bar: ------------------- X-Spam_report: Spam detection software, running on the system "eidolon.muppetlabs.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi there, Here is how I got emacs to segfault and drop be back to the shell: - compile emacs 27.0.50 under macOS - install the git-gutter package - set up an after-init-hook for global-git-gutter-mode - emacs - [...] Content analysis details: (-19.8 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -20 SC_HAM No description available. -0.0 BAYES_20 BODY: Baye X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Mailman-Approved-At: Tue, 10 Dec 2019 21:16:57 -0500 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:173166 Archived-At: Hi there, Here is how I got emacs to segfault and drop be back to the shell: - compile emacs 27.0.50 under macOS - install the git-gutter package - set up an after-init-hook for global-git-gutter-mode - emacs -nw /some/file/under/version/control The relevant part of my init.el looks like: > (use-package git-gutter > :ensure t > :init > (add-hook 'after-init-hook 'global-git-gutter-mode)) I built emacs with debugging symbols, and ran it in the lldb debugger, here is the stack trace: * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x40) frame #0: 0x000000010416ab3e emacs`ns_lookup_indexed_color(idx=18446744073709551613, f=0x00007facab80e210) at nsterm.m:2097:64 2094 NSColor * 2095 ns_lookup_indexed_color (unsigned long idx, struct frame *f) 2096 { -> 2097 struct ns_color_table *color_table = FRAME_DISPLAY_INFO (f)->color_table; 2098 if (idx < 1 || idx >= color_table->avail) 2099 return nil; 2100 return color_table->colors[idx]; Likely cause: f->output_data.tty[29]->display_info->terminal accessed 0x40 (lldb) bt * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x40) * frame #0: 0x000000010416ab3e emacs`ns_lookup_indexed_color(idx=18446744073709551613, f=0x00007facab80e210) at nsterm.m:2097:64 frame #1: 0x000000010416b5fc emacs`ns_color_index_to_rgba(idx=-3, f=0x00007facab80e210) at nsterm.m:2299:9 frame #2: 0x0000000103e88e23 emacs`extend_face_to_end_of_line(it=0x00007ffeebdf5800) at xdisp.c:21833:7 frame #3: 0x0000000103e5783a emacs`display_line(it=0x00007ffeebdf5800, cursor_vpos=3) at xdisp.c:23478:4 frame #4: 0x0000000103e5468b emacs`try_window(window=0x00007facab80e445, pos=(charpos = 1, bytepos = 1), flags=1) at xdisp.c:19005:11 frame #5: 0x0000000103e92e6f emacs`redisplay_window(window=0x00007facab80e445, just_this_one_p=false) at xdisp.c:18426:8 frame #6: 0x0000000103e90f8d emacs`redisplay_window_0(window=0x00007facab80e445) at xdisp.c:16147:5 frame #7: 0x000000010406083a emacs`internal_condition_case_1(bfun=(emacs`redisplay_window_0 at xdisp.c:16145), arg=0x00007facab80e445, handlers=0x00000001060f9d6b, hfun=(emacs`redisplay_window_error at xdisp.c:16138)) at eval.c:1379:25 frame #8: 0x0000000103e8f87b emacs`redisplay_windows(window=0x00007facab80e445) at xdisp.c:16127:4 frame #9: 0x0000000103e4f012 emacs`redisplay_internal at xdisp.c:15595:5 frame #10: 0x0000000103e53110 emacs`redisplay_preserve_echo_area(from_where=2) at xdisp.c:15948:5 frame #11: 0x0000000103e0914a emacs`Fredisplay(force=0x0000000000000000) at dispnew.c:6066:3 frame #12: 0x0000000104068003 emacs`funcall_subr(subr=0x0000000104209680, numargs=0, args=0x00007ffeebdfc398) at eval.c:2867:19 frame #13: 0x0000000104066e24 emacs`Ffuncall(nargs=1, args=0x00007ffeebdfc390) at eval.c:2794:11 frame #14: 0x00000001040d7ef8 emacs`exec_byte_code(bytestr=0x0000000105c2125c, vector=0x0000000105c21015, maxdepth=0x000000000000001e, args_template=0x0000000000000c06, nargs=1, args=0x00007ffeebdfcad0) at bytecode.c:633:12 frame #15: 0x000000010406847c emacs`funcall_lambda(fun=0x0000000105c20fe5, nargs=1, arg_vector=0x00007ffeebdfcac8) at eval.c:2989:11 frame #16: 0x0000000104066e6e emacs`Ffuncall(nargs=2, args=0x00007ffeebdfcac0) at eval.c:2796:11 frame #17: 0x00000001040d7ef8 emacs`exec_byte_code(bytestr=0x0000000105d67b44, vector=0x0000000105d67645, maxdepth=0x000000000000003e, args_template=0x0000000000000c06, nargs=3, args=0x00007ffeebdfd478) at bytecode.c:633:12 frame #18: 0x000000010406847c emacs`funcall_lambda(fun=0x0000000105d664ed, nargs=3, arg_vector=0x00007ffeebdfd460) at eval.c:2989:11 frame #19: 0x0000000104066e6e emacs`Ffuncall(nargs=4, args=0x00007ffeebdfd458) at eval.c:2796:11 frame #20: 0x0000000104055bda emacs`Ffuncall_interactively(nargs=4, args=0x00007ffeebdfd458) at callint.c:254:32 frame #21: 0x0000000104067f2b emacs`funcall_subr(subr=0x0000000104212f20, numargs=4, args=0x00007ffeebdfd458) at eval.c:2847:12 frame #22: 0x0000000104066e24 emacs`Ffuncall(nargs=5, args=0x00007ffeebdfd450) at eval.c:2794:11 frame #23: 0x0000000104066c04 emacs`Fapply(nargs=3, args=0x00007ffeebdfdc70) at eval.c:2424:24 frame #24: 0x000000010405600e emacs`Fcall_interactively(function=0x000000000173af88, record_flag=0x0000000000000000, keys=0x00000001064ffb35) at callint.c:342:36 frame #25: 0x000000010406805e emacs`funcall_subr(subr=0x0000000104212ef0, numargs=3, args=0x00007ffeebdfde40) at eval.c:2872:19 frame #26: 0x0000000104066e24 emacs`Ffuncall(nargs=4, args=0x00007ffeebdfde38) at eval.c:2794:11 frame #27: 0x00000001040d7ef8 emacs`exec_byte_code(bytestr=0x0000000105d1d5fc, vector=0x0000000105d1d09d, maxdepth=0x0000000000000036, args_template=0x0000000000001006, nargs=1, args=0x00007ffeebdfe5a8) at bytecode.c:633:12 frame #28: 0x000000010406847c emacs`funcall_lambda(fun=0x0000000105d1d06d, nargs=1, arg_vector=0x00007ffeebdfe5a0) at eval.c:2989:11 frame #29: 0x0000000104066e6e emacs`Ffuncall(nargs=2, args=0x00007ffeebdfe598) at eval.c:2796:11 frame #30: 0x000000010406794f emacs`call1(fn=0x0000000000003ae0, arg1=0x000000000173af88) at eval.c:2654:10 frame #31: 0x0000000103f643e9 emacs`command_loop_1 at keyboard.c:1458:13 frame #32: 0x000000010406077f emacs`internal_condition_case(bfun=(emacs`command_loop_1 at keyboard.c:1236), handlers=0x0000000000000090, hfun=(emacs`cmd_error at keyboard.c:919)) at eval.c:1355:25 frame #33: 0x0000000103f7bbcc emacs`command_loop_2(ignore=0x0000000000000000) at keyboard.c:1091:11 frame #34: 0x00000001040600ea emacs`internal_catch(tag=0x000000000000c8a0, func=(emacs`command_loop_2 at keyboard.c:1087), arg=0x0000000000000000) at eval.c:1116:25 frame #35: 0x0000000103f62ee8 emacs`command_loop at keyboard.c:1070:2 frame #36: 0x0000000103f62d20 emacs`recursive_edit_1 at keyboard.c:714:9 frame #37: 0x0000000103f630b9 emacs`Frecursive_edit at keyboard.c:786:3 frame #38: 0x0000000103f60531 emacs`main(argc=3, argv=0x00007ffeebdfed58) at emacs.c:2054:3 frame #39: 0x00007fff5cf7e3d5 libdyld.dylib`start + 1 frame #40: 0x00007fff5cf7e3d5 libdyld.dylib`start + 1 I was able to prevent emacs from crashing with this rather naive patch. diff --git a/src/nsterm.m b/src/nsterm.m index c415159890..ea2b141d95 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2094,6 +2094,8 @@ so some key presses (TAB) are swallowed by the system. */ NSColor * ns_lookup_indexed_color (unsigned long idx, struct frame *f) { + if (FRAME_DISPLAY_INFO (f) == nil) + return nil; struct ns_color_table *color_table = FRAME_DISPLAY_INFO (f)->color_table; if (idx < 1 || idx >= color_table->avail) return nil; Here is more information about my setup post patch: In GNU Emacs 27.0.50 (build 2, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G1012)) of 2019-12-10 built on st-mikeh1 Repository revision: ea93326cc046cb1beb7535cdf6d69b216b767685 Repository branch: master System Description: Mac OS X 10.14.6 Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Configured using: 'configure --prefix=/Users/mikeh' Configured features: RSVG GLIB NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS JSON PDUMPER LCMS2 Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Fundamental Minor modes in effect: global-git-gutter-mode: t tooltip-mode: t global-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 auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: 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 mml-sec epa derived epg epg-config gnus-util rmail rmail-loaddefs text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils term/xterm xterm git-gutter advice cl-extra help-mode use-package-ensure use-package-core finder-inf info package easymenu browse-url url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib 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 lcms2 multi-tty make-network-process emacs) Memory information: ((conses 16 80357 7586) (symbols 48 9267 1) (strings 32 27500 1423) (string-bytes 1 893518) (vectors 16 12896) (vector-slots 8 135599 5856) (floats 8 39 323) (intervals 56 179 0) (buffers 1000 12))