* bug#32794: 27.0.50; emacsclient crashes on subsequent invocation when it cannot open a tty file
@ 2018-09-21 15:03 John Shahid
2018-09-21 15:30 ` John Shahid
0 siblings, 1 reply; 4+ messages in thread
From: John Shahid @ 2018-09-21 15:03 UTC (permalink / raw)
To: 32794
This is a follow up to
http://lists.gnu.org/archive/html/emacs-devel/2018-09/msg00831.html.
The crash can be invoked by doing the following:
emacs -q -nw --daemon
sudo chown differentuser:differentgroup $(tty)
emacsclient -t . # error because the tty cannot be opened
emacsclient -t . # SIGSEGV is received and Emacs crashes
#0 __strcmp_sse2_unaligned ()
at ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:31
#1 0x000000000050ca04 in get_named_terminal (name=0x7fffffff2990 "/dev/pts/7")
at terminal.c:255
#2 0x000000000050a808 in init_tty (name=0x7fffffff2990 "/dev/pts/7",
terminal_type=0x7fffffff2970 "screen-256color", must_succeed=false)
at term.c:3958
#3 0x00000000004281c9 in Fmake_terminal_frame (parms=XIL(0x1281253))
at frame.c:1256
#4 0x000000000061863f in funcall_subr (subr=0x93b600 <Smake_terminal_frame>,
numargs=1, args=0x7fffffff2b78) at eval.c:2929
#5 0x000000000061821c in Ffuncall (nargs=2, args=0x7fffffff2b70) at eval.c:2854
#6 0x0000000000664a25 in exec_byte_code (bytestr=XIL(0x9b89c4),
vector=XIL(0x9b89e5), maxdepth=make_number(12), args_template=make_number(256),
nargs=1, args=0x7fffffff3090) at bytecode.c:632
#7 0x0000000000618cb7 in funcall_lambda (fun=XIL(0x9b8995), nargs=1,
arg_vector=0x7fffffff3088) at eval.c:3055
#8 0x0000000000618260 in Ffuncall (nargs=2, args=0x7fffffff3080) at eval.c:2856
#9 0x0000000000664a25 in exec_byte_code (bytestr=XIL(0x15ad434),
vector=XIL(0xd7ddc5), maxdepth=make_number(3), args_template=make_number(257),
nargs=1, args=0x7fffffff36a0) at bytecode.c:632
#10 0x0000000000618cb7 in funcall_lambda (fun=XIL(0x1309245), nargs=1,
arg_vector=0x7fffffff3698) at eval.c:3055
#11 0x0000000000618260 in Ffuncall (nargs=2, args=0x7fffffff3690) at eval.c:2856
#12 0x0000000000617166 in Fapply (nargs=2, args=0x7fffffff3690) at eval.c:2431
#13 0x0000000000618560 in funcall_subr (subr=0xc7c220 <Sapply>, numargs=2,
args=0x7fffffff3690) at eval.c:2909
#14 0x000000000061821c in Ffuncall (nargs=3, args=0x7fffffff3688) at eval.c:2854
#15 0x0000000000664a25 in exec_byte_code (bytestr=XIL(0x122cea4),
vector=XIL(0x13710e5), maxdepth=make_number(15),
args_template=make_number(128), nargs=1, args=0x7fffffff3ba0) at bytecode.c:632
#16 0x0000000000618cb7 in funcall_lambda (fun=XIL(0x1371165), nargs=1,
arg_vector=0x7fffffff3ba0) at eval.c:3055
#17 0x0000000000618260 in Ffuncall (nargs=2, args=0x7fffffff3b98) at eval.c:2856
#18 0x0000000000664a25 in exec_byte_code (bytestr=XIL(0xa47434),
vector=XIL(0xa47455), maxdepth=make_number(13), args_template=make_number(256),
nargs=1, args=0x7fffffff4130) at bytecode.c:632
#19 0x0000000000618cb7 in funcall_lambda (fun=XIL(0xa473f5), nargs=1,
arg_vector=0x7fffffff4128) at eval.c:3055
#20 0x0000000000618260 in Ffuncall (nargs=2, args=0x7fffffff4120) at eval.c:2856
#21 0x0000000000664a25 in exec_byte_code (bytestr=XIL(0x102fef4),
vector=XIL(0x14499e5), maxdepth=make_number(12),
args_template=make_number(771), nargs=3, args=0x7fffffff4648) at bytecode.c:632
#22 0x0000000000618cb7 in funcall_lambda (fun=XIL(0x1449ab5), nargs=3,
arg_vector=0x7fffffff4630) at eval.c:3055
#23 0x0000000000618260 in Ffuncall (nargs=4, args=0x7fffffff4628) at eval.c:2856
#24 0x0000000000664a25 in exec_byte_code (bytestr=XIL(0x1032cc4),
vector=XIL(0x14818e5), maxdepth=make_number(6), args_template=make_number(0),
nargs=0, args=0x7fffffff4b58) at bytecode.c:632
#25 0x0000000000618cb7 in funcall_lambda (fun=XIL(0x1481995), nargs=0,
arg_vector=0x7fffffff4b58) at eval.c:3055
#26 0x0000000000618260 in Ffuncall (nargs=1, args=0x7fffffff4b50) at eval.c:2856
#27 0x0000000000664a25 in exec_byte_code (bytestr=XIL(0x1032db4),
vector=XIL(0x144c945), maxdepth=make_number(14),
args_template=make_number(1799), nargs=7, args=0x7fffffff50f8) at bytecode.c:632
#28 0x0000000000618cb7 in funcall_lambda (fun=XIL(0x144ca85), nargs=7,
arg_vector=0x7fffffff50c0) at eval.c:3055
#29 0x0000000000618260 in Ffuncall (nargs=8, args=0x7fffffff50b8) at eval.c:2856
#30 0x0000000000664a25 in exec_byte_code (bytestr=XIL(0x1032d04),
vector=XIL(0x1481a15), maxdepth=make_number(8), args_template=make_number(0),
nargs=0, args=0x7fffffff5590) at bytecode.c:632
#31 0x0000000000618cb7 in funcall_lambda (fun=XIL(0x1481a85), nargs=0,
arg_vector=0x7fffffff5590) at eval.c:3055
#32 0x0000000000618260 in Ffuncall (nargs=1, args=0x7fffffff5588) at eval.c:2856
#33 0x0000000000664a25 in exec_byte_code (bytestr=XIL(0x10323b4),
vector=XIL(0x144a945), maxdepth=make_number(6), args_template=make_number(257),
nargs=1, args=0x7fffffff5ac0) at bytecode.c:632
#34 0x0000000000618cb7 in funcall_lambda (fun=XIL(0x144a975), nargs=1,
arg_vector=0x7fffffff5ab8) at eval.c:3055
#35 0x0000000000618260 in Ffuncall (nargs=2, args=0x7fffffff5ab0) at eval.c:2856
#36 0x0000000000664a25 in exec_byte_code (bytestr=XIL(0x10323d4),
vector=XIL(0x144ba05), maxdepth=make_number(35),
args_template=make_number(514), nargs=2, args=0x7fffffff6328) at bytecode.c:632
#37 0x0000000000618cb7 in funcall_lambda (fun=XIL(0x144bcb5), nargs=2,
arg_vector=0x7fffffff6318) at eval.c:3055
#38 0x0000000000618260 in Ffuncall (nargs=3, args=0x7fffffff6310) at eval.c:2856
#39 0x0000000000617494 in Fapply (nargs=2, args=0x7fffffff63d0) at eval.c:2474
#40 0x0000000000617a46 in apply1 (fn=XIL(0x33ef00), arg=XIL(0x15c8903))
at eval.c:2690
#41 0x00000000006755b5 in read_process_output_call (fun_and_args=XIL(0x15c88f3))
at process.c:5807
#42 0x0000000000614990 in internal_condition_case_1 (
bfun=0x675587 <read_process_output_call>, arg=XIL(0x15c88f3),
handlers=XIL(0x5340), hfun=0x6755b7 <read_process_output_error_handler>)
at eval.c:1395
#43 0x0000000000675e56 in read_and_dispose_of_process_output (p=0x1481700,
chars=0x7fffffff6520 "id/Downloads/scala-2.8.1.final -env SDK=/home/jvshahid/Android/Sdk/ -env SHELL=/bin/zsh -env SHLVL=2 -env SSH_AUTH_SOCK=/home/jvshahid/.gnupg/S.gpg-agent.ssh -env TERM=screen-256color -env TMUX=/tmp/t"..., nbytes=1522,
coding=0x10342b0) at process.c:6018
#44 0x0000000000675a77 in read_process_output (proc=XIL(0x1481705), channel=9)
at process.c:5929
#45 0x0000000000674e0c in wait_reading_process_output (time_limit=4,
nsecs=333410507, read_kbd=-1, do_display=true, wait_for_cell=XIL(0),
wait_proc=0x0, just_wait_proc=0) at process.c:5626
#46 0x0000000000570b64 in kbd_buffer_get_event (kbp=0x7fffffff7a78,
used_mouse_menu=0x0, end_time=0x7fffffff8050) at keyboard.c:3795
#47 0x000000000056ce0d in read_event_from_main_queue (end_time=0x7fffffff8050,
local_getcjmp=0x7fffffff7e30, used_mouse_menu=0x0) at keyboard.c:2122
#48 0x000000000056d0ca in read_decoded_event_from_main_queue (
end_time=0x7fffffff8050, local_getcjmp=0x7fffffff7e30, prev_event=XIL(0),
used_mouse_menu=0x0) at keyboard.c:2185
#49 0x000000000056e808 in read_char (commandflag=0, map=XIL(0), prev_event=XIL(0),
used_mouse_menu=0x0, end_time=0x7fffffff8050) at keyboard.c:2773
#50 0x0000000000646171 in read_filtered_event (no_switch_frame=false,
ascii_required=false, error_nonascii=false, input_method=true,
seconds=make_number(5)) at lread.c:678
#51 0x00000000006464ad in Fread_event (prompt=XIL(0),
inherit_input_method=XIL(0xc150), seconds=make_number(5)) at lread.c:794
#52 0x000000000061869b in funcall_subr (subr=0xc7ec00 <Sread_event>, numargs=3,
args=0x7fffffff8208) at eval.c:2934
#53 0x000000000061821c in Ffuncall (nargs=4, args=0x7fffffff8200) at eval.c:2854
#54 0x0000000000664a25 in exec_byte_code (bytestr=XIL(0x965774),
vector=XIL(0x965795), maxdepth=make_number(7), args_template=make_number(769),
nargs=1, args=0x7fffffff86e8) at bytecode.c:632
#55 0x0000000000618cb7 in funcall_lambda (fun=XIL(0x965745), nargs=1,
arg_vector=0x7fffffff86e0) at eval.c:3055
#56 0x0000000000618260 in Ffuncall (nargs=2, args=0x7fffffff86d8) at eval.c:2856
#57 0x0000000000664a25 in exec_byte_code (bytestr=XIL(0x1032ef4),
vector=XIL(0x144cab5), maxdepth=make_number(8), args_template=make_number(514),
nargs=2, args=0x7fffffff8bd0) at bytecode.c:632
#58 0x0000000000618cb7 in funcall_lambda (fun=XIL(0x144cb15), nargs=2,
arg_vector=0x7fffffff8bc0) at eval.c:3055
#59 0x0000000000618260 in Ffuncall (nargs=3, args=0x7fffffff8bb8) at eval.c:2856
#60 0x0000000000664a25 in exec_byte_code (bytestr=XIL(0x1032db4),
vector=XIL(0x144c945), maxdepth=make_number(14),
args_template=make_number(1799), nargs=7, args=0x7fffffff9168) at bytecode.c:632
#61 0x0000000000618cb7 in funcall_lambda (fun=XIL(0x144ca85), nargs=7,
arg_vector=0x7fffffff9130) at eval.c:3055
#62 0x0000000000618260 in Ffuncall (nargs=8, args=0x7fffffff9128) at eval.c:2856
#63 0x0000000000664a25 in exec_byte_code (bytestr=XIL(0x1032d04),
vector=XIL(0x1313f35), maxdepth=make_number(8), args_template=make_number(0),
nargs=0, args=0x7fffffff9600) at bytecode.c:632
#64 0x0000000000618cb7 in funcall_lambda (fun=XIL(0x132c115), nargs=0,
arg_vector=0x7fffffff9600) at eval.c:3055
#65 0x0000000000618260 in Ffuncall (nargs=1, args=0x7fffffff95f8) at eval.c:2856
#66 0x0000000000664a25 in exec_byte_code (bytestr=XIL(0x10323b4),
vector=XIL(0x144a945), maxdepth=make_number(6), args_template=make_number(257),
nargs=1, args=0x7fffffff9b30) at bytecode.c:632
#67 0x0000000000618cb7 in funcall_lambda (fun=XIL(0x144a975), nargs=1,
arg_vector=0x7fffffff9b28) at eval.c:3055
#68 0x0000000000618260 in Ffuncall (nargs=2, args=0x7fffffff9b20) at eval.c:2856
#69 0x0000000000664a25 in exec_byte_code (bytestr=XIL(0x10323d4),
vector=XIL(0x144ba05), maxdepth=make_number(35),
args_template=make_number(514), nargs=2, args=0x7fffffffa398) at bytecode.c:632
#70 0x0000000000618cb7 in funcall_lambda (fun=XIL(0x144bcb5), nargs=2,
arg_vector=0x7fffffffa388) at eval.c:3055
#71 0x0000000000618260 in Ffuncall (nargs=3, args=0x7fffffffa380) at eval.c:2856
#72 0x0000000000617494 in Fapply (nargs=2, args=0x7fffffffa440) at eval.c:2474
#73 0x0000000000617a46 in apply1 (fn=XIL(0x33ef00), arg=XIL(0x1228df3))
at eval.c:2690
#74 0x00000000006755b5 in read_process_output_call (fun_and_args=XIL(0x1228da3))
at process.c:5807
#75 0x0000000000614990 in internal_condition_case_1 (
bfun=0x675587 <read_process_output_call>, arg=XIL(0x1228da3),
handlers=XIL(0x5340), hfun=0x6755b7 <read_process_output_error_handler>)
at eval.c:1395
#76 0x0000000000675e56 in read_and_dispose_of_process_output (p=0x14385e0,
chars=0x7fffffffa590 "id/Downloads/scala-2.8.1.final -env SDK=/home/jvshahid/Android/Sdk/ -env SHELL=/bin/zsh -env SHLVL=2 -env SSH_AUTH_SOCK=/home/jvshahid/.gnupg/S.gpg-agent.ssh -env TERM=screen-256color -env TMUX=/tmp/t"..., nbytes=1522,
coding=0x10342b0) at process.c:6018
#77 0x0000000000675a77 in read_process_output (proc=XIL(0x14385e5), channel=9)
at process.c:5929
#78 0x0000000000674e0c in wait_reading_process_output (time_limit=0, nsecs=0,
read_kbd=-1, do_display=true, wait_for_cell=XIL(0), wait_proc=0x0,
just_wait_proc=0) at process.c:5626
#79 0x0000000000570d03 in kbd_buffer_get_event (kbp=0x7fffffffbae8,
used_mouse_menu=0x7fffffffc095, end_time=0x0) at keyboard.c:3816
#80 0x000000000056ce0d in read_event_from_main_queue (end_time=0x0,
local_getcjmp=0x7fffffffbea0, used_mouse_menu=0x7fffffffc095) at keyboard.c:2122
#81 0x000000000056d0ca in read_decoded_event_from_main_queue (end_time=0x0,
local_getcjmp=0x7fffffffbea0, prev_event=XIL(0), used_mouse_menu=0x7fffffffc095)
at keyboard.c:2185
#82 0x000000000056e808 in read_char (commandflag=1, map=XIL(0x122bc83),
prev_event=XIL(0), used_mouse_menu=0x7fffffffc095, end_time=0x0)
at keyboard.c:2773
#83 0x000000000057b7cc in read_key_sequence (keybuf=0x7fffffffc2a0, prompt=XIL(0),
dont_downcase_last=false, can_return_switch_frame=true,
fix_current_buffer=true, prevent_redisplay=false) at keyboard.c:9121
#84 0x000000000056ad97 in command_loop_1 () at keyboard.c:1338
#85 0x00000000006148e9 in internal_condition_case (bfun=0x56a947 <command_loop_1>,
handlers=XIL(0x5340), hfun=0x56a0f4 <cmd_error>) at eval.c:1371
#86 0x000000000056a63a in command_loop_2 (ignore=XIL(0)) at keyboard.c:1079
#87 0x000000000061416f in internal_catch (tag=XIL(0xc7e0),
func=0x56a611 <command_loop_2>, arg=XIL(0)) at eval.c:1136
#88 0x000000000056a5dc in command_loop () at keyboard.c:1058
#89 0x0000000000569cc9 in recursive_edit_1 () at keyboard.c:703
#90 0x0000000000569e4b in Frecursive_edit () at keyboard.c:774
#91 0x0000000000567a49 in main (argc=4, argv=0x7fffffffc708) at emacs.c:1724
Lisp Backtrace:
"make-terminal-frame" (0xffff2b78)
"tty-create-frame-with-faces" (0xffff3088)
0x1309240 PVEC_COMPILED
"apply" (0xffff3690)
"frame-creation-function" (0xffff3ba0)
"make-frame" (0xffff4128)
"server-create-tty-frame" (0xffff4630)
0x1481990 PVEC_COMPILED
"server-execute" (0xffff50c0)
0x1481a80 PVEC_COMPILED
"server-execute-continuation" (0xffff5ab8)
"server-process-filter" (0xffff6318)
"read-event" (0xffff8208)
"sit-for" (0xffff86e0)
"server-return-error" (0xffff8bc0)
"server-execute" (0xffff9130)
0x132c110 PVEC_COMPILED
"server-execute-continuation" (0xffff9b28)
"server-process-filter" (0xffffa388)
In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
of 2018-09-15 built on amun
Repository revision: f1ddaf7b65bb8edac41813b48f96a84c7fc2e263
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description: Linux Mint 18.3
Configured using:
'configure --prefix=/home/jvshahid/bin/emacs-27 --with-xpm=no
--with-jpeg=no --with-gif=no --with-tiff=no'
Configured features:
PNG SOUND DBUS GSETTINGS GLIB NOTIFY ACL LIBSELINUX GNUTLS LIBXML2
FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS GMP
Important settings:
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=none
locale-coding-system: utf-8-unix
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#32794: 27.0.50; emacsclient crashes on subsequent invocation when it cannot open a tty file
2018-09-21 15:03 bug#32794: 27.0.50; emacsclient crashes on subsequent invocation when it cannot open a tty file John Shahid
@ 2018-09-21 15:30 ` John Shahid
2018-09-29 6:34 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: John Shahid @ 2018-09-21 15:30 UTC (permalink / raw)
To: 32794
[-- Attachment #1: Type: text/plain, Size: 41 bytes --]
Attached a patch that fixes the issue.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Cleanup-the-terminal-if-emacs_open-fails.-Bug-32794.patch --]
[-- Type: text/x-diff, Size: 2416 bytes --]
From 221bbe45fc7e98cdef5b95394be96bd73f667709 Mon Sep 17 00:00:00 2001
From: John Shahid <jvshahid@gmail.com>
Date: Fri, 21 Sep 2018 11:15:10 -0400
Subject: [PATCH] Cleanup the terminal if emacs_open fails. (Bug#32794)
* src/term.c (init_tty): Call delete_terminal_internal if emacs_open
fail.
* src/terminal.c (delete_terminal): Move some code into
delete_terminal_internal and call it.
* src/terminal.c (delete_terminal_internal):
* src/termhooks.h: Introduce 'delete_terminal_internal' to delete
terminals that haven't been fully initialized.
---
src/term.c | 1 +
src/termhooks.h | 1 +
src/terminal.c | 9 ++++++++-
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/term.c b/src/term.c
index ce24f6915f..852dc23bd6 100644
--- a/src/term.c
+++ b/src/term.c
@@ -4008,6 +4008,7 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
char const *diagnostic
= (fd < 0) ? "Could not open file: %s" : "Not a tty device: %s";
emacs_close (fd);
+ delete_terminal_internal (terminal);
maybe_fatal (must_succeed, terminal, diagnostic, diagnostic, name);
}
diff --git a/src/termhooks.h b/src/termhooks.h
index 211429169b..4e34105510 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -733,6 +733,7 @@ extern struct terminal *get_named_terminal (const char *);
extern struct terminal *create_terminal (enum output_method,
struct redisplay_interface *);
extern void delete_terminal (struct terminal *);
+extern void delete_terminal_internal (struct terminal *);
extern Lisp_Object terminal_glyph_code (struct terminal *, int);
/* The initial terminal device, created by initial_term_init. */
diff --git a/src/terminal.c b/src/terminal.c
index 18982fe704..e480359257 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -314,7 +314,6 @@ create_terminal (enum output_method type, struct redisplay_interface *rif)
void
delete_terminal (struct terminal *terminal)
{
- struct terminal **tp;
Lisp_Object tail, frame;
/* Protect against recursive calls. delete_frame calls the
@@ -335,6 +334,14 @@ delete_terminal (struct terminal *terminal)
}
}
+ delete_terminal_internal (terminal);
+}
+
+void
+delete_terminal_internal (struct terminal *terminal)
+{
+ struct terminal **tp;
+
for (tp = &terminal_list; *tp != terminal; tp = &(*tp)->next_terminal)
if (! *tp)
emacs_abort ();
--
2.18.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-09-29 12:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-21 15:03 bug#32794: 27.0.50; emacsclient crashes on subsequent invocation when it cannot open a tty file John Shahid
2018-09-21 15:30 ` John Shahid
2018-09-29 6:34 ` Eli Zaretskii
2018-09-29 12:11 ` John Shahid
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.