svn commit: r201344 - in head: bin/sh
tools/regression/bin/sh/builtins
Jilles Tjoelker
jilles at FreeBSD.org
Thu Dec 31 17:44:24 UTC 2009
Author: jilles
Date: Thu Dec 31 17:44:24 2009
New Revision: 201344
URL: http://svn.freebsd.org/changeset/base/201344
Log:
sh: Use PATH= assignment in type.
Example:
PATH=/var/empty; PATH=/bin type ls
Added:
head/tools/regression/bin/sh/builtins/type2.0 (contents, props changed)
Modified:
head/bin/sh/exec.c
Modified: head/bin/sh/exec.c
==============================================================================
--- head/bin/sh/exec.c Thu Dec 31 16:13:33 2009 (r201343)
+++ head/bin/sh/exec.c Thu Dec 31 17:44:24 2009 (r201344)
@@ -838,5 +838,5 @@ typecmd_impl(int argc, char **argv, int
int
typecmd(int argc, char **argv)
{
- return typecmd_impl(argc, argv, TYPECMD_TYPE, pathval());
+ return typecmd_impl(argc, argv, TYPECMD_TYPE, bltinlookup("PATH", 1));
}
Added: head/tools/regression/bin/sh/builtins/type2.0
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/tools/regression/bin/sh/builtins/type2.0 Thu Dec 31 17:44:24 2009 (r201344)
@@ -0,0 +1,26 @@
+# $FreeBSD$
+
+failures=0
+
+check() {
+ if ! eval "$*"; then
+ echo "Failed: $*"
+ : $((failures += 1))
+ fi
+}
+
+check 'PATH=/libexec type ld-elf.so.1 >/dev/null'
+check '! PATH=/libexec type ls 2>/dev/null'
+
+PATH=/libexec:$PATH
+
+check 'type ld-elf.so.1 >/dev/null'
+
+PATH=/libexec
+
+check 'type ld-elf.so.1 >/dev/null'
+check '! type ls 2>/dev/null'
+check 'PATH=/bin type ls >/dev/null'
+check '! PATH=/bin type ld-elf.so.1 2>/dev/null'
+
+exit $((failures > 0))
More information about the svn-src-head
mailing list