diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2021-09-07 18:16:45 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-09-07 18:16:45 +0200 |
commit | 64aa86b720641cb50be9636e6c20d4dbbea6fed0 (patch) | |
tree | 831e13eec7b361f1f9b37a4359594969eee0050c /shell | |
parent | d6c9cbc0727cc3875672ae280ec129514a9d8594 (diff) | |
download | busybox-w32-64aa86b720641cb50be9636e6c20d4dbbea6fed0.tar.gz busybox-w32-64aa86b720641cb50be9636e6c20d4dbbea6fed0.tar.bz2 busybox-w32-64aa86b720641cb50be9636e6c20d4dbbea6fed0.zip |
ash: LINENO starts from 0 in -c SCRIPT mode
The var_LINENO3.tests fails for hush: it does start from 0, but does not increment.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 2 | ||||
-rw-r--r-- | shell/ash_test/ash-misc/control_char3.right | 2 | ||||
-rw-r--r-- | shell/ash_test/ash-misc/control_char4.right | 2 | ||||
-rw-r--r-- | shell/ash_test/ash-misc/shift1.right | 2 | ||||
-rw-r--r-- | shell/ash_test/ash-misc/tickquote1.right | 2 | ||||
-rw-r--r-- | shell/ash_test/ash-parsing/groups_and_keywords2.right | 2 | ||||
-rw-r--r-- | shell/ash_test/ash-psubst/emptytick.right | 4 | ||||
-rw-r--r-- | shell/ash_test/ash-vars/param_expand_alt.right | 4 | ||||
-rw-r--r-- | shell/ash_test/ash-vars/param_expand_assign.right | 14 | ||||
-rw-r--r-- | shell/ash_test/ash-vars/param_expand_bash_substring.right | 10 | ||||
-rw-r--r-- | shell/ash_test/ash-vars/param_expand_default.right | 2 | ||||
-rw-r--r-- | shell/ash_test/ash-vars/param_expand_indicate_error.right | 32 | ||||
-rw-r--r-- | shell/ash_test/ash-vars/var6.right | 4 | ||||
-rw-r--r-- | shell/ash_test/ash-vars/var_LINENO3.right | 2 | ||||
-rwxr-xr-x | shell/ash_test/ash-vars/var_LINENO3.tests | 2 | ||||
-rw-r--r-- | shell/hush_test/hush-vars/var_LINENO3.right | 2 | ||||
-rwxr-xr-x | shell/hush_test/hush-vars/var_LINENO3.tests | 2 |
17 files changed, 49 insertions, 41 deletions
diff --git a/shell/ash.c b/shell/ash.c index 79fa3adba..35dbb2f28 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -14698,7 +14698,7 @@ int ash_main(int argc UNUSED_PARAM, char **argv) | |||
14698 | // ^^ not necessary since now we special-case fd 0 | 14698 | // ^^ not necessary since now we special-case fd 0 |
14699 | // in save_fd_on_redirect() | 14699 | // in save_fd_on_redirect() |
14700 | 14700 | ||
14701 | lineno = 1; | 14701 | lineno = 0; // bash compat |
14702 | // dash: evalstring(minusc, sflag ? 0 : EV_EXIT); | 14702 | // dash: evalstring(minusc, sflag ? 0 : EV_EXIT); |
14703 | // The above makes | 14703 | // The above makes |
14704 | // ash -sc 'echo $-' | 14704 | // ash -sc 'echo $-' |
diff --git a/shell/ash_test/ash-misc/control_char3.right b/shell/ash_test/ash-misc/control_char3.right index 283e02cbb..654005d24 100644 --- a/shell/ash_test/ash-misc/control_char3.right +++ b/shell/ash_test/ash-misc/control_char3.right | |||
@@ -1 +1 @@ | |||
SHELL: line 1: : not found | SHELL: line 0: : not found | ||
diff --git a/shell/ash_test/ash-misc/control_char4.right b/shell/ash_test/ash-misc/control_char4.right index 2bf18e684..ec9d5fc98 100644 --- a/shell/ash_test/ash-misc/control_char4.right +++ b/shell/ash_test/ash-misc/control_char4.right | |||
@@ -1 +1 @@ | |||
SHELL: line 1: -: not found | SHELL: line 0: -: not found | ||
diff --git a/shell/ash_test/ash-misc/shift1.right b/shell/ash_test/ash-misc/shift1.right index b53453c3a..fdba79fd3 100644 --- a/shell/ash_test/ash-misc/shift1.right +++ b/shell/ash_test/ash-misc/shift1.right | |||
@@ -1,5 +1,5 @@ | |||
1 | 2 3 4 | 1 | 2 3 4 |
2 | 0: shift: line 1: Illegal number: -1 | 2 | 0: shift: line 0: Illegal number: -1 |
3 | 1 2 3 4 | 3 | 1 2 3 4 |
4 | 2 3 4 | 4 | 2 3 4 |
5 | 3 4 | 5 | 3 4 |
diff --git a/shell/ash_test/ash-misc/tickquote1.right b/shell/ash_test/ash-misc/tickquote1.right index 2e661bfe3..e55a31c2d 100644 --- a/shell/ash_test/ash-misc/tickquote1.right +++ b/shell/ash_test/ash-misc/tickquote1.right | |||
@@ -1 +1 @@ | |||
./tickquote1.tests: line 1: syntax error: unterminated quoted string | ./tickquote1.tests: line 0: syntax error: unterminated quoted string | ||
diff --git a/shell/ash_test/ash-parsing/groups_and_keywords2.right b/shell/ash_test/ash-parsing/groups_and_keywords2.right index 3fcbeb662..2ce38fe6e 100644 --- a/shell/ash_test/ash-parsing/groups_and_keywords2.right +++ b/shell/ash_test/ash-parsing/groups_and_keywords2.right | |||
@@ -1,3 +1,3 @@ | |||
1 | ./groups_and_keywords2.tests: eval: line 1: syntax error: unexpected ")" | 1 | ./groups_and_keywords2.tests: eval: line 2: syntax error: unexpected ")" |
2 | Fail:2 | 2 | Fail:2 |
3 | ./groups_and_keywords2.tests: line 8: syntax error: unexpected ")" | 3 | ./groups_and_keywords2.tests: line 8: syntax error: unexpected ")" |
diff --git a/shell/ash_test/ash-psubst/emptytick.right b/shell/ash_test/ash-psubst/emptytick.right index 459c4f735..8fe9839ca 100644 --- a/shell/ash_test/ash-psubst/emptytick.right +++ b/shell/ash_test/ash-psubst/emptytick.right | |||
@@ -1,8 +1,8 @@ | |||
1 | 0 | 1 | 0 |
2 | 0 | 2 | 0 |
3 | ./emptytick.tests: line 1: : Permission denied | 3 | ./emptytick.tests: line 2: : Permission denied |
4 | 127 | 4 | 127 |
5 | ./emptytick.tests: line 1: : Permission denied | 5 | ./emptytick.tests: line 3: : Permission denied |
6 | 127 | 6 | 127 |
7 | 0 | 7 | 0 |
8 | 0 | 8 | 0 |
diff --git a/shell/ash_test/ash-vars/param_expand_alt.right b/shell/ash_test/ash-vars/param_expand_alt.right index 1303f8064..d10f1206f 100644 --- a/shell/ash_test/ash-vars/param_expand_alt.right +++ b/shell/ash_test/ash-vars/param_expand_alt.right | |||
@@ -1,5 +1,5 @@ | |||
1 | SHELL: line 1: syntax error: bad substitution | 1 | SHELL: line 0: syntax error: bad substitution |
2 | SHELL: line 1: syntax error: bad substitution | 2 | SHELL: line 0: syntax error: bad substitution |
3 | __ | 3 | __ |
4 | _z_ _z_ | 4 | _z_ _z_ |
5 | _ _ _ _ _ | 5 | _ _ _ _ _ |
diff --git a/shell/ash_test/ash-vars/param_expand_assign.right b/shell/ash_test/ash-vars/param_expand_assign.right index 6e9ea1379..52eaef9f8 100644 --- a/shell/ash_test/ash-vars/param_expand_assign.right +++ b/shell/ash_test/ash-vars/param_expand_assign.right | |||
@@ -1,11 +1,11 @@ | |||
1 | SHELL: line 1: syntax error: bad substitution | 1 | SHELL: line 0: syntax error: bad substitution |
2 | SHELL: line 1: syntax error: bad substitution | 2 | SHELL: line 0: syntax error: bad substitution |
3 | SHELL: line 1: syntax error: bad substitution | 3 | SHELL: line 0: syntax error: bad substitution |
4 | 0 | 4 | 0 |
5 | SHELL: line 1: 1: bad variable name | 5 | SHELL: line 0: 1: bad variable name |
6 | SHELL: line 1: 1: bad variable name | 6 | SHELL: line 0: 1: bad variable name |
7 | SHELL: line 1: 1: bad variable name | 7 | SHELL: line 0: 1: bad variable name |
8 | SHELL: line 1: 1: bad variable name | 8 | SHELL: line 0: 1: bad variable name |
9 | _aa | 9 | _aa |
10 | _aa | 10 | _aa |
11 | _aa | 11 | _aa |
diff --git a/shell/ash_test/ash-vars/param_expand_bash_substring.right b/shell/ash_test/ash-vars/param_expand_bash_substring.right index 687dd9002..22a0b2881 100644 --- a/shell/ash_test/ash-vars/param_expand_bash_substring.right +++ b/shell/ash_test/ash-vars/param_expand_bash_substring.right | |||
@@ -1,8 +1,8 @@ | |||
1 | SHELL: line 1: syntax error: bad substitution | 1 | SHELL: line 0: syntax error: bad substitution |
2 | SHELL: line 1: syntax error: bad substitution | 2 | SHELL: line 0: syntax error: bad substitution |
3 | SHELL: line 1: syntax error: bad substitution | 3 | SHELL: line 0: syntax error: bad substitution |
4 | SHELL: line 1: syntax error: bad substitution | 4 | SHELL: line 0: syntax error: bad substitution |
5 | SHELL: line 1: syntax error: missing '}' | 5 | SHELL: line 0: syntax error: missing '}' |
6 | 0 | 6 | 0 |
7 | 1 =|| | 7 | 1 =|| |
8 | 1:1 =|| | 8 | 1:1 =|| |
diff --git a/shell/ash_test/ash-vars/param_expand_default.right b/shell/ash_test/ash-vars/param_expand_default.right index 7a42f67e8..0852105ca 100644 --- a/shell/ash_test/ash-vars/param_expand_default.right +++ b/shell/ash_test/ash-vars/param_expand_default.right | |||
@@ -1,4 +1,4 @@ | |||
1 | SHELL: line 1: syntax error: bad substitution | 1 | SHELL: line 0: syntax error: bad substitution |
2 | _0 _0 | 2 | _0 _0 |
3 | _ _ _ _word _word | 3 | _ _ _ _word _word |
4 | _aaaa _aaaa _aaaa _aaaa _aaaa | 4 | _aaaa _aaaa _aaaa _aaaa _aaaa |
diff --git a/shell/ash_test/ash-vars/param_expand_indicate_error.right b/shell/ash_test/ash-vars/param_expand_indicate_error.right index 33afacee0..53ea07181 100644 --- a/shell/ash_test/ash-vars/param_expand_indicate_error.right +++ b/shell/ash_test/ash-vars/param_expand_indicate_error.right | |||
@@ -1,14 +1,14 @@ | |||
1 | SHELL: line 1: syntax error: bad substitution | 1 | SHELL: line 0: syntax error: bad substitution |
2 | 1 | 2 | 1 |
3 | 0 | 3 | 0 |
4 | ==== | 4 | ==== |
5 | _ | 5 | _ |
6 | SHELL: line 1: 1: parameter not set | 6 | SHELL: line 0: 1: parameter not set |
7 | SHELL: line 1: 1: parameter not set or null | 7 | SHELL: line 0: 1: parameter not set or null |
8 | SHELL: line 1: 1: message1 | 8 | SHELL: line 0: 1: message1 |
9 | SHELL: line 1: 1: message1 | 9 | SHELL: line 0: 1: message1 |
10 | SHELL: line 1: 1: unset! | 10 | SHELL: line 0: 1: unset! |
11 | SHELL: line 1: 1: null or unset! | 11 | SHELL: line 0: 1: null or unset! |
12 | ==== | 12 | ==== |
13 | _aaaa | 13 | _aaaa |
14 | _aaaa | 14 | _aaaa |
@@ -19,20 +19,20 @@ _aaaa | |||
19 | _aaaa | 19 | _aaaa |
20 | ==== | 20 | ==== |
21 | _ | 21 | _ |
22 | SHELL: line 1: f: parameter not set | 22 | SHELL: line 0: f: parameter not set |
23 | SHELL: line 1: f: parameter not set or null | 23 | SHELL: line 0: f: parameter not set or null |
24 | SHELL: line 1: f: message3 | 24 | SHELL: line 0: f: message3 |
25 | SHELL: line 1: f: message3 | 25 | SHELL: line 0: f: message3 |
26 | SHELL: line 1: f: unset! | 26 | SHELL: line 0: f: unset! |
27 | SHELL: line 1: f: null or unset! | 27 | SHELL: line 0: f: null or unset! |
28 | ==== | 28 | ==== |
29 | _ | 29 | _ |
30 | _ | 30 | _ |
31 | SHELL: line 1: f: parameter not set or null | 31 | SHELL: line 0: f: parameter not set or null |
32 | _ | 32 | _ |
33 | SHELL: line 1: f: message4 | 33 | SHELL: line 0: f: message4 |
34 | _ | 34 | _ |
35 | SHELL: line 1: f: null or unset! | 35 | SHELL: line 0: f: null or unset! |
36 | ==== | 36 | ==== |
37 | _fff | 37 | _fff |
38 | _fff | 38 | _fff |
diff --git a/shell/ash_test/ash-vars/var6.right b/shell/ash_test/ash-vars/var6.right index b37417fa1..e83f7b5eb 100644 --- a/shell/ash_test/ash-vars/var6.right +++ b/shell/ash_test/ash-vars/var6.right | |||
@@ -1,2 +1,2 @@ | |||
1 | SHELL: line 1: syntax error: bad substitution | 1 | SHELL: line 0: syntax error: bad substitution |
2 | SHELL: line 1: syntax error: bad substitution | 2 | SHELL: line 0: syntax error: bad substitution |
diff --git a/shell/ash_test/ash-vars/var_LINENO3.right b/shell/ash_test/ash-vars/var_LINENO3.right new file mode 100644 index 000000000..198c3cc99 --- /dev/null +++ b/shell/ash_test/ash-vars/var_LINENO3.right | |||
@@ -0,0 +1,2 @@ | |||
1 | LINENO starts from 0 in -c | ||
2 | and increments on next line: 1 | ||
diff --git a/shell/ash_test/ash-vars/var_LINENO3.tests b/shell/ash_test/ash-vars/var_LINENO3.tests new file mode 100755 index 000000000..4502edfe0 --- /dev/null +++ b/shell/ash_test/ash-vars/var_LINENO3.tests | |||
@@ -0,0 +1,2 @@ | |||
1 | $THIS_SH -c 'echo "LINENO starts from $LINENO in -c" | ||
2 | echo "and increments on next line: $LINENO"' | ||
diff --git a/shell/hush_test/hush-vars/var_LINENO3.right b/shell/hush_test/hush-vars/var_LINENO3.right new file mode 100644 index 000000000..198c3cc99 --- /dev/null +++ b/shell/hush_test/hush-vars/var_LINENO3.right | |||
@@ -0,0 +1,2 @@ | |||
1 | LINENO starts from 0 in -c | ||
2 | and increments on next line: 1 | ||
diff --git a/shell/hush_test/hush-vars/var_LINENO3.tests b/shell/hush_test/hush-vars/var_LINENO3.tests new file mode 100755 index 000000000..4502edfe0 --- /dev/null +++ b/shell/hush_test/hush-vars/var_LINENO3.tests | |||
@@ -0,0 +1,2 @@ | |||
1 | $THIS_SH -c 'echo "LINENO starts from $LINENO in -c" | ||
2 | echo "and increments on next line: $LINENO"' | ||