$subject can be triggered easily by setting TERM to eterm (with unset
EMACS). Originally this segfault was caused by running emacs and
within emacs try to ssh on localhost.
Reproducer 1)
[rrakus@dhcp-lab-170 ~]$ bash
[rrakus@dhcp-lab-170 ~]$ exit
[rrakus@dhcp-lab-170 ~]$ env TERM=eterm bash
Segmentation fault
[rrakus@dhcp-lab-170 ~]$ env TERM=eterm-sldkhflsad bash
Segmentation fault
Reproducer 2)
1. Start emacs on some machine.
2. M-x ansi-term
3. 'echo $TERM' to verify that it's eterm-color or eterm
4. 'ssh F11HOST' (where F11HOST is a machine with bash 4.0 installed
and set as your shell)
5. Observe the connection being closed instead of receiving a prompt.
Following patch hinders segfault:
--- bash-4.0/shell.c.orig 2009-10-15 15:57:56.000000000 -0400
+++ bash-4.0/shell.c 2009-10-15 15:58:28.000000000 -0400
@@ -572,7 +572,7 @@
/* running_under_emacs == 2 for `eterm' */
running_under_emacs = (emacs != 0) || (term&& STREQN (term,
"emacs", 5));
- running_under_emacs += term&& STREQN (term, "eterm", 5)&&
strstr (emacs, "term");
+ running_under_emacs += term&& STREQN (term, "eterm", 5)&&
(emacs != 0)&& strstr (emacs, "term");
if (running_under_emacs)
gnu_error_format = 1;
RR