Subject: Re: bin/20185: recent change broke shell function replacement of builtins
To: None <dovich@tiac.net, netbsd-bugs@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: netbsd-bugs
Date: 02/03/2003 21:24:23
> Shell functions which wrap builtins work at most once.
> Once the wrapped builtin is invoked, the shell function is disabled.

The following patch should fix it, although is slightly brutal.
It stops builtins found by 'command xxx' from being hashed.

	David

Index: exec.c
===================================================================
RCS file: /cvsroot/src/bin/sh/exec.c,v
retrieving revision 1.35
diff -u -r1.35 exec.c
--- exec.c	2003/01/22 20:36:04	1.35
+++ exec.c	2003/02/03 21:19:09
@@ -593,7 +593,7 @@
 
 builtin_success:
 	INTOFF;
-	if (act & DO_ALTPATH)
+	if (act & (DO_ALTPATH | DO_NOFUNC))
 		cmdp = &loc_cmd;
 	else
 		cmdp = cmdlookup(name, 1);

-- 
David Laight: david@l8s.co.uk