diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2021-09-25 22:04:45 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-09-25 22:04:45 +0200 |
commit | d84a604830a7ee3f8fb5f3908ae0d54513393a20 (patch) | |
tree | 3e9dc05e082e41328a84c8eaa3d45f36c2ba5d44 /shell/ash_test/ash-arith | |
parent | 627821e42b06adfe6bbc6004d8eeb7c35f65120d (diff) | |
download | busybox-w32-d84a604830a7ee3f8fb5f3908ae0d54513393a20.tar.gz busybox-w32-d84a604830a7ee3f8fb5f3908ae0d54513393a20.tar.bz2 busybox-w32-d84a604830a7ee3f8fb5f3908ae0d54513393a20.zip |
shell: fix arithmentic evaluation of "++7" and such (it is + + 7, i.e. 7)
function old new delta
evaluate_string 945 988 +43
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash_test/ash-arith')
-rw-r--r-- | shell/ash_test/ash-arith/arith.right | 20 | ||||
-rwxr-xr-x | shell/ash_test/ash-arith/arith.tests | 10 | ||||
-rwxr-xr-x | shell/ash_test/ash-arith/arith1.sub | 4 | ||||
-rwxr-xr-x | shell/ash_test/ash-arith/arith2.sub | 10 |
4 files changed, 25 insertions, 19 deletions
diff --git a/shell/ash_test/ash-arith/arith.right b/shell/ash_test/ash-arith/arith.right index 6936f1269..99ef825f5 100644 --- a/shell/ash_test/ash-arith/arith.right +++ b/shell/ash_test/ash-arith/arith.right | |||
@@ -97,6 +97,7 @@ ghi | |||
97 | 3 3 | 97 | 3 3 |
98 | 4 4 | 98 | 4 4 |
99 | 4 4 | 99 | 4 4 |
100 | 7 7 | ||
100 | ./arith.tests: line 257: arithmetic syntax error | 101 | ./arith.tests: line 257: arithmetic syntax error |
101 | ./arith.tests: line 259: arithmetic syntax error | 102 | ./arith.tests: line 259: arithmetic syntax error |
102 | ./arith.tests: line 260: arithmetic syntax error | 103 | ./arith.tests: line 260: arithmetic syntax error |
@@ -105,6 +106,8 @@ ghi | |||
105 | 4 4 | 106 | 4 4 |
106 | 7 7 | 107 | 7 7 |
107 | -7 -7 | 108 | -7 -7 |
109 | 7 | ||
110 | 7 | ||
108 | ./arith1.sub: line 2: arithmetic syntax error | 111 | ./arith1.sub: line 2: arithmetic syntax error |
109 | ./arith1.sub: line 3: arithmetic syntax error | 112 | ./arith1.sub: line 3: arithmetic syntax error |
110 | ./arith1.sub: line 4: arithmetic syntax error | 113 | ./arith1.sub: line 4: arithmetic syntax error |
@@ -119,11 +122,12 @@ ghi | |||
119 | 2 2 | 122 | 2 2 |
120 | -2 -2 | 123 | -2 -2 |
121 | 1 1 | 124 | 1 1 |
122 | ./arith1.sub: line 37: arithmetic syntax error | 125 | 7 |
123 | ./arith2.sub: line 2: arithmetic syntax error | 126 | 7 |
124 | ./arith2.sub: line 3: arithmetic syntax error | 127 | 7 |
125 | ./arith2.sub: line 4: arithmetic syntax error | 128 | 7 |
126 | ./arith2.sub: line 5: arithmetic syntax error | 129 | 7 |
130 | 7 | ||
127 | 5 5 | 131 | 5 5 |
128 | 1 1 | 132 | 1 1 |
129 | 6 6 | 133 | 6 6 |
@@ -132,8 +136,10 @@ ghi | |||
132 | 1 1 | 136 | 1 1 |
133 | 4 4 | 137 | 4 4 |
134 | 0 0 | 138 | 0 0 |
135 | ./arith2.sub: line 42: arithmetic syntax error | 139 | -7 |
136 | ./arith2.sub: line 47: arithmetic syntax error | 140 | -7 |
141 | 7 | ||
142 | 7 | ||
137 | 8 12 | 143 | 8 12 |
138 | ./arith.tests: line 290: arithmetic syntax error | 144 | ./arith.tests: line 290: arithmetic syntax error |
139 | 42 | 145 | 42 |
diff --git a/shell/ash_test/ash-arith/arith.tests b/shell/ash_test/ash-arith/arith.tests index d65758e7d..746ccab71 100755 --- a/shell/ash_test/ash-arith/arith.tests +++ b/shell/ash_test/ash-arith/arith.tests | |||
@@ -252,8 +252,8 @@ echo 3 $x | |||
252 | echo 4 $(( ++x )) | 252 | echo 4 $(( ++x )) |
253 | echo 4 $x | 253 | echo 4 $x |
254 | 254 | ||
255 | # bash 3.2 apparently thinks that ++7 is 7 | 255 | # ++ is not a inc operator on non-variable, it is the + + sequence |
256 | #ash# echo 7 $(( ++7 )) | 256 | echo 7 $(( ++7 )) |
257 | ( echo $(( 7-- )) ) | 257 | ( echo $(( 7-- )) ) |
258 | 258 | ||
259 | ( echo $(( --x=7 )) ) | 259 | ( echo $(( --x=7 )) ) |
@@ -267,9 +267,9 @@ echo 4 $x | |||
267 | echo 7 $(( +7 )) | 267 | echo 7 $(( +7 )) |
268 | echo -7 $(( -7 )) | 268 | echo -7 $(( -7 )) |
269 | 269 | ||
270 | # bash 3.2 apparently thinks that ++7 is 7 | 270 | # ++ is not a inc operator on non-variable, it is the + + sequence |
271 | #ash# echo $(( ++7 )) | 271 | echo $(( ++7 )) |
272 | #ash# echo $(( --7 )) | 272 | echo $(( --7 )) |
273 | 273 | ||
274 | ${THIS_SH} ./arith1.sub | 274 | ${THIS_SH} ./arith1.sub |
275 | ${THIS_SH} ./arith2.sub | 275 | ${THIS_SH} ./arith2.sub |
diff --git a/shell/ash_test/ash-arith/arith1.sub b/shell/ash_test/ash-arith/arith1.sub index 80aa99922..a36785c67 100755 --- a/shell/ash_test/ash-arith/arith1.sub +++ b/shell/ash_test/ash-arith/arith1.sub | |||
@@ -35,6 +35,6 @@ echo 1 $a | |||
35 | 35 | ||
36 | #ash# (( ++ )) | 36 | #ash# (( ++ )) |
37 | ( echo $(( +++7 )) ) | 37 | ( echo $(( +++7 )) ) |
38 | # bash 3.2 apparently thinks that ++ +7 is 7 | 38 | # ++ is not a inc operator on non-variable, it is the + + sequence |
39 | #ash# echo $(( ++ + 7 )) | 39 | echo $(( ++ + 7 )) |
40 | #ash# (( -- )) | 40 | #ash# (( -- )) |
diff --git a/shell/ash_test/ash-arith/arith2.sub b/shell/ash_test/ash-arith/arith2.sub index 9105059db..29f9471d6 100755 --- a/shell/ash_test/ash-arith/arith2.sub +++ b/shell/ash_test/ash-arith/arith2.sub | |||
@@ -1,4 +1,4 @@ | |||
1 | # bash 3.2 apparently thinks that ++7 is 7 etc | 1 | # ++ and -- are not inc/dec operators on non-variables, they are + + and - - sequences |
2 | ( echo $(( --7 )) ) | 2 | ( echo $(( --7 )) ) |
3 | ( echo $(( ++7 )) ) | 3 | ( echo $(( ++7 )) ) |
4 | ( echo $(( -- 7 )) ) | 4 | ( echo $(( -- 7 )) ) |
@@ -37,13 +37,13 @@ echo 4 $(( 4 - -- a )) | |||
37 | echo 0 $a | 37 | echo 0 $a |
38 | 38 | ||
39 | #ash# (( -- )) | 39 | #ash# (( -- )) |
40 | # bash 3.2 apparently thinks that ---7 is -7 | 40 | # -- is not a dec operator on non-variable, it is the - - sequence |
41 | #ash# echo $(( ---7 )) | 41 | echo $(( ---7 )) |
42 | ( echo $(( -- - 7 )) ) | 42 | ( echo $(( -- - 7 )) ) |
43 | 43 | ||
44 | #ash# (( ++ )) | 44 | #ash# (( ++ )) |
45 | # bash 3.2: 7 | 45 | # ++ is not a inc operator on non-variable, it is the + + sequence |
46 | #ash# echo 7 $(( ++7 )) | 46 | echo $(( ++7 )) |
47 | ( echo $(( ++ + 7 )) ) | 47 | ( echo $(( ++ + 7 )) ) |
48 | 48 | ||
49 | # bash 3.2: -7 | 49 | # bash 3.2: -7 |