[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bash segfaults on EOF-delimited [^D] 'here-documents' (instead of aborti
From: |
osirisgothra paradisim llc |
Subject: |
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: |
Mon, 2 Jun 2014 18:02:31 -0400 |
The version number of Bash.
GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu) The hardware and
operating system.
Linux localhost 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014
x86_64 x86_64 x86_64 GNU/Linux
The compiler used to compile Bash. A description of the bug behaviour.
A short script or ‘recipe’ which exercises the bug and may be used
to reproduce it.(see below for bashbug and remaining report)
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALED$
uname output: Linux larnica 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00
UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
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)
That's about it. I think the fact that I use 's AND "s in the evaluation also
causes problems because I tried without the 's and had no problems, but it's to
early to tell if it really is okay since I haven't tested that extensively. I
also wonder if this has anything to do with PS3 not being evaluated at all when
it is used for builtins like 'select': PS3="$(echo something)" will print out:
ubuntu@localhost:~$ select i in 1 2; do true; done
1. selection1
2. selection2
$(echo something)
Fix:
The best workaround of course is to use a static value for PS2, like the
default.
- bash segfaults on EOF-delimited [^D] 'here-documents' (instead of aborting command?) when PS2 is not a static value (PS3 might have problems too),
osirisgothra paradisim llc <=