From ea7d2f6ec0596789fc5b2e3fca3b7a602bfa2c26 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Tue, 3 Jan 2017 11:18:23 +0100 Subject: 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 Reported-by: Martijn Dekker Signed-off-by: Denys Vlasenko --- shell/hush_test/hush-misc/exitcode2.right | 4 ++++ shell/hush_test/hush-misc/exitcode2.tests | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 shell/hush_test/hush-misc/exitcode2.right create mode 100755 shell/hush_test/hush-misc/exitcode2.tests (limited to 'shell/hush_test') diff --git a/shell/hush_test/hush-misc/exitcode2.right b/shell/hush_test/hush-misc/exitcode2.right new file mode 100644 index 0000000..0a57b9b --- /dev/null +++ b/shell/hush_test/hush-misc/exitcode2.right @@ -0,0 +1,4 @@ +hush: syntax error: unexpected ) +Done:2 +hush: can't open 'does_not_exist': No such file or directory +Done:1 diff --git a/shell/hush_test/hush-misc/exitcode2.tests b/shell/hush_test/hush-misc/exitcode2.tests new file mode 100755 index 0000000..79a6ebd --- /dev/null +++ b/shell/hush_test/hush-misc/exitcode2.tests @@ -0,0 +1,12 @@ +# syntax error should return status 2 +cat >test.sh <