bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash segfaults on EOF-delimited [^D] 'here-documents' (instead of ab


From: Chet Ramey
Subject: Re: bash segfaults on EOF-delimited [^D] 'here-documents' (instead of aborting command?) when PS2 is not a static value (PS3 might have problems too)
Date: Tue, 03 Jun 2014 09:46:53 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

On 6/2/14, 6:02 PM, osirisgothra paradisim llc wrote:

> Bash Version: 4.3
> Patch Level: 11
> Release Status: release
> 
> Description:
>         Seems that the shell crashes when the value of PS2 is set to 
> something that is evaluated when displayed, and the user presses (usually by 
> accident) CTRL+D (EOF) when entering extra lines, especially "here 
> documents". It also seems that the current line must be EMPTY when Ctrl+D is 
> pressed by accident, if there is (usually) keystrokes already entered, then 
> the crash does not happen and it works as expected (which is probably why it 
> has taken so long for me to figure out what was doing it). Now I understand 
> that Ctrl+D is bound to also exit the shell however the two issues are the 
> crashing (segmentation fault), and the continuity of behavior dependent upon 
> the number of characters entered. I said (usually) earlier because there are 
> some times (not sure why) that there are a few characters on the line, but I 
> have not been able to reproduce this only two times, so I'm not sure what 
> that's all about.
> 
> Repeat-By:
>    
> bash --norc --noprofile (also tried running from inside /usr/bin/env but it 
> acts the same)
> ubuntu@localhost:~$ PS2='$(echo "enter something>")'
> ubuntu@localhost:~$ cat <<-EOF
> enter something>here's some text
> enter something>pressing ctrl+d on the next line
> enter something>
> bash: warning: here-document at line 30 delimited by end-of-file (wanted 
> `EOF')
> Segmentation fault (core dumped)

Thanks for the report.  I've attached a patch that fixes the problem.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/

Attachment: here-doc-ps2-comsub.patch
Description: Source code patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]