Bug 442278 - CTRL-C may lock up bash
Summary: CTRL-C may lock up bash
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: bash
Version: rawhide
Hardware: x86_64
OS: Linux
low
low
Target Milestone: ---
Assignee: Roman Rakus
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-04-13 19:06 UTC by Jan Kratochvil
Modified: 2014-01-13 00:07 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-12-27 17:20:42 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Reproducer for bash-3.2-30.fc10.x86_64. (547 bytes, patch)
2009-01-09 07:22 UTC, Jan Kratochvil
no flags Details | Diff

Description Jan Kratochvil 2008-04-13 19:06:17 UTC
Description of problem:
When I hit CTRL-C to bash in an inappropriate moment it did lock up.

Version-Release number of selected component (if applicable):
bash-3.2-20.fc8.x86_64
glibc-2.7-2.x86_64
ncurses-5.6-12.20070812.fc8.x86_64

How reproducible:
Accidentally occured once, did not try to reproduce, expecting it is unreproducible.

Steps to Reproduce:
1. Have a notebook disk spun down.
2. Hit CTRL-R.
3. Hit CTRL-C.

Actual results:
Locked up bash.

Expected results:
Healthy new bash prompt after CTRL-C.

Additional info:
#0  0x0000003b986e0e4e in __lll_lock_wait_private () from /lib64/libc.so.6
#1  0x0000003b986770f7 in _L_lock_14679 () from /lib64/libc.so.6
#2  0x0000003b98675f21 in __libc_free (mem=0x3b98952980) at malloc.c:3624
#3  0x000000000041bed2 in reset_parser () at ./parse.y:2498
#4  0x0000000000448392 in throw_to_top_level () at sig.c:407
#5  <signal handler called>
#6  0x0000003b98631330 in __sigprocmask (how=<value optimized out>,
set=0x7fff841b8920, oset=0x0)
    at ../sysdeps/unix/sysv/linux/ia64/sigprocmask.c:42
#7  0x000000000047c123 in rl_signal_handler (sig=2) at signals.c:184
#8  <signal handler called>
#9  0x0000003b98672dd1 in _int_malloc (av=0x3b98952980, bytes=93640) at
malloc.c:4317
#10 0x0000003b986748fa in __libc_malloc (bytes=93640) at malloc.c:3553
#11 0x0000000000457a3b in xmalloc (bytes=5) at xmalloc.c:87
#12 0x0000000000477be8 in rl_search_history (direction=-1, invoking_key=<value
optimized out>) at isearch.c:223
#13 0x000000000046cba7 in _rl_dispatch_subseq (key=18, map=0x6b54e0,
got_subseq=0) at readline.c:742
#14 0x000000000046d227 in readline_internal_char () at readline.c:519
#15 0x000000000046d5c6 in e (prompt=<value optimized out>) at readline.c:545
#16 0x000000000042146f in yy_readline_get () at ./parse.y:1213
#17 0x000000000041d735 in shell_getc (remove_quoted_newline=1) at ./parse.y:1942
#18 0x000000000041e93e in read_token (command=<value optimized out>) at
./parse.y:2562
#19 0x000000000042197a in yyparse () at ./parse.y:2208
#20 0x000000000041b5c7 in parse_command () at eval.c:223
#21 0x000000000041b686 in read_command () at eval.c:267
#22 0x000000000041b8c5 in reader_loop () at eval.c:133
#23 0x000000000041b339 in main (argc=<value optimized out>, argv=0x7fff841b9fb8,
env=0x7fff841b9fc8) at shell.c:725

Expecting the design of `interrupt_immediately' is broken as it calls functions
not permitted to be called from a signal handler by POSIX (as I was told on Sat
by Jakub Jelinek):
  http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html

Comment 1 Bug Zapper 2008-11-26 10:29:23 UTC
This message is a reminder that Fedora 8 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 8.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '8'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 8's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 8 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 2 Bug Zapper 2009-01-09 06:23:05 UTC
Fedora 8 changed to end-of-life (EOL) status on 2009-01-07. Fedora 8 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 3 Jan Kratochvil 2009-01-09 07:22:36 UTC
Created attachment 328526 [details]
Reproducer for bash-3.2-30.fc10.x86_64.

This patch will delay each CTRL-R for about 2 seconds to be able to press CTRL-C that time.  In 50% of cases it will lock up forever by that CTRL-C.

Comment 4 Jan Kratochvil 2009-01-09 07:23:12 UTC
Problem still exists, easy race-extending reproducer provided in the Comment 3.

Comment 5 Roman Rakus 2009-01-26 13:00:24 UTC
The problem is in readline's signal work. I have sent a patch to upstream for now.
You can watch any further discussion: http://www.nabble.com/bash-3.2%3A-Bad-signal-work-in-readline-to21545703.html

Comment 6 Jan Kratochvil 2009-01-26 13:09:31 UTC
Thanks and sorry for not testing it but isn't it true that currently one can interrupt even slow syscalls by CTRL-C (such as <tab>-completion over stuck NFS) which may not work well with the hook only in getc().  I may be wrong, though.

Comment 7 Bug Zapper 2009-11-18 12:28:18 UTC
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 10 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 8 Roman Rakus 2009-11-18 13:06:42 UTC
Still not fixed - upstream knows about it. Maybe will be fixed in next bash release.

Comment 9 Roman Rakus 2009-12-27 17:20:42 UTC
Looks like it works well in bash-4.1-rc1. Feel free to reopen this bug if the problem still persists.

Comment 10 Jan Kratochvil 2010-01-03 17:50:06 UTC
It also looks as fixed for me.
Aware there were some fixes in readline around it (with some other problems).


Note You need to log in before you can comment on or make changes to this bug.