aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c18
-rw-r--r--shell/ash_test/ash-vars/var-do-not-collapse-arithmetic-expansion-at-parse-time.right2
-rwxr-xr-xshell/ash_test/ash-vars/var-do-not-collapse-arithmetic-expansion-at-parse-time.tests3
3 files changed, 11 insertions, 12 deletions
diff --git a/shell/ash.c b/shell/ash.c
index ee7642a64..33a477d80 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -11316,9 +11316,9 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
11316 parenlevel--; 11316 parenlevel--;
11317 } else { 11317 } else {
11318 if (pgetc() == ')') { 11318 if (pgetc() == ')') {
11319 c = CTLENDARI;
11319 if (--arinest == 0) { 11320 if (--arinest == 0) {
11320 syntax = prevsyntax; 11321 syntax = prevsyntax;
11321 c = CTLENDARI;
11322 } 11322 }
11323 } else { 11323 } else {
11324 /* 11324 /*
@@ -11809,18 +11809,12 @@ parsearith: {
11809 if (++arinest == 1) { 11809 if (++arinest == 1) {
11810 prevsyntax = syntax; 11810 prevsyntax = syntax;
11811 syntax = ARISYNTAX; 11811 syntax = ARISYNTAX;
11812 USTPUTC(CTLARI, out);
11813 if (dblquote)
11814 USTPUTC('"', out);
11815 else
11816 USTPUTC(' ', out);
11817 } else {
11818 /*
11819 * we collapse embedded arithmetic expansion to
11820 * parenthesis, which should be equivalent
11821 */
11822 USTPUTC('(', out);
11823 } 11812 }
11813 USTPUTC(CTLARI, out);
11814 if (dblquote)
11815 USTPUTC('"', out);
11816 else
11817 USTPUTC(' ', out);
11824 goto parsearith_return; 11818 goto parsearith_return;
11825} 11819}
11826#endif 11820#endif
diff --git a/shell/ash_test/ash-vars/var-do-not-collapse-arithmetic-expansion-at-parse-time.right b/shell/ash_test/ash-vars/var-do-not-collapse-arithmetic-expansion-at-parse-time.right
new file mode 100644
index 000000000..81a15855c
--- /dev/null
+++ b/shell/ash_test/ash-vars/var-do-not-collapse-arithmetic-expansion-at-parse-time.right
@@ -0,0 +1,2 @@
112
29
diff --git a/shell/ash_test/ash-vars/var-do-not-collapse-arithmetic-expansion-at-parse-time.tests b/shell/ash_test/ash-vars/var-do-not-collapse-arithmetic-expansion-at-parse-time.tests
new file mode 100755
index 000000000..e97a08a57
--- /dev/null
+++ b/shell/ash_test/ash-vars/var-do-not-collapse-arithmetic-expansion-at-parse-time.tests
@@ -0,0 +1,3 @@
1unset a
2echo $((3 + ${a:=$((4 + 5))}))
3echo $a