From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11034 invoked from network); 24 Jul 2001 01:13:51 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 24 Jul 2001 01:13:51 -0000 Received: (qmail 2416 invoked by alias); 24 Jul 2001 01:13:45 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15465 Received: (qmail 2404 invoked from network); 24 Jul 2001 01:13:43 -0000 From: "Bart Schaefer" Message-Id: <010723181213.ZM14442@candle.brasslantern.com> Date: Mon, 23 Jul 2001 18:12:13 -0700 In-Reply-To: <20010724010052.A12156@leeor.math.technion.ac.il> Comments: In reply to "Nadav Har'El" "Re: Enable/disable (was Re: Enhanced shell)" (Jul 24, 1:00am) References: <20010722224707.BD7621428E@pwstephenson.fsnet.co.uk> <3B5C06E6.FFFCCFCC@u.genie.co.uk> <20010723150019.A25511@leeor.math.technion.ac.il> <1010723163850.ZM14004@candle.brasslantern.com> <20010724010052.A12156@leeor.math.technion.ac.il> X-Mailer: Z-Mail Lite (5.0.0 30July97) To: "Nadav Har'El" Subject: Re: Enable/disable (was Re: Enhanced shell) Cc: Zsh hackers list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jul 24, 1:00am, Nadav Har'El wrote: > > > > As of 4.0.1, `builtin read' will run `read' even after `disable read'. > > Maybe we need to rethink that. > > Even if builtin's behavior remains, it's not so terrible, because somebody > who wants to disable a builtin like read will just need to also disable > "builtin" That's unpleasant; it makes it impossible [*] to bypass a shell function without unfunction-ing it. It makes life more difficult for the person setting up the restricted environment, as well as for the person using it. It also potentially breaks the $functions parameter, in which the bodies of undefined functions appear as `builtin autoload -X'. > But now that I think of it, does zsh have restricted-shell capabilities at > all? It gained restricted shell mode somewhere fairly early in the 3.1 series, so 4.0.x has it, but 3.0.x does not. Try `setopt restricted'. Just note that you can't unsetopt it again, so you should be prepared to exit. [*] OK, so it's not quite impossible: function neither_alias_nor_function() { local +h aliases functions disable -a ${(k)aliases} disable -f ${(k)functions} "$@" } neither_alias_nor_function echo this is too clever But of course being able to assign to the arrays from the $parameter module also allows one to re-enable disabled commands, and one can always assign to a variable by making it local, so it's impossible to disable enable unless one disables zmodload, but then completion and lots of other things don't work, and now you see what a hole we've dug ...