← Commit list

61a495925

Denys Vlasenko
Denys Vlasenko
2023-06-15
SUCCESS Duration: 154s

Subject

shell/math: remove special code to handle a?b?c:d:e, it works without it now

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_test/ash-arith/arith-ternary_nested2.right+1 -0
@@ -0,0 +1 @@
+3:3
shell/ash_test/ash-arith/arith-ternary_nested2.tests+2 -0
@@ -0,0 +1,2 @@
+exec 2>&1
+echo 3:$((0?1:2?3:4?5:6?7:8))
shell/hush_test/hush-arith/arith-ternary_nested2.right+1 -0
@@ -0,0 +1 @@
+3:3
shell/hush_test/hush-arith/arith-ternary_nested2.tests+2 -0
@@ -0,0 +1,2 @@
+exec 2>&1
+echo 3:$((0?1:2?3:4?5:6?7:8))
shell/math.c+3 -9
@@ -840,15 +840,9 @@ evaluate_string(arith_state_t *math_state, const char *expr)
if (prev_prec < prec
|| (prev_prec == prec && is_right_associative(prec))
) {
- /* Unless a?b?c:d:... and we are at the second : */
- if (op != TOK_CONDITIONAL_SEP
- || prev_op != TOK_CONDITIONAL_SEP
- ) {
- /* ...x~y@: push @ on opstack */
- opstackptr++; /* undo removal of ~ op */
- goto push_op;
- }
- /* else: a?b?c:d:. Evaluate b?c:d, replace it on stack with result. Then repeat */
+ /* ...x~y@: push @ on opstack */
+ opstackptr++; /* undo removal of ~ op */
+ goto push_op;
}
/* else: ...x~y@. Evaluate x~y, replace it on stack with result. Then repeat */
}