[PATCH] ash: fix error code regression

Denys Vlasenko vda.linux at googlemail.com
Tue Jan 3 10:25:52 UTC 2017


On Mon, Jan 2, 2017 at 1:50 PM, Ron Yorston <rmy at pobox.com> wrote:
> 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
...
> --- /dev/null
> +++ b/shell/ash_test/ash-misc/exitcode2.tests
> @@ -0,0 +1,13 @@
> +# syntax error should return status 2
> +cat >test.sh <<EOF
> +)
> +EOF
> +chmod +x test.sh
> +./test.sh

Will this run test.sh in _the shell being tested_
(as opposed to system shell)?

I changed the above to "$THIS_SH ./test.sh" to be sure.

BTW, this testcase also fails in hush:
exitcode which should be 2 is 1 there.

Recently test directories for ash and hush were "cross-pollinated"
to have similarly-named subdirs and tests. Let's try keeping
them this way.

Applied, thanks.


More information about the busybox mailing list