]>
Commit | Line | Data |
---|---|---|
5be71d2a AB |
1 | BASH PATCH REPORT |
2 | ================= | |
3 | ||
4 | Bash-Release: 5.2 | |
5 | Patch-ID: bash52-004 | |
6 | ||
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 | |
10 | ||
11 | Bug-Description: | |
12 | ||
13 | Bash needs to keep better track of nested brace expansions to avoid problems | |
14 | with quoting and POSIX semantics. | |
15 | ||
16 | Patch (apply with `patch -p0'): | |
17 | ||
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 | |
20 | *************** | |
21 | *** 1799,1802 **** | |
22 | --- 1804,1810 ---- | |
23 | } | |
24 | ||
25 | + #define PARAMEXPNEST_MAX 32 // for now | |
26 | + static int dbstate[PARAMEXPNEST_MAX]; | |
27 | + | |
28 | /* Extract a parameter expansion expression within ${ and } from STRING. | |
29 | Obey the Posix.2 rules for finding the ending `}': count braces while | |
30 | *************** | |
31 | *** 1829,1832 **** | |
32 | --- 1837,1842 ---- | |
33 | return (extract_heredoc_dolbrace_string (string, sindex, quoted, flags)); | |
34 | ||
35 | + dbstate[0] = dolbrace_state; | |
36 | + | |
37 | pass_character = 0; | |
38 | nesting_level = 1; | |
39 | *************** | |
40 | *** 1853,1856 **** | |
41 | --- 1863,1868 ---- | |
42 | if (string[i] == '$' && string[i+1] == LBRACE) | |
43 | { | |
44 | + if (nesting_level < PARAMEXPNEST_MAX) | |
45 | + dbstate[nesting_level] = dolbrace_state; | |
46 | nesting_level++; | |
47 | i += 2; | |
48 | *************** | |
49 | *** 1865,1868 **** | |
50 | --- 1877,1881 ---- | |
51 | if (nesting_level == 0) | |
52 | break; | |
53 | + dolbrace_state = (nesting_level < PARAMEXPNEST_MAX) ? dbstate[nesting_level] : dbstate[0]; /* Guess using initial state */ | |
54 | i++; | |
55 | continue; | |
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 | |
58 | *************** | |
59 | *** 26,30 **** | |
60 | looks for to find the patch level (for the sccs version string). */ | |
61 | ||
62 | ! #define PATCHLEVEL 3 | |
63 | ||
64 | #endif /* _PATCHLEVEL_H_ */ | |
65 | --- 26,30 ---- | |
66 | looks for to find the patch level (for the sccs version string). */ | |
67 | ||
68 | ! #define PATCHLEVEL 4 | |
69 | ||
70 | #endif /* _PATCHLEVEL_H_ */ |