summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2022-11-07 11:43:33 -0500
committerChet Ramey <chet.ramey@case.edu>2022-11-07 11:43:33 -0500
commitddde6f00b83c6473561b153684ea4cea1f9d21a3 (patch)
treea03693ac11f79015eddf0bc157b5b60962bc3377
parent6ddc9cf242078c02c626ec60ee139c586da49bad (diff)
downloadbash-ddde6f00b83c6473561b153684ea4cea1f9d21a3.tar.gz
Bash-5.2 patch 8: fix for quoting brackets inside array subscript expansion
-rw-r--r--patchlevel.h2
-rw-r--r--subst.c6
2 files changed, 6 insertions, 2 deletions
diff --git a/patchlevel.h b/patchlevel.h
index b1897c50..333dd947 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -25,6 +25,6 @@
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */
-#define PATCHLEVEL 7
+#define PATCHLEVEL 8
#endif /* _PATCHLEVEL_H_ */
diff --git a/subst.c b/subst.c
index dcf2e46c..7715bfbf 100644
--- a/subst.c
+++ b/subst.c
@@ -3819,6 +3819,10 @@ pos_params (string, start, end, quoted, pflags)
#define EXP_CHAR(s) (s == '$' || s == '`' || s == CTLESC || s == '~')
#endif
+/* We don't perform process substitution in arithmetic expressions, so don't
+ bother checking for it. */
+#define ARITH_EXP_CHAR(s) (s == '$' || s == '`' || s == CTLESC || s == '~')
+
/* If there are any characters in STRING that require full expansion,
then call FUNC to expand STRING; otherwise just perform quote
removal if necessary. This returns a new string. */
@@ -4028,7 +4032,7 @@ expand_arith_string (string, quoted)
i = saw_quote = 0;
while (string[i])
{
- if (EXP_CHAR (string[i]))
+ if (ARITH_EXP_CHAR (string[i]))
break;
else if (string[i] == '\'' || string[i] == '\\' || string[i] == '"')
saw_quote = string[i];