helpThe GNU Bourne-Again SHell - Support: sr #109403, Bash segfaults when pressing...

 
 

sr #109403: Bash segfaults when pressing Ctrl+C on certain function

Submitted by:  ukuvbu oibws <xyzdragon>
Submitted on:  Tue 24 Oct 2017 09:16:53 PM UTC  
 
Category:  None Priority:  5 - Normal
Severity:  4 - Important Status:  Done
Privacy:  Public Assigned to:  None
Open/Closed:  Open Operating System:  GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 07 Nov 2017 10:55:45 PM UTC, comment #2:

Cool, thank you!

ukuvbu oibws <xyzdragon>
Tue 07 Nov 2017 09:50:01 PM UTC, comment #1:

Thanks for the report. This will be fixed in the next devel branch push.

Chet Ramey <chet>
Project Administrator
Tue 24 Oct 2017 09:16:53 PM UTC, original submission:

I had a much more complex function, but I could reduce it down to this minimal (non-)working example:

function f(){ foovar='bar'; time sleep 10s | cat; }

Now, when I call `f` and press Ctrl+C while it still is running (before 10s are over), bash closes or crashes, I don't know. It's very obnoxious. I tested it in one of the virtual terminals (Ctrl+Alt+F1)

I use bash 4.4.12(1). When removing the time command or the variable definition or the pipe, then the problem disappears. Only this combination of these three things seem to cause the problem, bug?

So I tried this in `gdb --args bash -v` and got:

Program received signal SIGSEGV, Segmentation fault.
0x00000000004c8f86 in ?? ()
(gdb) bt
#0 0x00000000004c8f86 in ?? ()
#1 0x000000000047ef6b in sh_xmalloc ()
#2 0x0000000000466107 in unwind_protect_mem ()
#3 0x0000000000485801 in ?? ()
#4 0x0000000000485b15 in parse_and_execute ()
#5 0x0000000000430099 in execute_variable_command ()
#6 0x0000000000422e10 in parse_command ()
#7 0x0000000000422ed8 in read_command ()
#8 0x00000000004230bb in reader_loop ()
#9 0x0000000000421d4e in main ()

Another correspondence on Stackoverflow said:

"On my machine it doesn't crash on the Ctrl-C, it crashes if I run it once, Ctrl-C it, then run it again."

ukuvbu oibws <xyzdragon>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by chet (Posted a comment)
  • -email is unavailable- added by xyzdragon (Submitted the item)
  • -email is unavailable- added by xyzdragon
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-11-07 chet StatusNone => Done
    2017-10-24 xyzdragon Carbon-Copy- => Added xyzdragon

    Back to the top


    Powered by Savane 3.3