Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: 4.1.0: `builtin' with disabled builtin.



It used to be possible to get round the fact that a builtin was disabled by
putting `builtin' in front of it, which somehow disappeared when I wasn't
looking.  I think the old behaviour is useful and harmless.  This is based
on my assumption that `disable' is to stop a builtin polluting the general
namespace, not to stop anyone executing it who needs it.  Does anyone
have any worries about this?

Index: Doc/Zsh/builtins.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/builtins.yo,v
retrieving revision 1.30
diff -u -r1.30 builtins.yo
--- Doc/Zsh/builtins.yo	2001/06/14 09:49:02	1.30
+++ Doc/Zsh/builtins.yo	2001/06/15 22:01:17
@@ -130,7 +130,8 @@
 )
 findex(builtin)
 item(tt(builtin) var(name) [ var(args) ... ])(
-Executes the builtin var(name), with the given var(args).
+Executes the builtin var(name), with the given var(args).  This can
+be used even if var(name) has been disabled.
 )
 alias(bye)(exit)
 module(cap)(zsh/cap)
Index: Src/exec.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.28
diff -u -r1.28 exec.c
--- Src/exec.c	2001/05/28 09:00:22	1.28
+++ Src/exec.c	2001/06/15 22:01:36
@@ -1714,7 +1714,9 @@
 		is_shfunc = 1;
 		break;
 	    }
-	    if (!(hn = builtintab->getnode(builtintab, cmdarg))) {
+	    if (!(hn = (cflags & BINF_BUILTIN) ?
+		  builtintab->getnode2(builtintab, cmdarg) :
+		  builtintab->getnode(builtintab, cmdarg))) {
 		checked = !(cflags & BINF_BUILTIN);
 		break;
 	    }
@@ -1829,7 +1831,9 @@
 		is_shfunc = 1;
 		break;
 	    }
-	    if (!(hn = builtintab->getnode(builtintab, cmdarg))) {
+	    if (!(hn = (cflags & BINF_BUILTIN) ?
+		  builtintab->getnode2(builtintab, cmdarg) :
+		  builtintab->getnode(builtintab, cmdarg))) {
 		if (cflags & BINF_BUILTIN) {
 		    zwarn("no such builtin: %s", cmdarg, 0);
 		    lastval = 1;

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
Work: pws@xxxxxxx
Web: http://www.pwstephenson.fsnet.co.uk



Messages sorted by: Reverse Date, Date, Thread, Author