|
|
c58d3ff |
diff --git a/patchlevel.h b/patchlevel.h
|
|
|
c58d3ff |
--- a/patchlevel.h
|
|
|
c58d3ff |
+++ b/patchlevel.h
|
|
|
c58d3ff |
@@ -25,6 +25,6 @@
|
|
|
c58d3ff |
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
|
|
c58d3ff |
looks for to find the patch level (for the sccs version string). */
|
|
|
c58d3ff |
|
|
|
c58d3ff |
-#define PATCHLEVEL 3
|
|
|
c58d3ff |
+#define PATCHLEVEL 4
|
|
|
c58d3ff |
|
|
|
c58d3ff |
#endif /* _PATCHLEVEL_H_ */
|
|
|
588586c |
diff --git a/subst.c b/subst.c
|
|
|
588586c |
--- a/subst.c
|
|
|
588586c |
+++ b/subst.c
|
|
|
c58d3ff |
@@ -1798,6 +1798,9 @@ extract_heredoc_dolbrace_string (string, sindex, quoted, flags)
|
|
|
588586c |
return (result);
|
|
|
588586c |
}
|
|
|
588586c |
|
|
|
588586c |
+#define PARAMEXPNEST_MAX 32 // for now
|
|
|
588586c |
+static int dbstate[PARAMEXPNEST_MAX];
|
|
|
588586c |
+
|
|
|
588586c |
/* Extract a parameter expansion expression within ${ and } from STRING.
|
|
|
588586c |
Obey the Posix.2 rules for finding the ending `}': count braces while
|
|
|
588586c |
skipping over enclosed quoted strings and command substitutions.
|
|
|
c58d3ff |
@@ -1828,6 +1831,8 @@ extract_dollar_brace_string (string, sindex, quoted, flags)
|
|
|
588586c |
if (quoted == Q_HERE_DOCUMENT && dolbrace_state == DOLBRACE_QUOTE && (flags & SX_NOALLOC) == 0)
|
|
|
588586c |
return (extract_heredoc_dolbrace_string (string, sindex, quoted, flags));
|
|
|
588586c |
|
|
|
588586c |
+ dbstate[0] = dolbrace_state;
|
|
|
588586c |
+
|
|
|
588586c |
pass_character = 0;
|
|
|
588586c |
nesting_level = 1;
|
|
|
588586c |
slen = strlen (string + *sindex) + *sindex;
|
|
|
c58d3ff |
@@ -1852,6 +1857,8 @@ extract_dollar_brace_string (string, sindex, quoted, flags)
|
|
|
588586c |
|
|
|
588586c |
if (string[i] == '$' && string[i+1] == LBRACE)
|
|
|
588586c |
{
|
|
|
588586c |
+ if (nesting_level < PARAMEXPNEST_MAX)
|
|
|
588586c |
+ dbstate[nesting_level] = dolbrace_state;
|
|
|
588586c |
nesting_level++;
|
|
|
588586c |
i += 2;
|
|
|
588586c |
if (dolbrace_state == DOLBRACE_QUOTE || dolbrace_state == DOLBRACE_WORD)
|
|
|
c58d3ff |
@@ -1864,6 +1871,7 @@ extract_dollar_brace_string (string, sindex, quoted, flags)
|
|
|
588586c |
nesting_level--;
|
|
|
588586c |
if (nesting_level == 0)
|
|
|
588586c |
break;
|
|
|
588586c |
+ dolbrace_state = (nesting_level < PARAMEXPNEST_MAX) ? dbstate[nesting_level] : dbstate[0]; /* Guess using initial state */
|
|
|
588586c |
i++;
|
|
|
588586c |
continue;
|
|
|
588586c |
}
|