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>
This commit is contained in:
Denys Vlasenko 2021-09-07 18:16:45 +02:00
parent d6c9cbc072
commit 64aa86b720
17 changed files with 49 additions and 41 deletions

View File

@ -14698,7 +14698,7 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
// ^^ not necessary since now we special-case fd 0 // ^^ not necessary since now we special-case fd 0
// in save_fd_on_redirect() // in save_fd_on_redirect()
lineno = 1; lineno = 0; // bash compat
// dash: evalstring(minusc, sflag ? 0 : EV_EXIT); // dash: evalstring(minusc, sflag ? 0 : EV_EXIT);
// The above makes // The above makes
// ash -sc 'echo $-' // ash -sc 'echo $-'

View File

@ -1 +1 @@
SHELL: line 1: : not found SHELL: line 0: : not found

View File

@ -1 +1 @@
SHELL: line 1: -: not found SHELL: line 0: -: not found

View File

@ -1,5 +1,5 @@
2 3 4 2 3 4
0: shift: line 1: Illegal number: -1 0: shift: line 0: Illegal number: -1
1 2 3 4 1 2 3 4
2 3 4 2 3 4
3 4 3 4

View File

@ -1 +1 @@
./tickquote1.tests: line 1: syntax error: unterminated quoted string ./tickquote1.tests: line 0: syntax error: unterminated quoted string

View File

@ -1,3 +1,3 @@
./groups_and_keywords2.tests: eval: line 1: syntax error: unexpected ")" ./groups_and_keywords2.tests: eval: line 2: syntax error: unexpected ")"
Fail:2 Fail:2
./groups_and_keywords2.tests: line 8: syntax error: unexpected ")" ./groups_and_keywords2.tests: line 8: syntax error: unexpected ")"

View File

@ -1,8 +1,8 @@
0 0
0 0
./emptytick.tests: line 1: : Permission denied ./emptytick.tests: line 2: : Permission denied
127 127
./emptytick.tests: line 1: : Permission denied ./emptytick.tests: line 3: : Permission denied
127 127
0 0
0 0

View File

@ -1,5 +1,5 @@
SHELL: line 1: syntax error: bad substitution SHELL: line 0: syntax error: bad substitution
SHELL: line 1: syntax error: bad substitution SHELL: line 0: syntax error: bad substitution
__ __
_z_ _z_ _z_ _z_
_ _ _ _ _ _ _ _ _ _

View File

@ -1,11 +1,11 @@
SHELL: line 1: syntax error: bad substitution SHELL: line 0: syntax error: bad substitution
SHELL: line 1: syntax error: bad substitution SHELL: line 0: syntax error: bad substitution
SHELL: line 1: syntax error: bad substitution SHELL: line 0: syntax error: bad substitution
0 0
SHELL: line 1: 1: bad variable name SHELL: line 0: 1: bad variable name
SHELL: line 1: 1: bad variable name SHELL: line 0: 1: bad variable name
SHELL: line 1: 1: bad variable name SHELL: line 0: 1: bad variable name
SHELL: line 1: 1: bad variable name SHELL: line 0: 1: bad variable name
_aa _aa
_aa _aa
_aa _aa

View File

@ -1,8 +1,8 @@
SHELL: line 1: syntax error: bad substitution SHELL: line 0: syntax error: bad substitution
SHELL: line 1: syntax error: bad substitution SHELL: line 0: syntax error: bad substitution
SHELL: line 1: syntax error: bad substitution SHELL: line 0: syntax error: bad substitution
SHELL: line 1: syntax error: bad substitution SHELL: line 0: syntax error: bad substitution
SHELL: line 1: syntax error: missing '}' SHELL: line 0: syntax error: missing '}'
0 0
1 =|| 1 =||
1:1 =|| 1:1 =||

View File

@ -1,4 +1,4 @@
SHELL: line 1: syntax error: bad substitution SHELL: line 0: syntax error: bad substitution
_0 _0 _0 _0
_ _ _ _word _word _ _ _ _word _word
_aaaa _aaaa _aaaa _aaaa _aaaa _aaaa _aaaa _aaaa _aaaa _aaaa

View File

@ -1,14 +1,14 @@
SHELL: line 1: syntax error: bad substitution SHELL: line 0: syntax error: bad substitution
1 1
0 0
==== ====
_ _
SHELL: line 1: 1: parameter not set SHELL: line 0: 1: parameter not set
SHELL: line 1: 1: parameter not set or null SHELL: line 0: 1: parameter not set or null
SHELL: line 1: 1: message1 SHELL: line 0: 1: message1
SHELL: line 1: 1: message1 SHELL: line 0: 1: message1
SHELL: line 1: 1: unset! SHELL: line 0: 1: unset!
SHELL: line 1: 1: null or unset! SHELL: line 0: 1: null or unset!
==== ====
_aaaa _aaaa
_aaaa _aaaa
@ -19,20 +19,20 @@ _aaaa
_aaaa _aaaa
==== ====
_ _
SHELL: line 1: f: parameter not set SHELL: line 0: f: parameter not set
SHELL: line 1: f: parameter not set or null SHELL: line 0: f: parameter not set or null
SHELL: line 1: f: message3 SHELL: line 0: f: message3
SHELL: line 1: f: message3 SHELL: line 0: f: message3
SHELL: line 1: f: unset! SHELL: line 0: f: unset!
SHELL: line 1: f: null or unset! SHELL: line 0: f: null or unset!
==== ====
_ _
_ _
SHELL: line 1: f: parameter not set or null SHELL: line 0: f: parameter not set or null
_ _
SHELL: line 1: f: message4 SHELL: line 0: f: message4
_ _
SHELL: line 1: f: null or unset! SHELL: line 0: f: null or unset!
==== ====
_fff _fff
_fff _fff

View File

@ -1,2 +1,2 @@
SHELL: line 1: syntax error: bad substitution SHELL: line 0: syntax error: bad substitution
SHELL: line 1: syntax error: bad substitution SHELL: line 0: syntax error: bad substitution

View File

@ -0,0 +1,2 @@
LINENO starts from 0 in -c
and increments on next line: 1

View File

@ -0,0 +1,2 @@
$THIS_SH -c 'echo "LINENO starts from $LINENO in -c"
echo "and increments on next line: $LINENO"'

View File

@ -0,0 +1,2 @@
LINENO starts from 0 in -c
and increments on next line: 1

View File

@ -0,0 +1,2 @@
$THIS_SH -c 'echo "LINENO starts from $LINENO in -c"
echo "and increments on next line: $LINENO"'