perl/Module-Build-Tiny: update to 0.051 for Perl 5.36 and 5.38
[oi-userland.git] / components / shell / bash / patches / bash52-015.patch
blob740a13da53c8ff3109cf0bb10cc4e656ea2a3304
1 BASH PATCH REPORT
2 =================
4 Bash-Release: 5.2
5 Patch-ID: bash52-015
7 Bug-Reported-by: Frode Nordahl <frode.nordahl@canonical.com>
8 Bug-Reference-ID: <20221119070714.351759-1-frode.nordahl@canonical.com>
9 Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-11/msg00078.html
11 Bug-Description:
13 There are several cases where bash is too aggressive when optimizing out forks
14 in subshells. For example, `eval' and traps should never be optimized.
16 Patch (apply with `patch -p0'):
18 *** ../bash-5.2-patched/builtins/common.h 2022-11-23 17:09:18.000000000 -0500
19 --- builtins/common.h 2022-11-19 18:03:59.000000000 -0500
20 ***************
21 *** 52,55 ****
22 --- 52,56 ----
23 #define SEVAL_ONECMD 0x100 /* only allow a single command */
24 #define SEVAL_NOHISTEXP 0x200 /* inhibit history expansion */
25 + #define SEVAL_NOOPTIMIZE 0x400 /* don't try to set optimization flags */
27 /* Flags for describe_command, shared between type.def and command.def */
28 *** ../bash-5.2-patched/builtins/evalstring.c 2022-11-05 17:27:44.000000000 -0400
29 --- builtins/evalstring.c 2022-11-19 18:23:21.000000000 -0500
30 ***************
31 *** 133,138 ****
32 (command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') &&
33 (command->value.Connection->second->flags & CMD_TRY_OPTIMIZING) &&
34 ! ((startup_state == 2 && should_suppress_fork (command->value.Connection->second)) ||
35 ! ((subshell_environment & SUBSHELL_PAREN) && should_optimize_fork (command->value.Connection->second, 0))))
37 command->value.Connection->second->flags |= CMD_NO_FORK;
38 --- 133,138 ----
39 (command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') &&
40 (command->value.Connection->second->flags & CMD_TRY_OPTIMIZING) &&
41 ! (should_suppress_fork (command->value.Connection->second) ||
42 ! ((subshell_environment & SUBSHELL_PAREN) && should_optimize_fork (command->value.Connection->second, 0))))
44 command->value.Connection->second->flags |= CMD_NO_FORK;
45 ***************
46 *** 291,294 ****
47 --- 291,295 ----
48 (flags & SEVAL_RESETLINE) -> reset line_number to 1
49 (flags & SEVAL_NOHISTEXP) -> history_expansion_inhibited -> 1
50 + (flags & SEVAL_NOOPTIMIZE) -> don't try to turn on optimizing flags
53 ***************
54 *** 503,507 ****
55 series of connection commands is
56 command->value.Connection->second. */
57 ! else if (command->type == cm_connection && can_optimize_connection (command))
59 command->value.Connection->second->flags |= CMD_TRY_OPTIMIZING;
60 --- 504,510 ----
61 series of connection commands is
62 command->value.Connection->second. */
63 ! else if (command->type == cm_connection &&
64 ! (flags & SEVAL_NOOPTIMIZE) == 0 &&
65 ! can_optimize_connection (command))
67 command->value.Connection->second->flags |= CMD_TRY_OPTIMIZING;
68 *** ../bash-5.2-patched/builtins/eval.def 2016-01-25 13:28:37.000000000 -0500
69 --- builtins/eval.def 2022-11-19 18:04:25.000000000 -0500
70 ***************
71 *** 54,57 ****
72 list = loptend; /* skip over possible `--' */
74 ! return (list ? evalstring (string_list (list), "eval", SEVAL_NOHIST) : EXECUTION_SUCCESS);
76 --- 54,57 ----
77 list = loptend; /* skip over possible `--' */
79 ! return (list ? evalstring (string_list (list), "eval", SEVAL_NOHIST|SEVAL_NOOPTIMIZE) : EXECUTION_SUCCESS);
81 *** ../bash-5.2-patched/trap.c 2022-08-10 08:59:45.000000000 -0400
82 --- trap.c 2022-12-12 10:57:51.000000000 -0500
83 ***************
84 *** 305,308 ****
85 --- 305,309 ----
86 volatile int save_return_catch_flag, function_code;
87 procenv_t save_return_catch;
88 + char *trap_command, *old_trap;
89 #if defined (ARRAY_VARS)
90 ARRAY *ps;
91 ***************
92 *** 420,423 ****
93 --- 421,427 ----
94 else
96 + old_trap = trap_list[sig];
97 + trap_command = savestring (old_trap);
99 save_parser_state (&pstate);
100 save_subst_varlist = subst_assign_varlist;
101 ***************
102 *** 442,446 ****
104 if (function_code == 0)
105 ! x = parse_and_execute (savestring (trap_list[sig]), "trap", SEVAL_NONINT|SEVAL_NOHIST|SEVAL_RESETLINE);
106 else
108 --- 446,451 ----
110 if (function_code == 0)
111 ! /* XXX is x always last_command_exit_value? */
112 ! x = parse_and_execute (trap_command, "trap", SEVAL_NONINT|SEVAL_NOHIST|SEVAL_RESETLINE|SEVAL_NOOPTIMIZE);
113 else
115 ***************
116 *** 1003,1007 ****
118 reset_parser ();
119 ! parse_and_execute (trap_command, "exit trap", SEVAL_NONINT|SEVAL_NOHIST|SEVAL_RESETLINE);
121 else if (code == ERREXIT)
122 --- 1008,1012 ----
124 reset_parser ();
125 ! parse_and_execute (trap_command, "exit trap", SEVAL_NONINT|SEVAL_NOHIST|SEVAL_RESETLINE|SEVAL_NOOPTIMIZE);
127 else if (code == ERREXIT)
128 ***************
129 *** 1110,1114 ****
132 ! flags = SEVAL_NONINT|SEVAL_NOHIST;
133 if (sig != DEBUG_TRAP && sig != RETURN_TRAP && sig != ERROR_TRAP)
134 flags |= SEVAL_RESETLINE;
135 --- 1115,1119 ----
138 ! flags = SEVAL_NONINT|SEVAL_NOHIST|SEVAL_NOOPTIMIZE;
139 if (sig != DEBUG_TRAP && sig != RETURN_TRAP && sig != ERROR_TRAP)
140 flags |= SEVAL_RESETLINE;
141 *** ../bash-5.2-patched/parse.y 2022-11-23 17:09:18.000000000 -0500
142 --- parse.y 2022-11-19 18:15:34.000000000 -0500
143 ***************
144 *** 2828,2832 ****
145 last_lastarg = savestring (last_lastarg);
147 ! parse_and_execute (savestring (command), vname, SEVAL_NONINT|SEVAL_NOHIST);
149 restore_parser_state (&ps);
150 --- 2844,2848 ----
151 last_lastarg = savestring (last_lastarg);
153 ! parse_and_execute (savestring (command), vname, SEVAL_NONINT|SEVAL_NOHIST|SEVAL_NOOPTIMIZE);
155 restore_parser_state (&ps);
156 *** ../bash-5.2-patched/jobs.c 2022-07-18 10:19:56.000000000 -0400
157 --- jobs.c 2022-11-19 18:10:24.000000000 -0500
158 ***************
159 *** 4221,4225 ****
160 for (i = 0; i < nchild; i++)
162 ! parse_and_execute (savestring (trap_command), "trap", SEVAL_NOHIST|SEVAL_RESETLINE);
165 --- 4243,4247 ----
166 for (i = 0; i < nchild; i++)
168 ! parse_and_execute (savestring (trap_command), "trap", SEVAL_NOHIST|SEVAL_RESETLINE|SEVAL_NOOPTIMIZE);
171 *** ../bash-5.2-patched/y.tab.c 2022-11-23 17:09:18.000000000 -0500
172 --- y.tab.c 2022-11-23 17:21:17.000000000 -0500
173 ***************
174 *** 5139,5143 ****
175 last_lastarg = savestring (last_lastarg);
177 ! parse_and_execute (savestring (command), vname, SEVAL_NONINT|SEVAL_NOHIST);
179 restore_parser_state (&ps);
180 --- 5154,5158 ----
181 last_lastarg = savestring (last_lastarg);
183 ! parse_and_execute (savestring (command), vname, SEVAL_NONINT|SEVAL_NOHIST|SEVAL_NOOPTIMIZE);
185 restore_parser_state (&ps);
186 *** ../bash-5.2-patched/execute_cmd.c 2022-11-05 17:27:41.000000000 -0400
187 --- execute_cmd.c 2022-11-22 17:09:38.000000000 -0500
188 ***************
189 *** 1655,1659 ****
190 and set CMD_TRY_OPTIMIZING for simple commands on the right side of an
191 and-or or `;' list to test for optimizing forks when they are executed. */
192 ! if (user_subshell && command->type == cm_subshell)
193 optimize_subshell_command (command->value.Subshell->command);
195 --- 1665,1670 ----
196 and set CMD_TRY_OPTIMIZING for simple commands on the right side of an
197 and-or or `;' list to test for optimizing forks when they are executed. */
198 ! if (user_subshell && command->type == cm_subshell &&
199 ! (command->flags & (CMD_TIME_PIPELINE|CMD_INVERT_RETURN)) == 0)
200 optimize_subshell_command (command->value.Subshell->command);
202 *** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
203 --- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
204 ***************
205 *** 26,30 ****
206 looks for to find the patch level (for the sccs version string). */
208 ! #define PATCHLEVEL 14
210 #endif /* _PATCHLEVEL_H_ */
211 --- 26,30 ----
212 looks for to find the patch level (for the sccs version string). */
214 ! #define PATCHLEVEL 15
216 #endif /* _PATCHLEVEL_H_ */