7 Bug-Reported-by: Jared Yanovich <slovichon@gmail.com>
8 Bug-Reference-ID: <20140417073654.GB26875@nightderanger.psc.edu>
9 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-04/msg00065.html
13 When PS2 contains a command substitution, here-documents entered in an
14 interactive shell can sometimes cause a segmentation fault.
16 Patch (apply with `patch -p0'):
20 @@ -168,7 +168,8 @@ typedef struct _sh_parser_state_t {
21 /* flags state affecting the parser */
23 int echo_input_at_read;
29 typedef struct _sh_input_line_state_t {
32 @@ -2642,7 +2642,7 @@ gather_here_documents ()
36 - while (need_here_doc)
37 + while (need_here_doc > 0)
39 parser_state |= PST_HEREDOC;
40 make_here_document (redir_stack[r++], line_number);
41 @@ -6075,6 +6075,7 @@ save_parser_state (ps)
43 ps->expand_aliases = expand_aliases;
44 ps->echo_input_at_read = echo_input_at_read;
45 + ps->need_here_doc = need_here_doc;
48 ps->token_buffer_size = token_buffer_size;
49 @@ -6123,6 +6124,7 @@ restore_parser_state (ps)
51 expand_aliases = ps->expand_aliases;
52 echo_input_at_read = ps->echo_input_at_read;
53 + need_here_doc = ps->need_here_doc;
59 @@ -4954,7 +4954,7 @@ gather_here_documents ()
63 - while (need_here_doc)
64 + while (need_here_doc > 0)
66 parser_state |= PST_HEREDOC;
67 make_here_document (redir_stack[r++], line_number);
68 @@ -8387,6 +8387,7 @@ save_parser_state (ps)
70 ps->expand_aliases = expand_aliases;
71 ps->echo_input_at_read = echo_input_at_read;
72 + ps->need_here_doc = need_here_doc;
75 ps->token_buffer_size = token_buffer_size;
76 @@ -8435,6 +8436,7 @@ restore_parser_state (ps)
78 expand_aliases = ps->expand_aliases;
79 echo_input_at_read = ps->echo_input_at_read;
80 + need_here_doc = ps->need_here_doc;
87 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
88 looks for to find the patch level (for the sccs version string). */
90 -#define PATCHLEVEL 19
91 +#define PATCHLEVEL 20
93 #endif /* _PATCHLEVEL_H_ */