Date: Thu, 31 Dec 2009 17:44:24 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r201344 - in head: bin/sh tools/regression/bin/sh/builtins Message-ID: <200912311744.nBVHiOFx063853@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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))
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912311744.nBVHiOFx063853>