unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* weird segfault crash
@ 2021-09-01 14:07 Perry E. Metzger
  2021-09-01 14:30 ` Ben Mezger
  2021-09-01 16:30 ` Eli Zaretskii
  0 siblings, 2 replies; 5+ messages in thread
From: Perry E. Metzger @ 2021-09-01 14:07 UTC (permalink / raw)
  To: emacs-devel

Howdy! While playing with my current project I discovered the following 
crash.

Enter this into *scratch* and eval it, then hit F19. At least on master 
under MacOS, emacs will crash with a segmentation fault.

(setq foo '(hi))

(define-key key-translation-map (kbd "<f19>")
   (lambda (n)
     (interactive "p")
     (setq foo (append foo '(there)))))

Note that if you replace the last form with (setq foo nil), the crash 
does not happen.

I'm kind of mystified by this, and not sure how to debug it.


Perry




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: weird segfault crash
  2021-09-01 14:07 weird segfault crash Perry E. Metzger
@ 2021-09-01 14:30 ` Ben Mezger
  2021-09-01 14:42   ` Perry E. Metzger
  2021-09-01 16:30 ` Eli Zaretskii
  1 sibling, 1 reply; 5+ messages in thread
From: Ben Mezger @ 2021-09-01 14:30 UTC (permalink / raw)
  To: Perry E. Metzger; +Cc: emacs-devel


Are you able to run with lldb --file /path/to/emacs/bin and see the
traceback with bt? I am unable to test this out atm.


"Perry E. Metzger" <perry@piermont.com> writes:

> Howdy! While playing with my current project I discovered the following crash.
>
> Enter this into *scratch* and eval it, then hit F19. At least on master under
> MacOS, emacs will crash with a segmentation fault.
>
> (setq foo '(hi))
>
> (define-key key-translation-map (kbd "<f19>")
>   (lambda (n)
>     (interactive "p")
>     (setq foo (append foo '(there)))))
>
> Note that if you replace the last form with (setq foo nil), the crash does not
> happen.
>
> I'm kind of mystified by this, and not sure how to debug it.
>
>
> Perry


--
Kind regards,
Met een vriendelijke groet,
Atenciosamente,

Ben Mezger

https://seds.nl
https://github.com/benmezger



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: weird segfault crash
  2021-09-01 14:30 ` Ben Mezger
@ 2021-09-01 14:42   ` Perry E. Metzger
  0 siblings, 0 replies; 5+ messages in thread
From: Perry E. Metzger @ 2021-09-01 14:42 UTC (permalink / raw)
  To: Ben Mezger; +Cc: emacs-devel


On 9/1/21 10:30, Ben Mezger wrote:
> Are you able to run with lldb --file /path/to/emacs/bin and see the
> traceback with bt? I am unable to test this out atm.

Running under LLDB gives me:

Process 85909 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = 
EXC_BAD_ACCESS (code=1, address=0x2488cc8fb)
     frame #0: 0x0000000100227a2b Emacs`keyremap_step.cold.2 at 
keyboard.c:2208:29 [opt]
    2205        }
    2206
    2207      /* Terminate Emacs in batch mode if at eof.  */
-> 2208      if (noninteractive && FIXNUMP (c) && XFIXNUM (c) < 0)
    2209        Fkill_emacs (make_fixnum (1));
    2210
    2211      if (FIXNUMP (c))
Target 1: (Emacs) stopped.

Doing a backtrace gives me:

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = 
EXC_BAD_ACCESS (code=1, address=0x2488cc8fb)
   * frame #0: 0x0000000100227a2b Emacs`keyremap_step.cold.2 at 
keyboard.c:2208:29 [opt]
     frame #1: 0x00000001000db18a Emacs`keyremap_step [inlined] 
SYMBOL_NAME at lisp.h:0 [opt]
     frame #2: 0x00000001000db182 Emacs`keyremap_step at keyboard.c:9193 
[opt]
     frame #3: 0x00000001000db08c 
Emacs`keyremap_step(keybuf=0x00007ffeefbff190, fkey=0x00007ffeefbff038, 
input=1, doit=true, diff=0x00007ffeefbff0b8, prompt=0x0000000000000000) 
at keyboard.c:9218 [opt]
     frame #4: 0x00000001000cad9f 
Emacs`read_key_sequence(keybuf=<unavailable>, prompt=0x0000000000000000, 
dont_downcase_last=false, can_return_switch_frame=true, 
fix_current_buffer=true, prevent_redisplay=<unavailable>) at 
keyboard.c:10103:11 [opt]
     frame #5: 0x00000001000c871c Emacs`command_loop_1 at 
keyboard.c:1376:15 [opt]
     frame #6: 0x00000001001521af 
Emacs`internal_condition_case(bfun=(Emacs`command_loop_1 at 
keyboard.c:1262), handlers=0x0000000000000090, hfun=(Emacs`cmd_error at 
keyboard.c:925)) at eval.c:1478:25 [opt]
     frame #7: 0x00000001000c81fe 
Emacs`command_loop_2(handlers=0x0000000000000090) at keyboard.c:1117:11 
[opt]
     frame #8: 0x000000010015173e 
Emacs`internal_catch(tag=0x000000000000d9e0, func=(Emacs`command_loop_2 
at keyboard.c:1113), arg=0x0000000000000090) at eval.c:1198:25 [opt]
     frame #9: 0x00000001002277c8 Emacs`recursive_edit_1.cold.1 at 
keyboard.c:1095:2 [opt]
     frame #10: 0x00000001000c7a9c Emacs`recursive_edit_1 [inlined] 
command_loop at keyboard.c:1092:5 [opt]
     frame #11: 0x00000001000c7a97 Emacs`recursive_edit_1 at 
keyboard.c:720 [opt]
     frame #12: 0x00000001000c7c2b Emacs`Frecursive_edit at 
keyboard.c:792:3 [opt]
     frame #13: 0x00000001000c6c5e Emacs`main(argc=<unavailable>, 
argv=0x00007ffeefbff5a0) at emacs.c:2310:3 [opt]
     frame #14: 0x00007fff20548f3d libdyld.dylib`start + 1
(lldb)

Perry





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: weird segfault crash
  2021-09-01 14:07 weird segfault crash Perry E. Metzger
  2021-09-01 14:30 ` Ben Mezger
@ 2021-09-01 16:30 ` Eli Zaretskii
  2021-09-01 19:34   ` Perry E. Metzger
  1 sibling, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2021-09-01 16:30 UTC (permalink / raw)
  To: Perry E. Metzger; +Cc: emacs-devel

> Date: Wed, 1 Sep 2021 10:07:58 -0400
> From: "Perry E. Metzger" <perry@piermont.com>
> 
> Enter this into *scratch* and eval it, then hit F19. At least on master 
> under MacOS, emacs will crash with a segmentation fault.
> 
> (setq foo '(hi))
> 
> (define-key key-translation-map (kbd "<f19>")
>    (lambda (n)
>      (interactive "p")
>      (setq foo (append foo '(there)))))
> 
> Note that if you replace the last form with (setq foo nil), the crash 
> does not happen.
> 
> I'm kind of mystified by this, and not sure how to debug it.

We were trying to print a cons cell as if it were a symbol.

Should be fixed now.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: weird segfault crash
  2021-09-01 16:30 ` Eli Zaretskii
@ 2021-09-01 19:34   ` Perry E. Metzger
  0 siblings, 0 replies; 5+ messages in thread
From: Perry E. Metzger @ 2021-09-01 19:34 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

On 9/1/21 12:30, Eli Zaretskii wrote:
> We were trying to print a cons cell as if it were a symbol.
> Should be fixed now.
>
Thank you so much!

Perry





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-01 19:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-01 14:07 weird segfault crash Perry E. Metzger
2021-09-01 14:30 ` Ben Mezger
2021-09-01 14:42   ` Perry E. Metzger
2021-09-01 16:30 ` Eli Zaretskii
2021-09-01 19:34   ` Perry E. Metzger

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).