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/hush_test/hush-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/hush_test/hush-arith')
-rw-r--r-- | shell/hush_test/hush-arith/arith.right | 20 | ||||
-rwxr-xr-x | shell/hush_test/hush-arith/arith.tests | 10 | ||||
-rwxr-xr-x | shell/hush_test/hush-arith/arith1.sub | 4 | ||||
-rwxr-xr-x | shell/hush_test/hush-arith/arith2.sub | 10 |
4 files changed, 25 insertions, 19 deletions
diff --git a/shell/hush_test/hush-arith/arith.right b/shell/hush_test/hush-arith/arith.right index c48e468a5..2c389caea 100644 --- a/shell/hush_test/hush-arith/arith.right +++ b/shell/hush_test/hush-arith/arith.right | |||
@@ -106,6 +106,7 @@ hush: arithmetic syntax error | |||
106 | 3 3 | 106 | 3 3 |
107 | 4 4 | 107 | 4 4 |
108 | 4 4 | 108 | 4 4 |
109 | 7 7 | ||
109 | hush: arithmetic syntax error | 110 | hush: arithmetic syntax error |
110 | hush: arithmetic syntax error | 111 | hush: arithmetic syntax error |
111 | hush: arithmetic syntax error | 112 | hush: arithmetic syntax error |
@@ -114,6 +115,8 @@ hush: arithmetic syntax error | |||
114 | 4 4 | 115 | 4 4 |
115 | 7 7 | 116 | 7 7 |
116 | -7 -7 | 117 | -7 -7 |
118 | 7 | ||
119 | 7 | ||
117 | hush: arithmetic syntax error | 120 | hush: arithmetic syntax error |
118 | hush: arithmetic syntax error | 121 | hush: arithmetic syntax error |
119 | hush: arithmetic syntax error | 122 | hush: arithmetic syntax error |
@@ -128,11 +131,12 @@ hush: arithmetic syntax error | |||
128 | 2 2 | 131 | 2 2 |
129 | -2 -2 | 132 | -2 -2 |
130 | 1 1 | 133 | 1 1 |
131 | hush: arithmetic syntax error | 134 | 7 |
132 | hush: arithmetic syntax error | 135 | 7 |
133 | hush: arithmetic syntax error | 136 | 7 |
134 | hush: arithmetic syntax error | 137 | 7 |
135 | hush: arithmetic syntax error | 138 | 7 |
139 | 7 | ||
136 | 5 5 | 140 | 5 5 |
137 | 1 1 | 141 | 1 1 |
138 | 6 6 | 142 | 6 6 |
@@ -141,8 +145,10 @@ hush: arithmetic syntax error | |||
141 | 1 1 | 145 | 1 1 |
142 | 4 4 | 146 | 4 4 |
143 | 0 0 | 147 | 0 0 |
144 | hush: arithmetic syntax error | 148 | -7 |
145 | hush: arithmetic syntax error | 149 | -7 |
150 | 7 | ||
151 | 7 | ||
146 | 8 12 | 152 | 8 12 |
147 | hush: arithmetic syntax error | 153 | hush: arithmetic syntax error |
148 | 42 | 154 | 42 |
diff --git a/shell/hush_test/hush-arith/arith.tests b/shell/hush_test/hush-arith/arith.tests index bc6b341d1..a7aded17d 100755 --- a/shell/hush_test/hush-arith/arith.tests +++ b/shell/hush_test/hush-arith/arith.tests | |||
@@ -255,8 +255,8 @@ echo 3 $x | |||
255 | echo 4 $(( ++x )) | 255 | echo 4 $(( ++x )) |
256 | echo 4 $x | 256 | echo 4 $x |
257 | 257 | ||
258 | # bash 3.2 apparently thinks that ++7 is 7 | 258 | # ++ is not a inc operator on non-variable, it is the + + sequence |
259 | #ash# echo 7 $(( ++7 )) | 259 | echo 7 $(( ++7 )) |
260 | ( echo $(( 7-- )) ) | 260 | ( echo $(( 7-- )) ) |
261 | 261 | ||
262 | ( echo $(( --x=7 )) ) | 262 | ( echo $(( --x=7 )) ) |
@@ -270,9 +270,9 @@ echo 4 $x | |||
270 | echo 7 $(( +7 )) | 270 | echo 7 $(( +7 )) |
271 | echo -7 $(( -7 )) | 271 | echo -7 $(( -7 )) |
272 | 272 | ||
273 | # bash 3.2 apparently thinks that ++7 is 7 | 273 | # ++ is not a inc operator on non-variable, it is the + + sequence |
274 | #ash# echo $(( ++7 )) | 274 | echo $(( ++7 )) |
275 | #ash# echo $(( --7 )) | 275 | echo $(( --7 )) |
276 | 276 | ||
277 | ${THIS_SH} ./arith1.sub | 277 | ${THIS_SH} ./arith1.sub |
278 | ${THIS_SH} ./arith2.sub | 278 | ${THIS_SH} ./arith2.sub |
diff --git a/shell/hush_test/hush-arith/arith1.sub b/shell/hush_test/hush-arith/arith1.sub index 80aa99922..a36785c67 100755 --- a/shell/hush_test/hush-arith/arith1.sub +++ b/shell/hush_test/hush-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/hush_test/hush-arith/arith2.sub b/shell/hush_test/hush-arith/arith2.sub index 9105059db..29f9471d6 100755 --- a/shell/hush_test/hush-arith/arith2.sub +++ b/shell/hush_test/hush-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 |