[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH 1/3] ash: add tests for failures of the exec and command builtins
From:       Ron Yorston <rmy () pobox ! com>
Date:       2015-10-30 19:05:55
Message-ID: 5633bf93.VMZ/m6p5RL2Zwaz1%rmy () pobox ! com
[Download RAW message or body]

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>
---
 shell/ash_test/ash-misc/command2.right | 2 ++
 shell/ash_test/ash-misc/command2.tests | 6 ++++++
 shell/ash_test/ash-misc/exec.right     | 2 ++
 shell/ash_test/ash-misc/exec.tests     | 3 +++
 4 files changed, 13 insertions(+)
 create mode 100644 shell/ash_test/ash-misc/command2.right
 create mode 100755 shell/ash_test/ash-misc/command2.tests
 create mode 100644 shell/ash_test/ash-misc/exec.right
 create mode 100755 shell/ash_test/ash-misc/exec.tests

diff --git a/shell/ash_test/ash-misc/command2.right b/shell/ash_test/ash-misc/command2.right
new file mode 100644
index 0000000..8d2165f
--- /dev/null
+++ b/shell/ash_test/ash-misc/command2.right
@@ -0,0 +1,2 @@
+test1
+./command2.tests: ./test1.sh: line 1: ./test2.sh: Permission denied
diff --git a/shell/ash_test/ash-misc/command2.tests b/shell/ash_test/ash-misc/command2.tests
new file mode 100755
index 0000000..9d9de9a
--- /dev/null
+++ b/shell/ash_test/ash-misc/command2.tests
@@ -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
diff --git a/shell/ash_test/ash-misc/exec.right b/shell/ash_test/ash-misc/exec.right
new file mode 100644
index 0000000..1741a38
--- /dev/null
+++ b/shell/ash_test/ash-misc/exec.right
@@ -0,0 +1,2 @@
+./exec.tests: exec: line 2: ./test1.sh: not found
+127
diff --git a/shell/ash_test/ash-misc/exec.tests b/shell/ash_test/ash-misc/exec.tests
new file mode 100755
index 0000000..624915d
--- /dev/null
+++ b/shell/ash_test/ash-misc/exec.tests
@@ -0,0 +1,3 @@
+rm -f test1.sh
+(exec ./test1.sh)
+echo $?
-- 
2.4.3

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic