* PATCH: 4.1.0: `builtin' with disabled builtin.
@ 2001-06-15 23:06 Peter Stephenson
2001-06-16 4:35 ` Bart Schaefer
0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2001-06-15 23:06 UTC (permalink / raw)
To: Zsh hackers list
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@pwstephenson.fsnet.co.uk>
Work: pws@csr.com
Web: http://www.pwstephenson.fsnet.co.uk
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PATCH: 4.1.0: `builtin' with disabled builtin.
2001-06-15 23:06 PATCH: 4.1.0: `builtin' with disabled builtin Peter Stephenson
@ 2001-06-16 4:35 ` Bart Schaefer
2001-06-20 10:21 ` Oliver Kiddle
0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2001-06-16 4:35 UTC (permalink / raw)
To: Peter Stephenson, Zsh hackers list
On Jun 16, 12:06am, Peter Stephenson wrote:
} Subject: 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.
That's been gone since sometime in 2.5 or 2.6, whenever it was that real
hash tables replaced linked lists for command lookup. I don't think it
has ever worked in any 3.x version.
} I think the old behaviour is useful and harmless.
Unless one is trying to use disable to create a restricted shell. Then
one has to disable builtin as well, which might not be desirable for
other reasons.
} Does anyone have any worries about this?
I don't feel strongly one way or the other; I have a slight preference
for the v >= 3.0 behavior rather than the v <= 2.4 behavior, but not so
much as to carry on a lengthy disagreement about it.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PATCH: 4.1.0: `builtin' with disabled builtin.
2001-06-16 4:35 ` Bart Schaefer
@ 2001-06-20 10:21 ` Oliver Kiddle
0 siblings, 0 replies; 3+ messages in thread
From: Oliver Kiddle @ 2001-06-20 10:21 UTC (permalink / raw)
To: Zsh hackers list
Bart Schaefer wrote:
>
> On Jun 16, 12:06am, Peter Stephenson wrote:
> }
> } It used to be possible to get round the fact that a builtin was disabled by
> } putting `builtin' in front of it
> } I think the old behaviour is useful and harmless.
>
> Unless one is trying to use disable to create a restricted shell. Then
> one has to disable builtin as well, which might not be desirable for
Would it maybe make sense to allow this behaviour except when the
restricted option is set? Basically, I agree with Peter that the `old
behaviour is useful and harmless' except in a restricted shell.
> I don't feel strongly one way or the other;
Neither do I really.
Oliver
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-06-20 10:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-15 23:06 PATCH: 4.1.0: `builtin' with disabled builtin Peter Stephenson
2001-06-16 4:35 ` Bart Schaefer
2001-06-20 10:21 ` Oliver Kiddle
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).