Subject: bug#29347: 27.0.50; C-g doesn't quit minibuffer

From: Mike Gerwitz <[email-masked]>
Date: Mon, 20 Nov 2017 13:09:06 -0500

On Fri, Nov 17, 2017 at 22:46:39 -0500, Richard Stallman wrote:
> C-g does not exit the minibuffer.
>
> Moreover, when I keep typing C-g, eventually Emacs gets hung.  I can
> get it unhung by sending it SIGTSTP using another terminal.

Yes, I get this as well on 26.0.90.  I've been meaning to report this
for just over a week, but I hadn't gotten around to it.

I can reproduce it simply with `emacs -Q -nsl -nw' (it must be a TTY;
GUI emacs does not suffer from this bug): quickly press `C-f C-f C-g'.
The message "Command attempted to use minibuffer while in a minibuffer"
will display.  If C-g is pressed while it is still visible, emacs
completely hangs.

In the past it seemed like I could issue SIGSHUP and it would stop
whatever it was doing, but usually it kills emacs.  If it doesn't, then
`C-g' stops working until restart.

> I can't find the command to make gdb send the backtrace to a file.

(gdb) bt
#0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
#1  0x00007f778224c649 in _L_lock_909 () from /lib/x86_64-linux-gnu/libpthread.so.0
#2  0x00007f778224c470 in __GI___pthread_mutex_lock (mutex=0xbd9960 <global_lock>) at ../nptl/pthread_mutex_lock.c:79
#3  0x00000000005c22c5 in sys_mutex_lock (mutex=mutex@entry=0xbd9960 <global_lock>) at systhread.c:106
#4  0x00000000005c1a95 in acquire_global_lock (self=0xbd9988 <main_thread>) at thread.c:100
#5  really_call_select (arg=0x7ffcfc8f6910) at thread.c:576
#6  0x00000000005c2057 in thread_select (func=<optimized out>, max_fds=max_fds@entry=7, rfds=rfds@entry=0x7ffcfc8f69d0, wfds=wfds@entry=0x7ffcfc8f6a50, efds=efds@entry=0x0,
    timeout=timeout@entry=0x7ffcfc8f6fe0, sigmask=sigmask@entry=0x0) at thread.c:595
#7  0x00000000005de450 in xg_select (fds_lim=7, rfds=rfds@entry=0x7ffcfc8f70d0, wfds=wfds@entry=0x7ffcfc8f7150, efds=efds@entry=0x0, timeout=timeout@entry=0x7ffcfc8f6fe0,
    sigmask=sigmask@entry=0x0) at xgselect.c:117
#8  0x00000000005a4fc5 in wait_reading_process_output (time_limit=time_limit@entry=2, nsecs=nsecs@entry=0, read_kbd=read_kbd@entry=1, do_display=do_display@entry=true,
    wait_for_cell=wait_for_cell@entry=0, wait_proc=wait_proc@entry=0x0, just_wait_proc=just_wait_proc@entry=0) at process.c:5375
#9  0x0000000000422c72 in sit_for (timeout=<optimized out>, reading=reading@entry=false, display_option=display_option@entry=2) at dispnew.c:5793
#10 0x00000000004fe73e in command_loop_1 () at keyboard.c:1340
#11 0x0000000000562d14 in internal_condition_case (bfun=bfun@entry=0x4fdb60 <command_loop_1>, handlers=handlers@entry=21072, hfun=hfun@entry=0x4f4590 <cmd_error>)
    at eval.c:1332
#12 0x00000000004ef92c in command_loop_2 (ignore=ignore@entry=0) at keyboard.c:1110
#13 0x0000000000562cc4 in internal_catch (tag=tag@entry=21744, func=func@entry=0x4ef910 <command_loop_2>, arg=arg@entry=0) at eval.c:1097
#14 0x00000000004ef89a in command_loop () at keyboard.c:1081
#15 0x00000000004f41c3 in recursive_edit_1 () at keyboard.c:695
#16 0x000000000051cbba in read_minibuf (map=map@entry=21543315, initial=initial@entry=22883060, prompt=prompt@entry=9012828, expflag=<optimized out>, histvar=<optimized out>,
    histpos=<optimized out>, defalt=defalt@entry=22879220, allow_props=false, inherit_input_method=false) at minibuf.c:685
#17 0x000000000051d3bf in Fread_from_minibuffer (prompt=9012828, initial_contents=22883060, keymap=21543315, read=0, hist=<optimized out>, default_value=22879220,
    inherit_input_method=0) at minibuf.c:992
#18 0x0000000000565654 in funcall_subr (subr=0x85a6e8 <Sread_from_minibuffer>, numargs=numargs@entry=7, args=args@entry=0x7ffcfc8f7800) at eval.c:2861
#19 0x00000000005646c6 in Ffuncall (nargs=nargs@entry=8, args=args@entry=0x7ffcfc8f77f8) at eval.c:2766
#20 0x000000000059a6f1 in exec_byte_code (bytestr=<optimized out>, vector=9553853, maxdepth=<optimized out>, args_template=<optimized out>,
    nargs=nargs@entry=72057594037927944, args=<optimized out>, args@entry=0x91c7c0 <pure+771808>) at bytecode.c:629
#21 0x00000000005643cc in funcall_lambda (fun=140724545747065, nargs=72057594037927944, nargs@entry=8, arg_vector=0x91c7c0 <pure+771808>, arg_vector@entry=0x7ffcfc8f79b8)
    at eval.c:2967
#22 0x0000000000564643 in Ffuncall (nargs=nargs@entry=9, args=args@entry=0x7ffcfc8f79b0) at eval.c:2780
#23 0x000000000051b9d0 in Fcompleting_read (prompt=9012828, collection=4729664, predicate=23040, require_match=4745440, initial_input=22883060, hist=23472, def=22879220,
    inherit_input_method=0) at minibuf.c:1696
#24 0x0000000000565525 in funcall_subr (subr=0x85a568 <Scompleting_read>, numargs=numargs@entry=7, args=args@entry=0x7ffcfc8f7b70) at eval.c:2866
#25 0x00000000005646c6 in Ffuncall (nargs=nargs@entry=8, args=args@entry=0x7ffcfc8f7b68) at eval.c:2766
#26 0x000000000059a6f1 in exec_byte_code (bytestr=<optimized out>, vector=9547005, maxdepth=<optimized out>, args_template=<optimized out>,
    nargs=nargs@entry=72057594037927942, args=<optimized out>, args@entry=0x91ad00 <pure+764960>) at bytecode.c:629
#27 0x00000000005643cc in funcall_lambda (fun=140724545748086, nargs=72057594037927942, nargs@entry=6, arg_vector=0x91ad00 <pure+764960>, arg_vector@entry=0x7ffcfc8f7ed0)
    at eval.c:2967
#28 0x0000000000564643 in Ffuncall (nargs=nargs@entry=7, args=args@entry=0x7ffcfc8f7ec8) at eval.c:2780
#29 0x000000000059a6f1 in exec_byte_code (bytestr=<optimized out>, vector=9546893, maxdepth=<optimized out>, args_template=<optimized out>,
    nargs=nargs@entry=72057594037927940, args=<optimized out>, args@entry=0x91ac90 <pure+764848>) at bytecode.c:629
#30 0x00000000005643cc in funcall_lambda (fun=140724545748754, nargs=72057594037927940, nargs@entry=4, arg_vector=0x91ac90 <pure+764848>, arg_vector@entry=0x7ffcfc8f8050)
    at eval.c:2967
#31 0x0000000000564643 in Ffuncall (nargs=nargs@entry=5, args=args@entry=0x7ffcfc8f8048) at eval.c:2780
#32 0x000000000059a6f1 in exec_byte_code (bytestr=<optimized out>, vector=9131805, maxdepth=<optimized out>, args_template=<optimized out>,
    nargs=nargs@entry=72057594037927938, args=<optimized out>, args@entry=0x8b5720 <pure+349760>) at bytecode.c:629
#33 0x00000000005643cc in funcall_lambda (fun=140724545749110, nargs=72057594037927938, nargs@entry=2, arg_vector=0x8b5720 <pure+349760>, arg_vector@entry=0x7ffcfc8f81a0)
    at eval.c:2967
#34 0x0000000000564643 in Ffuncall (nargs=nargs@entry=3, args=args@entry=0x7ffcfc8f8198) at eval.c:2780
#35 0x000000000059a6f1 in exec_byte_code (bytestr=<optimized out>, vector=9132077, maxdepth=<optimized out>, args_template=<optimized out>, nargs=<optimized out>,
    args=<optimized out>) at bytecode.c:629
#36 0x0000000000563c9b in eval_sub (form=form@entry=9131995) at eval.c:2237
#37 0x0000000000567680 in Feval (form=form@entry=9131995, lexical=<optimized out>) at eval.c:2051
#38 0x0000000000560888 in Fcall_interactively (function=4338912, record_flag=0, keys=12823093) at callint.c:357
#39 0x00000000005646c6 in Ffuncall (nargs=nargs@entry=4, args=args@entry=0x7ffcfc8f8518) at eval.c:2766
#40 0x000000000059a6f1 in exec_byte_code (bytestr=<optimized out>, vector=9587005, maxdepth=<optimized out>, args_template=<optimized out>,
    nargs=nargs@entry=72057594037927937, args=<optimized out>, args@entry=0x924940 <pure+804960>) at bytecode.c:629
#41 0x00000000005643cc in funcall_lambda (fun=140724545750475, nargs=72057594037927937, nargs@entry=1, arg_vector=0x924940 <pure+804960>, arg_vector@entry=0x7ffcfc8f8718)
    at eval.c:2967
#42 0x0000000000564643 in Ffuncall (nargs=nargs@entry=2, args=args@entry=0x7ffcfc8f8710) at eval.c:2780
#43 0x000000000056476a in call1 (fn=fn@entry=16128, arg1=<optimized out>) at eval.c:2617
#44 0x00000000004fdf4d in command_loop_1 () at keyboard.c:1482
#45 0x0000000000562d14 in internal_condition_case (bfun=bfun@entry=0x4fdb60 <command_loop_1>, handlers=handlers@entry=21072, hfun=hfun@entry=0x4f4590 <cmd_error>)
    at eval.c:1332
#46 0x00000000004ef92c in command_loop_2 (ignore=ignore@entry=0) at keyboard.c:1110
#47 0x0000000000562cc4 in internal_catch (tag=tag@entry=50928, func=func@entry=0x4ef910 <command_loop_2>, arg=arg@entry=0) at eval.c:1097
#48 0x00000000004ef8e7 in command_loop () at keyboard.c:1089
#49 0x00000000004f41c3 in recursive_edit_1 () at keyboard.c:695
#50 0x00000000004f44d5 in Frecursive_edit () at keyboard.c:766
#51 0x0000000000419093 in main (argc=3, argv=0x7ffcfc8f8af8) at emacs.c:1713

-- 
Mike Gerwitz
Free Software Hacker+Activist | GNU Maintainer & Volunteer
GPG: D6E9 B930 028A 6C38 F43B  2388 FEF6 3574 5E6F 6D05
https://mikegerwitz.com