perl/Test-Simple: update to 1.302205
[oi-userland.git] / components / shell / bash / patches / bash52-006.patch
blob851cfd7b603272cdad21bb6bce94c0fa86e578f5
1 BASH PATCH REPORT
2 =================
4 Bash-Release: 5.2
5 Patch-ID: bash52-006
7 Bug-Reported-by: feng xiangjun <fengxj325@gmail.com>
8 Bug-Reference-ID: <CAHH2t87LrCmO=gdyWOmGn5WJt7EucL+iOXzrry34OETe50S6uA@mail.gmail.com>
9 Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00089.html
11 Bug-Description:
13 In interactive shells, interrupting the shell while entering a command
14 substitution can inhibit alias expansion.
16 Patch (apply with `patch -p0'):
18 *** ../bash-5.2-patched/parse.y 2022-10-08 13:10:06.000000000 -0400
19 --- parse.y 2022-10-14 10:03:19.000000000 -0400
20 ***************
21 *** 3307,3310 ****
22 --- 3307,3312 ----
23 extended_glob = global_extglob;
24 #endif
25 + if (parser_state & (PST_CMDSUBST|PST_STRING))
26 + expand_aliases = expaliases_flag;
28 parser_state = 0;
29 ***************
30 *** 4389,4392 ****
31 --- 4391,4395 ----
32 parser_state |= PST_NOERROR;
34 + parser_state |= PST_STRING;
35 expand_aliases = 0;
37 ***************
38 *** 6402,6406 ****
39 parser_state &= ~PST_NOEXPAND; /* parse_comsub sentinel */
40 /* State flags we want to set for this run through the tokenizer. */
41 ! parser_state |= PST_COMPASSIGN|PST_REPARSE;
44 --- 6405,6409 ----
45 parser_state &= ~PST_NOEXPAND; /* parse_comsub sentinel */
46 /* State flags we want to set for this run through the tokenizer. */
47 ! parser_state |= PST_COMPASSIGN|PST_REPARSE|PST_STRING;
50 *** ../bash-20221007/parser.h 2022-08-30 11:39:56.000000000 -0400
51 --- parser.h 2022-10-14 09:56:18.000000000 -0400
52 ***************
53 *** 51,54 ****
54 --- 51,55 ----
55 #define PST_NOEXPAND 0x400000 /* don't expand anything in read_token_word; for command substitution */
56 #define PST_NOERROR 0x800000 /* don't print error messages in yyerror */
57 + #define PST_STRING 0x1000000 /* parsing a string to a command or word list */
59 /* Definition of the delimiter stack. Needed by parse.y and bashhist.c. */
60 *** ../bash-20221007/builtins/shopt.def 2022-10-07 10:25:55.000000000 -0400
61 --- builtins/shopt.def 2022-10-14 09:30:11.000000000 -0400
62 ***************
63 *** 150,153 ****
64 --- 150,156 ----
65 #endif
67 + int expaliases_flag = 0;
68 + static int shopt_set_expaliases PARAMS((char *, int));
70 static int shopt_set_debug_mode PARAMS((char *, int));
72 ***************
73 *** 199,203 ****
74 { "dotglob", &glob_dot_filenames, (shopt_set_func_t *)NULL },
75 { "execfail", &no_exit_on_failed_exec, (shopt_set_func_t *)NULL },
76 ! { "expand_aliases", &expand_aliases, (shopt_set_func_t *)NULL },
77 #if defined (DEBUGGER)
78 { "extdebug", &debugging_mode, shopt_set_debug_mode },
79 --- 202,206 ----
80 { "dotglob", &glob_dot_filenames, (shopt_set_func_t *)NULL },
81 { "execfail", &no_exit_on_failed_exec, (shopt_set_func_t *)NULL },
82 ! { "expand_aliases", &expaliases_flag, shopt_set_expaliases },
83 #if defined (DEBUGGER)
84 { "extdebug", &debugging_mode, shopt_set_debug_mode },
85 ***************
86 *** 351,355 ****
87 allow_null_glob_expansion = glob_dot_filenames = 0;
88 no_exit_on_failed_exec = 0;
89 ! expand_aliases = 0;
90 extended_quote = 1;
91 fail_glob_expansion = 0;
92 --- 354,358 ----
93 allow_null_glob_expansion = glob_dot_filenames = 0;
94 no_exit_on_failed_exec = 0;
95 ! expand_aliases = expaliases_flag = 0;
96 extended_quote = 1;
97 fail_glob_expansion = 0;
98 ***************
99 *** 632,635 ****
100 --- 635,647 ----
103 + static int
104 + shopt_set_expaliases (option_name, mode)
105 + char *option_name;
106 + int mode;
108 + expand_aliases = expaliases_flag;
109 + return 0;
112 #if defined (READLINE)
113 static int
114 *** ../bash-20221007/builtins/common.h 2022-10-07 10:10:17.000000000 -0400
115 --- builtins/common.h 2022-10-14 09:29:25.000000000 -0400
116 ***************
117 *** 258,261 ****
118 --- 258,263 ----
119 #endif
121 + extern int expaliases_flag;
123 /* variables from source.def */
124 extern int source_searches_cwd;
125 *** ../bash-20221007/execute_cmd.c 2022-10-10 10:48:54.000000000 -0400
126 --- execute_cmd.c 2022-10-14 09:32:24.000000000 -0400
127 ***************
128 *** 1537,1541 ****
129 aliases. */
130 if (ois != interactive_shell)
131 ! expand_aliases = 0;
134 --- 1537,1541 ----
135 aliases. */
136 if (ois != interactive_shell)
137 ! expand_aliases = expaliases_flag = 0;
140 *** ../bash-20221007/general.c 2021-11-04 14:12:38.000000000 -0400
141 --- general.c 2022-10-14 09:34:24.000000000 -0400
142 ***************
143 *** 92,96 ****
144 &interactive_comments,
145 &source_uses_path,
146 ! &expand_aliases,
147 &inherit_errexit,
148 &print_shift_error,
149 --- 92,96 ----
150 &interactive_comments,
151 &source_uses_path,
152 ! &expaliases_flag,
153 &inherit_errexit,
154 &print_shift_error,
155 ***************
156 *** 107,111 ****
157 if (on != 0)
159 ! interactive_comments = source_uses_path = expand_aliases = 1;
160 inherit_errexit = 1;
161 source_searches_cwd = 0;
162 --- 107,112 ----
163 if (on != 0)
165 ! interactive_comments = source_uses_path = 1;
166 ! expand_aliases = expaliases_flag = 1;
167 inherit_errexit = 1;
168 source_searches_cwd = 0;
169 ***************
170 *** 117,120 ****
171 --- 118,122 ----
173 set_posix_options (saved_posix_vars);
174 + expand_aliases = expaliases_flag;
175 free (saved_posix_vars);
176 saved_posix_vars = 0;
177 ***************
178 *** 123,127 ****
180 source_searches_cwd = 1;
181 ! expand_aliases = interactive_shell;
182 print_shift_error = 0;
184 --- 125,129 ----
186 source_searches_cwd = 1;
187 ! expand_aliases = expaliases_flag = interactive_shell; /* XXX */
188 print_shift_error = 0;
191 *** ../bash-5.2-patched/shell.c 2022-03-04 15:13:00.000000000 -0500
192 --- shell.c 2022-10-14 09:36:19.000000000 -0400
193 ***************
194 *** 1845,1850 ****
195 init_interactive ()
197 ! expand_aliases = interactive_shell = startup_state = 1;
198 ! interactive = 1;
199 #if defined (HISTORY)
200 if (enable_history_list == -1)
201 --- 1845,1850 ----
202 init_interactive ()
204 ! expand_aliases = expaliases_flag = 1;
205 ! interactive_shell = startup_state = interactive = 1;
206 #if defined (HISTORY)
207 if (enable_history_list == -1)
208 ***************
209 *** 1866,1870 ****
210 #endif /* HISTORY */
211 interactive_shell = startup_state = interactive = 0;
212 ! expand_aliases = posixly_correct; /* XXX - was 0 not posixly_correct */
213 no_line_editing = 1;
214 #if defined (JOB_CONTROL)
215 --- 1866,1870 ----
216 #endif /* HISTORY */
217 interactive_shell = startup_state = interactive = 0;
218 ! expand_aliases = expaliases_flag = posixly_correct; /* XXX - was 0 not posixly_correct */
219 no_line_editing = 1;
220 #if defined (JOB_CONTROL)
221 ***************
222 *** 1883,1887 ****
223 #endif
224 init_noninteractive ();
225 ! expand_aliases = interactive_shell = startup_state = 1;
226 #if defined (HISTORY)
227 remember_on_history = enable_history_list; /* XXX */
228 --- 1883,1887 ----
229 #endif
230 init_noninteractive ();
231 ! expand_aliases = expaliases_flag = interactive_shell = startup_state = 1;
232 #if defined (HISTORY)
233 remember_on_history = enable_history_list; /* XXX */
234 ***************
235 *** 2026,2030 ****
236 forced_interactive = interactive_shell = 0;
237 subshell_environment = running_in_background = 0;
238 ! expand_aliases = 0;
239 bash_argv_initialized = 0;
241 --- 2026,2030 ----
242 forced_interactive = interactive_shell = 0;
243 subshell_environment = running_in_background = 0;
244 ! expand_aliases = expaliases_flag = 0;
245 bash_argv_initialized = 0;
247 *** ../bash-5.2-patched/y.tab.c 2022-09-23 10:18:27.000000000 -0400
248 --- y.tab.c 2022-10-14 14:57:26.000000000 -0400
249 ***************
250 *** 5618,5621 ****
251 --- 5618,5623 ----
252 extended_glob = global_extglob;
253 #endif
254 + if (parser_state & (PST_CMDSUBST|PST_STRING))
255 + expand_aliases = expaliases_flag;
257 parser_state = 0;
258 ***************
259 *** 6700,6703 ****
260 --- 6702,6706 ----
261 parser_state |= PST_NOERROR;
263 + parser_state |= PST_STRING;
264 expand_aliases = 0;
266 ***************
267 *** 8713,8717 ****
268 parser_state &= ~PST_NOEXPAND; /* parse_comsub sentinel */
269 /* State flags we want to set for this run through the tokenizer. */
270 ! parser_state |= PST_COMPASSIGN|PST_REPARSE;
273 --- 8716,8720 ----
274 parser_state &= ~PST_NOEXPAND; /* parse_comsub sentinel */
275 /* State flags we want to set for this run through the tokenizer. */
276 ! parser_state |= PST_COMPASSIGN|PST_REPARSE|PST_STRING;
279 *** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
280 --- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
281 ***************
282 *** 26,30 ****
283 looks for to find the patch level (for the sccs version string). */
285 ! #define PATCHLEVEL 5
287 #endif /* _PATCHLEVEL_H_ */
288 --- 26,30 ----
289 looks for to find the patch level (for the sccs version string). */
291 ! #define PATCHLEVEL 6
293 #endif /* _PATCHLEVEL_H_ */