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