ash: fix error code regression
The commit 'ash,hush: set exit code 127 in "sh /does/not/exist" case' only partly implemented the dash commit '[ERROR] Allow the originator of EXERROR to set the exit status'. This resulted in incorrect error codes for a syntax error: $ ) $ echo $? 0 or a redirection error for a special builtin: $ rm -f xxx $ eval cat <xxx $ echo $? 0 Signed-off-by: Ron Yorston <rmy@pobox.com> Reported-by: Martijn Dekker <martijn@inlv.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
committed by
Denys Vlasenko
parent
bddbeb82bf
commit
ea7d2f6ec0
12
shell/ash_test/ash-misc/exitcode2.tests
Executable file
12
shell/ash_test/ash-misc/exitcode2.tests
Executable file
@ -0,0 +1,12 @@
|
||||
# syntax error should return status 2
|
||||
cat >test.sh <<EOF
|
||||
)
|
||||
EOF
|
||||
chmod +x test.sh
|
||||
$THIS_SH ./test.sh
|
||||
echo Done:$?
|
||||
rm -f test.sh
|
||||
|
||||
# redirection error with special builtin should return status 1
|
||||
(eval cat <does_not_exist)
|
||||
echo Done:$?
|
Reference in New Issue
Block a user