7 Bug-Reported-by: Antoine <bug-bash@glitchimini.net>
8 Bug-Reference-ID: <8bd59753-05ff-9b09-2337-2c7f52ded650@glitchimini.net>
9 Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00022.html
13 Bash needs to keep better track of nested brace expansions to avoid problems
14 with quoting and POSIX semantics.
16 Patch (apply with `patch -p0'):
18 *** ../bash-5.2-patched/subst.c 2022-10-05 10:22:02.000000000 -0400
19 --- subst.c 2022-10-06 15:19:08.000000000 -0400
25 + #define PARAMEXPNEST_MAX 32 // for now
26 + static int dbstate[PARAMEXPNEST_MAX];
28 /* Extract a parameter expansion expression within ${ and } from STRING.
29 Obey the Posix.2 rules for finding the ending `}': count braces while
33 return (extract_heredoc_dolbrace_string (string, sindex, quoted, flags));
35 + dbstate[0] = dolbrace_state;
42 if (string[i] == '$' && string[i+1] == LBRACE)
44 + if (nesting_level < PARAMEXPNEST_MAX)
45 + dbstate[nesting_level] = dolbrace_state;
51 if (nesting_level == 0)
53 + dolbrace_state = (nesting_level < PARAMEXPNEST_MAX) ? dbstate[nesting_level] : dbstate[0]; /* Guess using initial state */
56 *** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
57 --- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
60 looks for to find the patch level (for the sccs version string). */
62 ! #define PATCHLEVEL 3
64 #endif /* _PATCHLEVEL_H_ */
66 looks for to find the patch level (for the sccs version string). */
68 ! #define PATCHLEVEL 4
70 #endif /* _PATCHLEVEL_H_ */