From owner-svn-src-all@FreeBSD.ORG Sat Feb 5 14:01:46 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92E751065672; Sat, 5 Feb 2011 14:01:46 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 819E88FC21; Sat, 5 Feb 2011 14:01:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p15E1klm029782; Sat, 5 Feb 2011 14:01:46 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p15E1kgm029779; Sat, 5 Feb 2011 14:01:46 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201102051401.p15E1kgm029779@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 5 Feb 2011 14:01:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218323 - in head: bin/sh tools/regression/bin/sh/execution X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Feb 2011 14:01:46 -0000 Author: jilles Date: Sat Feb 5 14:01:46 2011 New Revision: 218323 URL: http://svn.freebsd.org/changeset/base/218323 Log: sh: Forget all cached command locations on any PATH change. POSIX requires this and it is simpler than the previous code that remembered command locations when appending directories to PATH. In particular, PATH=$PATH is no longer a no-op but discards all cached command locations. Added: head/tools/regression/bin/sh/execution/hash1.0 (contents, props changed) Modified: head/bin/sh/exec.c Modified: head/bin/sh/exec.c ============================================================================== --- head/bin/sh/exec.c Sat Feb 5 13:07:35 2011 (r218322) +++ head/bin/sh/exec.c Sat Feb 5 14:01:46 2011 (r218323) @@ -494,30 +494,7 @@ hashcd(void) void changepath(const char *newval) { - const char *old, *new; - int idx; - int firstchange; - - old = pathval(); - new = newval; - firstchange = 9999; /* assume no change */ - idx = 0; - for (;;) { - if (*old != *new) { - firstchange = idx; - if ((*old == '\0' && *new == ':') - || (*old == ':' && *new == '\0')) - firstchange++; - old = new; /* ignore subsequent differences */ - } - if (*new == '\0') - break; - if (*new == ':') { - idx++; - } - new++, old++; - } - clearcmdentry(firstchange); + clearcmdentry(0); } Added: head/tools/regression/bin/sh/execution/hash1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/hash1.0 Sat Feb 5 14:01:46 2011 (r218323) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +T=`mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX"` || exit +trap 'rm -rf "${T}"' 0 +PATH=$T:$PATH +ls -ld . >/dev/null +cat <"$T/ls" +: +EOF +chmod 755 "$T/ls" +PATH=$PATH +ls -ld .