Subject: bin/20185: recent change broke shell function replacement of builtins
To: None <gnats-bugs@gnats.netbsd.org>
From: None <dovich@tiac.net>
List: netbsd-bugs
Date: 02/03/2003 12:03:05
>Number:         20185
>Category:       bin
>Synopsis:       recent change broke shell function replacement of builtins
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 03 12:04:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Steven J. Dovich
>Release:        NetBSD-current/i386
>Organization:
>Environment:
NetBSD lethe.tiac.net 1.6N NetBSD 1.6N (LETHE) #30: Sun Feb  2 21:52:05 EST 2003     dovich@lethe.tiac.net:/home/netbsd/src/netbsd/sys/arch/i386/compile/LETHE i386

>Description:
Shell functions which wrap builtins work at most once.
Once the wrapped builtin is invoked, the shell function is disabled.

It appears that the restructured find_command() code clobbers the
cmdtype member of the hash entry in an inappropriate case. I think
this may have crept in with the changes of Jan 22, 2003.
>How-To-Repeat:
#!/bin/sh

cd() {
	command cd $*
	echo "wrapped cd [new working directory=$(pwd)]"
}

type -V cd
cd .		# shell function executes
type -V cd
cd .		# builtin executes now that wrapping function is lost
type -V cd

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted: