summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2009-10-06 22:00:14 +0000
committerjilles <jilles@FreeBSD.org>2009-10-06 22:00:14 +0000
commitfab15b104fd8b8032114bca20d5768c8af19156d (patch)
tree1f4527ca00ce718b312864a2fb301567490f5fa0 /tools
parent3665e257c1063729cb55852b1e0686ab8301f7d1 (diff)
downloadFreeBSD-src-fab15b104fd8b8032114bca20d5768c8af19156d.zip
FreeBSD-src-fab15b104fd8b8032114bca20d5768c8af19156d.tar.gz
sh: Send the "xyz: not found" message to redirected fd 2.
This also fixes that trying to execute a non-regular file with a command name without '/' returns 127 instead of 126. The fix is rather simplistic: treat CMDUNKNOWN as if the command were found as an external program. The resulting fork is a bit wasteful but executing unknown commands should not be very frequent. PR: bin/137659
Diffstat (limited to 'tools')
-rw-r--r--tools/regression/bin/sh/execution/unknown1.029
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/regression/bin/sh/execution/unknown1.0 b/tools/regression/bin/sh/execution/unknown1.0
new file mode 100644
index 0000000..45f541e
--- /dev/null
+++ b/tools/regression/bin/sh/execution/unknown1.0
@@ -0,0 +1,29 @@
+# $FreeBSD$
+
+nosuchtool 2>/dev/null
+[ $? -ne 127 ] && exit 1
+/var/empty/nosuchtool 2>/dev/null
+[ $? -ne 127 ] && exit 1
+(nosuchtool) 2>/dev/null
+[ $? -ne 127 ] && exit 1
+(/var/empty/nosuchtool) 2>/dev/null
+[ $? -ne 127 ] && exit 1
+/ 2>/dev/null
+[ $? -ne 126 ] && exit 1
+PATH=/usr bin 2>/dev/null
+[ $? -ne 126 ] && exit 1
+
+dummy=$(nosuchtool 2>/dev/null)
+[ $? -ne 127 ] && exit 1
+dummy=$(/var/empty/nosuchtool 2>/dev/null)
+[ $? -ne 127 ] && exit 1
+dummy=$( (nosuchtool) 2>/dev/null)
+[ $? -ne 127 ] && exit 1
+dummy=$( (/var/empty/nosuchtool) 2>/dev/null)
+[ $? -ne 127 ] && exit 1
+dummy=$(/ 2>/dev/null)
+[ $? -ne 126 ] && exit 1
+dummy=$(PATH=/usr bin 2>/dev/null)
+[ $? -ne 126 ] && exit 1
+
+exit 0
OpenPOWER on IntegriCloud