diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-05-22 06:20:26 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-05-22 06:20:26 +0200 |
commit | e85248afa23434b78e48fe09b57eea5f6657410d (patch) | |
tree | 8e4ddbead7f630a6cf3f5e224fb05952818b76a2 /shell/hush_test | |
parent | 8a33679694b0fdf459d69868f85c081cab5687cb (diff) | |
download | busybox-w32-e85248afa23434b78e48fe09b57eea5f6657410d.tar.gz busybox-w32-e85248afa23434b78e48fe09b57eea5f6657410d.tar.bz2 busybox-w32-e85248afa23434b78e48fe09b57eea5f6657410d.zip |
hush: fix segfault in ${?:N:M}
function old new delta
expand_vars_to_list 2374 2409 +35
builtin_umask 132 133 +1
builtin_exit 47 48 +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 37/0) Total: 37 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush_test')
4 files changed, 31 insertions, 3 deletions
diff --git a/shell/hush_test/hush-vars/param_expand_alt.right b/shell/hush_test/hush-vars/param_expand_alt.right index 4d2197a5e..67f18d69c 100644 --- a/shell/hush_test/hush-vars/param_expand_alt.right +++ b/shell/hush_test/hush-vars/param_expand_alt.right | |||
@@ -1,6 +1,6 @@ | |||
1 | hush: syntax error: unterminated ${name} | 1 | hush: syntax error: unterminated ${name} |
2 | hush: syntax error: unterminated ${name} | 2 | hush: syntax error: unterminated ${name} |
3 | _0 _0 | 3 | __ __ |
4 | _ _ _ _ _ | 4 | _ _ _ _ _ |
5 | _aaaa _ _ _word _word | 5 | _aaaa _ _ _word _word |
6 | _ _ _ _ _ | 6 | _ _ _ _ _ |
diff --git a/shell/hush_test/hush-vars/param_expand_alt.tests b/shell/hush_test/hush-vars/param_expand_alt.tests index dcdca86d4..3b646b142 100755 --- a/shell/hush_test/hush-vars/param_expand_alt.tests +++ b/shell/hush_test/hush-vars/param_expand_alt.tests | |||
@@ -2,8 +2,8 @@ | |||
2 | "$THIS_SH" -c 'echo ${+} ; echo moo' | 2 | "$THIS_SH" -c 'echo ${+} ; echo moo' |
3 | "$THIS_SH" -c 'echo ${:+} ; echo moo' | 3 | "$THIS_SH" -c 'echo ${:+} ; echo moo' |
4 | 4 | ||
5 | # now some funky ones | 5 | # now some funky ones. (bash doesn't accept ${#+}) |
6 | echo _${#+} _${#:+} | 6 | echo _${#+}_ _${#:+}_ |
7 | 7 | ||
8 | # now some valid ones | 8 | # now some valid ones |
9 | set -- | 9 | set -- |
diff --git a/shell/hush_test/hush-vars/param_expand_bash_substring.right b/shell/hush_test/hush-vars/param_expand_bash_substring.right index 53b8836ff..2f4c51d06 100644 --- a/shell/hush_test/hush-vars/param_expand_bash_substring.right +++ b/shell/hush_test/hush-vars/param_expand_bash_substring.right | |||
@@ -39,6 +39,19 @@ f:1:2=|12| | |||
39 | f::2 =|01| | 39 | f::2 =|01| |
40 | f:1: =|| | 40 | f:1: =|| |
41 | f:: =|| | 41 | f:: =|| |
42 | Substrings from special vars | ||
43 | ? =|0| | ||
44 | ?:1 =|| | ||
45 | ?:1:2=|| | ||
46 | ?::2 =|0| | ||
47 | ?:1: =|| | ||
48 | ?:: =|| | ||
49 | # =|11| | ||
50 | #:1 =|1| | ||
51 | #:1:2=|1| | ||
52 | #::2 =|11| | ||
53 | #:1: =|| | ||
54 | #:: =|| | ||
42 | Substrings with expressions | 55 | Substrings with expressions |
43 | f =|01234567| | 56 | f =|01234567| |
44 | f:1+1:2+2 =|2345| | 57 | f:1+1:2+2 =|2345| |
diff --git a/shell/hush_test/hush-vars/param_expand_bash_substring.tests b/shell/hush_test/hush-vars/param_expand_bash_substring.tests index a80523add..5c9552dba 100755 --- a/shell/hush_test/hush-vars/param_expand_bash_substring.tests +++ b/shell/hush_test/hush-vars/param_expand_bash_substring.tests | |||
@@ -55,6 +55,21 @@ f=0123456789; echo "f::2 =|${f::2}|" | |||
55 | f=0123456789; echo "f:1: =|${f:1:}|" | 55 | f=0123456789; echo "f:1: =|${f:1:}|" |
56 | f=0123456789; echo "f:: =|${f::}|" | 56 | f=0123456789; echo "f:: =|${f::}|" |
57 | 57 | ||
58 | echo "Substrings from special vars" | ||
59 | echo '? '"=|$?|" | ||
60 | echo '?:1 '"=|${?:1}|" | ||
61 | echo '?:1:2'"=|${?:1:2}|" | ||
62 | echo '?::2 '"=|${?::2}|" | ||
63 | echo '?:1: '"=|${?:1:}|" | ||
64 | echo '?:: '"=|${?::}|" | ||
65 | set -- 1 2 3 4 5 6 7 8 9 10 11 | ||
66 | echo '# '"=|$#|" | ||
67 | echo '#:1 '"=|${#:1}|" | ||
68 | echo '#:1:2'"=|${#:1:2}|" | ||
69 | echo '#::2 '"=|${#::2}|" | ||
70 | echo '#:1: '"=|${#:1:}|" | ||
71 | echo '#:: '"=|${#::}|" | ||
72 | |||
58 | echo "Substrings with expressions" | 73 | echo "Substrings with expressions" |
59 | f=01234567; echo 'f '"=|$f|" | 74 | f=01234567; echo 'f '"=|$f|" |
60 | f=01234567; echo 'f:1+1:2+2 '"=|${f:1+1:2+2}|" | 75 | f=01234567; echo 'f:1+1:2+2 '"=|${f:1+1:2+2}|" |