ash: add tests for failures of the exec and command builtins
The exec builtin should return an exit status of 127 if the command can't be found. It doesn't: it returns 2. If the command builtin is used to source a script that runs a second script that doesn't exist ash should issue an error. Instead it seg faults. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
ace833028f
commit
e939856c87
2
shell/ash_test/ash-misc/command2.right
Normal file
2
shell/ash_test/ash-misc/command2.right
Normal file
@ -0,0 +1,2 @@
|
||||
test1
|
||||
./command2.tests: ./test1.sh: line 1: ./test2.sh: Permission denied
|
6
shell/ash_test/ash-misc/command2.tests
Executable file
6
shell/ash_test/ash-misc/command2.tests
Executable file
@ -0,0 +1,6 @@
|
||||
echo "echo test1; ./test2.sh" >test1.sh
|
||||
echo "echo test2" >test2.sh
|
||||
|
||||
command . ./test1.sh
|
||||
|
||||
rm -f test1.sh test2.sh
|
2
shell/ash_test/ash-misc/exec.right
Normal file
2
shell/ash_test/ash-misc/exec.right
Normal file
@ -0,0 +1,2 @@
|
||||
./exec.tests: exec: line 2: ./test1.sh: not found
|
||||
127
|
3
shell/ash_test/ash-misc/exec.tests
Executable file
3
shell/ash_test/ash-misc/exec.tests
Executable file
@ -0,0 +1,3 @@
|
||||
rm -f test1.sh
|
||||
(exec ./test1.sh)
|
||||
echo $?
|
Loading…
Reference in New Issue
Block a user