zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-workers@sunsite.dk
Subject: Re: "setopt noexec" and interactive shells
Date: Fri, 30 Mar 2001 06:37:27 +0000	[thread overview]
Message-ID: <1010330063727.ZM1057@candle.brasslantern.com> (raw)
In-Reply-To: <E14hysw-0006W6-00@crucigera.fysh.org>

On Mar 27,  8:12pm, Zefram wrote:
}
} Oh, and whichever way it's implemented in the end, it'll have to be
} documented.

I played around a bit with the most recent patch (13756) as adjusted to
remove the isatty(0) test.  It had some unexpected side-effects, one of
which was that `zpty' commands were not executed (because `interactive'
is not set in the subshell whose i/o is the pty slave).

So I've concluded that preserving but selectively ignoring the state of
the option is at least as bad as silently resetting it.

The other alternative that Zefram suggested was noisily refusing to change
the option:

Index: Src/options.c
===================================================================
--- Src/options.c	2001/02/28 17:05:08	1.22
+++ Src/options.c	2001/03/30 05:24:38
@@ -647,6 +647,9 @@
 	    for (s = rparams; *s; s++)
 		restrictparam(*s);
 	}
+    } else if(!force && optno == EXECOPT && !value && interact) {
+	/* cannot set noexec when interactive */
+	return -1;
     } else if(!force && (optno == INTERACTIVE || optno == SHINSTDIN ||
 	    optno == SINGLECOMMAND)) {
 	if (opts[optno] == value)

With the above patch, `zsh -n' can still give you a useless prompt, but
`set -n' etc. within the shell will complain:

zagzig% set -n
set: can't change option: -n
zagzig% setopt noexec
setopt: can't change option: noexec

Any remaining objections?

Index: Doc/Zsh/options.yo
===================================================================
--- Doc/Zsh/options.yo	2001/03/19 02:32:20	1.47
+++ Doc/Zsh/options.yo	2001/03/30 06:35:08
@@ -374,6 +374,8 @@
 item(tt(EXEC) (tt(PLUS()n), ksh: tt(PLUS()n)) <D>)(
 Do execute commands.  Without this option, commands are
 read and checked for syntax errors, but not executed.
+This option cannot be turned off in an interactive shell,
+except when `tt(-n)' is supplied to the shell at startup.
 )
 pindex(EXTENDED_GLOB)
 cindex(globbing, extended)

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


  reply	other threads:[~2001-03-30  6:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-04  5:20 Bart Schaefer
2001-03-05  1:55 ` Zefram
2001-03-25 22:51   ` Bart Schaefer
2001-03-25 23:05     ` Bart Schaefer
2001-03-27 18:09     ` Zefram
2001-03-27 19:12       ` Zefram
2001-03-30  6:37         ` Bart Schaefer [this message]
2001-03-27 19:18       ` Bart Schaefer
2001-03-27 19:25         ` Zefram
2001-03-27 19:58           ` 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=1010330063727.ZM1057@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --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).