← Commit list

ad88bdee0

Ron Yorston
Ron Yorston
2015-05-18
SUCCESS Duration: 148s

Subject

ash: remove arithmetic expansion collapsing at parse time

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

shell/ash.c+6 -12
@@ -11316,9 +11316,9 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
parenlevel--;
} else {
if (pgetc() == ')') {
+ c = CTLENDARI;
if (--arinest == 0) {
syntax = prevsyntax;
- c = CTLENDARI;
}
} else {
/*
@@ -11809,18 +11809,12 @@ parsearith: {
if (++arinest == 1) {
prevsyntax = syntax;
syntax = ARISYNTAX;
- USTPUTC(CTLARI, out);
- if (dblquote)
- USTPUTC('"', out);
- else
- USTPUTC(' ', out);
- } else {
- /*
- * we collapse embedded arithmetic expansion to
- * parenthesis, which should be equivalent
- */
- USTPUTC('(', out);
}
+ USTPUTC(CTLARI, out);
+ if (dblquote)
+ USTPUTC('"', out);
+ else
+ USTPUTC(' ', out);
goto parsearith_return;
}
#endif
shell/ash_test/ash-vars/var-do-not-collapse-arithmetic-expansion-at-parse-time.right+2 -0
@@ -0,0 +1,2 @@
+12
+9
shell/ash_test/ash-vars/var-do-not-collapse-arithmetic-expansion-at-parse-time.tests+3 -0
@@ -0,0 +1,3 @@
+unset a
+echo $((3 + ${a:=$((4 + 5))}))
+echo $a