]>
Commit | Line | Data |
---|---|---|
1b0dc639 AM |
1 | BASH PATCH REPORT |
2 | ================= | |
3 | ||
4 | Bash-Release: 3.2 | |
5 | Patch-ID: bash32-020 | |
6 | ||
7 | Bug-Reported-by: Ian A Watson <WATSON_IAN_A@LILLY.COM> | |
8 | Bug-Reference-ID: <OFEC551808.69D02C7F-ON8525729A.0045708D-8525729A.0046150B@EliLilly.lilly.com> | |
9 | Bug-Reference-URL: | |
10 | ||
11 | Bug-Description: | |
12 | ||
13 | In some cases of error processing, a jump back to the top-level processing | |
14 | loop from a builtin command would leave the shell in an inconsistent state. | |
15 | ||
16 | Patch: | |
17 | ||
18 | *** ../bash-3.2-patched/sig.c Wed Jan 25 14:57:59 2006 | |
19 | --- sig.c Sat Mar 10 11:11:30 2007 | |
20 | *************** | |
21 | *** 351,354 **** | |
22 | --- 351,373 ---- | |
23 | #undef XHANDLER | |
24 | ||
25 | + /* Run some of the cleanups that should be performed when we run | |
26 | + jump_to_top_level from a builtin command context. XXX - might want to | |
27 | + also call reset_parser here. */ | |
28 | + void | |
29 | + top_level_cleanup () | |
30 | + { | |
31 | + /* Clean up string parser environment. */ | |
32 | + while (parse_and_execute_level) | |
33 | + parse_and_execute_cleanup (); | |
34 | + | |
35 | + #if defined (PROCESS_SUBSTITUTION) | |
36 | + unlink_fifo_list (); | |
37 | + #endif /* PROCESS_SUBSTITUTION */ | |
38 | + | |
39 | + run_unwind_protects (); | |
40 | + loop_level = continuing = breaking = 0; | |
41 | + return_catch_flag = 0; | |
42 | + } | |
43 | + | |
44 | /* What to do when we've been interrupted, and it is safe to handle it. */ | |
45 | void | |
46 | *** ../bash-3.2-patched/sig.h Wed Jan 25 14:50:27 2006 | |
47 | --- sig.h Sat Mar 10 11:14:18 2007 | |
48 | *************** | |
49 | *** 122,125 **** | |
50 | --- 122,126 ---- | |
51 | extern void initialize_terminating_signals __P((void)); | |
52 | extern void reset_terminating_signals __P((void)); | |
53 | + extern void top_level_cleanup __P((void)); | |
54 | extern void throw_to_top_level __P((void)); | |
55 | extern void jump_to_top_level __P((int)) __attribute__((__noreturn__)); | |
56 | *** ../bash-3.2-patched/builtins/common.c Tue Apr 3 16:47:13 2007 | |
57 | --- builtins/common.c Mon Apr 30 15:01:33 2007 | |
58 | *************** | |
59 | *** 132,135 **** | |
60 | --- 132,136 ---- | |
61 | { | |
62 | builtin_error (_("too many arguments")); | |
63 | + top_level_cleanup (); | |
64 | jump_to_top_level (DISCARD); | |
65 | } | |
66 | *************** | |
67 | *** 396,400 **** | |
68 | throw_to_top_level (); | |
69 | else | |
70 | ! jump_to_top_level (DISCARD); | |
71 | } | |
72 | no_args (list->next); | |
73 | --- 410,417 ---- | |
74 | throw_to_top_level (); | |
75 | else | |
76 | ! { | |
77 | ! top_level_cleanup (); | |
78 | ! jump_to_top_level (DISCARD); | |
79 | ! } | |
80 | } | |
81 | no_args (list->next); | |
82 | *** ../bash-3.2-patched/subst.c Tue Apr 3 16:47:19 2007 | |
83 | --- subst.c Tue Jul 17 09:45:11 2007 | |
84 | *************** | |
85 | *** 1279,1283 **** | |
86 | if (no_longjmp_on_fatal_error == 0) | |
87 | { /* { */ | |
88 | ! report_error ("bad substitution: no closing `%s' in %s", "}", string); | |
89 | last_command_exit_value = EXECUTION_FAILURE; | |
90 | exp_jump_to_top_level (DISCARD); | |
91 | --- 1290,1294 ---- | |
92 | if (no_longjmp_on_fatal_error == 0) | |
93 | { /* { */ | |
94 | ! report_error (_("bad substitution: no closing `%s' in %s"), "}", string); | |
95 | last_command_exit_value = EXECUTION_FAILURE; | |
96 | exp_jump_to_top_level (DISCARD); | |
97 | *************** | |
98 | *** 7662,7665 **** | |
99 | --- 7706,7711 ---- | |
100 | expand_no_split_dollar_star = 0; /* XXX */ | |
101 | expanding_redir = 0; | |
102 | + | |
103 | + top_level_cleanup (); /* from sig.c */ | |
104 | ||
105 | jump_to_top_level (v); | |
106 | *************** | |
107 | *** 7880,7884 **** | |
108 | { | |
109 | report_error (_("no match: %s"), tlist->word->word); | |
110 | ! jump_to_top_level (DISCARD); | |
111 | } | |
112 | else if (allow_null_glob_expansion == 0) | |
113 | --- 7927,7931 ---- | |
114 | { | |
115 | report_error (_("no match: %s"), tlist->word->word); | |
116 | ! exp_jump_to_top_level (DISCARD); | |
117 | } | |
118 | else if (allow_null_glob_expansion == 0) | |
119 | *** ../bash-3.2-patched/arrayfunc.c Thu Jul 27 09:37:59 2006 | |
120 | --- arrayfunc.c Thu May 31 11:55:46 2007 | |
121 | *************** | |
122 | *** 619,622 **** | |
123 | --- 619,624 ---- | |
124 | { | |
125 | last_command_exit_value = EXECUTION_FAILURE; | |
126 | + | |
127 | + top_level_cleanup (); | |
128 | jump_to_top_level (DISCARD); | |
129 | } | |
130 | *** ../bash-3.2-patched/expr.c Wed Dec 28 17:47:03 2005 | |
131 | --- expr.c Tue Apr 24 14:17:59 2007 | |
132 | *************** | |
133 | *** 930,933 **** | |
134 | --- 930,934 ---- | |
135 | { | |
136 | expr_unwind (); | |
137 | + top_level_cleanup (); | |
138 | jump_to_top_level (DISCARD); | |
139 | } | |
140 | *** ../bash-3.2-patched/variables.c Fri Sep 8 13:33:32 2006 | |
141 | --- variables.c Tue Jul 17 09:54:59 2007 | |
142 | *************** | |
143 | *** 1822,1830 **** | |
144 | lval = evalexp (oval, &expok); /* ksh93 seems to do this */ | |
145 | if (expok == 0) | |
146 | ! jump_to_top_level (DISCARD); | |
147 | } | |
148 | rval = evalexp (value, &expok); | |
149 | if (expok == 0) | |
150 | ! jump_to_top_level (DISCARD); | |
151 | if (flags & ASS_APPEND) | |
152 | rval += lval; | |
153 | --- 1855,1869 ---- | |
154 | lval = evalexp (oval, &expok); /* ksh93 seems to do this */ | |
155 | if (expok == 0) | |
156 | ! { | |
157 | ! top_level_cleanup (); | |
158 | ! jump_to_top_level (DISCARD); | |
159 | ! } | |
160 | } | |
161 | rval = evalexp (value, &expok); | |
162 | if (expok == 0) | |
163 | ! { | |
164 | ! top_level_cleanup (); | |
165 | ! jump_to_top_level (DISCARD); | |
166 | ! } | |
167 | if (flags & ASS_APPEND) | |
168 | rval += lval; | |
169 | *** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006 | |
170 | --- patchlevel.h Mon Oct 16 14:22:54 2006 | |
171 | *************** | |
172 | *** 26,30 **** | |
173 | looks for to find the patch level (for the sccs version string). */ | |
174 | ||
175 | ! #define PATCHLEVEL 19 | |
176 | ||
177 | #endif /* _PATCHLEVEL_H_ */ | |
178 | --- 26,30 ---- | |
179 | looks for to find the patch level (for the sccs version string). */ | |
180 | ||
181 | ! #define PATCHLEVEL 20 | |
182 | ||
183 | #endif /* _PATCHLEVEL_H_ */ |