Merge pull request #193 from chris5560/master
[feed/packages.git] / utils / bash / patches / 120-upstream-bash43-020.patch
1 BASH PATCH REPORT
2 =================
3
4 Bash-Release: 4.3
5 Patch-ID: bash43-020
6
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
10
11 Bug-Description:
12
13 When PS2 contains a command substitution, here-documents entered in an
14 interactive shell can sometimes cause a segmentation fault.
15
16 Patch (apply with `patch -p0'):
17
18 --- a/shell.h
19 +++ b/shell.h
20 @@ -168,7 +168,8 @@ typedef struct _sh_parser_state_t {
21 /* flags state affecting the parser */
22 int expand_aliases;
23 int echo_input_at_read;
24 -
25 + int need_here_doc;
26 +
27 } sh_parser_state_t;
28
29 typedef struct _sh_input_line_state_t {
30 --- a/parse.y
31 +++ b/parse.y
32 @@ -2642,7 +2642,7 @@ gather_here_documents ()
33 int r;
34
35 r = 0;
36 - while (need_here_doc)
37 + while (need_here_doc > 0)
38 {
39 parser_state |= PST_HEREDOC;
40 make_here_document (redir_stack[r++], line_number);
41 @@ -6075,6 +6075,7 @@ save_parser_state (ps)
42
43 ps->expand_aliases = expand_aliases;
44 ps->echo_input_at_read = echo_input_at_read;
45 + ps->need_here_doc = need_here_doc;
46
47 ps->token = token;
48 ps->token_buffer_size = token_buffer_size;
49 @@ -6123,6 +6124,7 @@ restore_parser_state (ps)
50
51 expand_aliases = ps->expand_aliases;
52 echo_input_at_read = ps->echo_input_at_read;
53 + need_here_doc = ps->need_here_doc;
54
55 FREE (token);
56 token = ps->token;
57 --- a/y.tab.c
58 +++ b/y.tab.c
59 @@ -4954,7 +4954,7 @@ gather_here_documents ()
60 int r;
61
62 r = 0;
63 - while (need_here_doc)
64 + while (need_here_doc > 0)
65 {
66 parser_state |= PST_HEREDOC;
67 make_here_document (redir_stack[r++], line_number);
68 @@ -8387,6 +8387,7 @@ save_parser_state (ps)
69
70 ps->expand_aliases = expand_aliases;
71 ps->echo_input_at_read = echo_input_at_read;
72 + ps->need_here_doc = need_here_doc;
73
74 ps->token = token;
75 ps->token_buffer_size = token_buffer_size;
76 @@ -8435,6 +8436,7 @@ restore_parser_state (ps)
77
78 expand_aliases = ps->expand_aliases;
79 echo_input_at_read = ps->echo_input_at_read;
80 + need_here_doc = ps->need_here_doc;
81
82 FREE (token);
83 token = ps->token;
84 --- a/patchlevel.h
85 +++ b/patchlevel.h
86 @@ -25,6 +25,6 @@
87 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
88 looks for to find the patch level (for the sccs version string). */
89
90 -#define PATCHLEVEL 19
91 +#define PATCHLEVEL 20
92
93 #endif /* _PATCHLEVEL_H_ */