diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-08-04 00:46:07 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-08-04 00:46:07 +0000 |
commit | 2b576b8e76ee0dc548f46489e2546b7ed70d080d (patch) | |
tree | a04f9fb858ba1180f04319e656a0b43623655bca /shell/hush_test | |
parent | c8bec9a0852ce6ce09a67d8a688623e32735378e (diff) | |
download | busybox-w32-2b576b8e76ee0dc548f46489e2546b7ed70d080d.tar.gz busybox-w32-2b576b8e76ee0dc548f46489e2546b7ed70d080d.tar.bz2 busybox-w32-2b576b8e76ee0dc548f46489e2546b7ed70d080d.zip |
hush: fix mishandling of a'b'c=fff as assignments. They are not.
function old new delta
parse_stream 1920 2004 +84
done_word 715 752 +37
parse_and_run_stream 328 333 +5
builtin_exec 25 29 +4
pseudo_exec_argv 138 139 +1
run_list 2006 1999 -7
is_assignment 215 134 -81
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/2 up/down: 131/-88) Total: 43 bytes
Diffstat (limited to 'shell/hush_test')
-rw-r--r-- | shell/hush_test/hush-misc/assignment1.right | 9 | ||||
-rwxr-xr-x | shell/hush_test/hush-misc/assignment1.tests | 42 | ||||
-rw-r--r-- | shell/hush_test/hush-misc/assignment2.rigth | 2 | ||||
-rwxr-xr-x | shell/hush_test/hush-misc/assignment2.tests | 4 |
4 files changed, 57 insertions, 0 deletions
diff --git a/shell/hush_test/hush-misc/assignment1.right b/shell/hush_test/hush-misc/assignment1.right new file mode 100644 index 000000000..d0a13d3d8 --- /dev/null +++ b/shell/hush_test/hush-misc/assignment1.right | |||
@@ -0,0 +1,9 @@ | |||
1 | if1:0 | ||
2 | while1:0 | ||
3 | until1:0 | ||
4 | if2:0 | ||
5 | while2:0 | ||
6 | until2:0 | ||
7 | if3:0 | ||
8 | while3:0 | ||
9 | until3:0 | ||
diff --git a/shell/hush_test/hush-misc/assignment1.tests b/shell/hush_test/hush-misc/assignment1.tests new file mode 100755 index 000000000..033b35250 --- /dev/null +++ b/shell/hush_test/hush-misc/assignment1.tests | |||
@@ -0,0 +1,42 @@ | |||
1 | # Assignments after some keywords should still work | ||
2 | |||
3 | if a=1 true; then a=1 true; elif a=1 true; then a=1 true; else a=1 true; fi | ||
4 | echo if1:$? | ||
5 | while a=1 true; do a=1 true; break; done | ||
6 | echo while1:$? | ||
7 | until a=1 false; do a=1 true; break; done | ||
8 | echo until1:$? | ||
9 | |||
10 | if a=1 true | ||
11 | then a=1 true | ||
12 | elif a=1 true | ||
13 | then a=1 true | ||
14 | else a=1 true | ||
15 | fi | ||
16 | echo if2:$? | ||
17 | while a=1 true | ||
18 | do a=1 true | ||
19 | break | ||
20 | done | ||
21 | echo while2:$? | ||
22 | until a=1 false | ||
23 | do a=1 true | ||
24 | break | ||
25 | done | ||
26 | echo until2:$? | ||
27 | |||
28 | if | ||
29 | a=1 true; then | ||
30 | a=1 true; elif | ||
31 | a=1 true; then | ||
32 | a=1 true; else | ||
33 | a=1 true; fi | ||
34 | echo if3:$? | ||
35 | while | ||
36 | a=1 true; do | ||
37 | a=1 true; break; done | ||
38 | echo while3:$? | ||
39 | until | ||
40 | a=1 false; do | ||
41 | a=1 true; break; done | ||
42 | echo until3:$? | ||
diff --git a/shell/hush_test/hush-misc/assignment2.rigth b/shell/hush_test/hush-misc/assignment2.rigth new file mode 100644 index 000000000..591552cde --- /dev/null +++ b/shell/hush_test/hush-misc/assignment2.rigth | |||
@@ -0,0 +1,2 @@ | |||
1 | hush: can't exec 'a=b': No such file or directory | ||
2 | 1 | ||
diff --git a/shell/hush_test/hush-misc/assignment2.tests b/shell/hush_test/hush-misc/assignment2.tests new file mode 100755 index 000000000..540e01ec2 --- /dev/null +++ b/shell/hush_test/hush-misc/assignment2.tests | |||
@@ -0,0 +1,4 @@ | |||
1 | # This must not be interpreted as an assignment | ||
2 | a''=b true | ||
3 | echo $? | ||
4 | # (buglet: $? should be 127. it is currently 1) | ||