zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: "Nadav Har'El" <nyh@math.technion.ac.il>
Cc: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: Enable/disable (was Re: Enhanced shell)
Date: Mon, 23 Jul 2001 18:12:13 -0700	[thread overview]
Message-ID: <010723181213.ZM14442@candle.brasslantern.com> (raw)
In-Reply-To: <20010724010052.A12156@leeor.math.technion.ac.il>

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 ...


  reply	other threads:[~2001-07-24  1:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-22 22:47 Enhanced shell Peter Stephenson
2001-07-23 11:13 ` Oliver Kiddle
2001-07-23 11:38   ` Peter Stephenson
2001-07-23 18:03     ` Bart Schaefer
2001-07-24 13:42       ` Oliver Kiddle
2001-07-23 12:00   ` Nadav Har'El
2001-07-23 16:38     ` Enable/disable (was Re: Enhanced shell) Bart Schaefer
2001-07-23 22:00       ` Nadav Har'El
2001-07-24  1:12         ` Bart Schaefer [this message]
2001-07-24  2:45           ` Here-strings and $functions Bart Schaefer
2001-07-24  6:18             ` Bart Schaefer
2001-07-24  8:12               ` Sven Wischnowsky
2001-07-24 12:16                 ` Bart Schaefer
2001-07-24  9:23         ` Enable/disable (was Re: Enhanced shell) Peter Stephenson
2001-07-24 12:10           ` PATCH: Doc errors (Re: Enable/disable (was Re: Enhanced shell)) Bart Schaefer
2001-07-29  9:53 ` Enhanced shell Zefram
2001-07-29 22:07   ` Peter Stephenson
2001-07-30  1:34     ` Bart Schaefer
2001-07-30  2:19   ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=010723181213.ZM14442@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=nyh@math.technion.ac.il \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).