[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Arithmetic expression: recursive VAR evaluation suppresses desired V
Re: Arithmetic expression: recursive VAR evaluation suppresses desired VAR assignment
Thu, 11 Aug 2022 10:14:41 +0900
2022年8月11日(木) 9:01 Steffen Nurpmeso <email@example.com>:
> #?0|kent:tmp$ /x/src/busybox.git/busybox sh xxx.sh
It seems your busybox interprets« I1=0?I1:I3 » as « (I1=0)?I1:I3 »,
but this violates POSIX XCU 2.6.4 and XCU 1.1.2. Also, the above
behavior doesn't seem to be reproduced by recent versions of busybox.
I have tried 1.23.2, 1.35.0, and 1.36.0 (master 7c2a3bd), but all
produce the following result:
Which version of busybox do you use?
$ busybox | head -1
The behavior of recent versions of busybox is still broken. The third
number in the second line is 6, which implies that busybox evaluates
the discarded branch of the conditional operator (i.e., expr3 of
true?expr2:expr3). This doesn't happen in any other shells that
support the recursive arithmetic evaluation. I tried bash, ksh93,
mksh, zsh, posh, and osh, but all produced the same result as bash
while yash, ash, and dash do not support the recursive arithmetic
> I think the busybox variant is correct.
I think both your version and recent versions of busybox sh are broken.