From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21383 invoked from network); 30 Mar 2001 06:38:27 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 30 Mar 2001 06:38:27 -0000 Received: (qmail 21068 invoked by alias); 30 Mar 2001 06:38:19 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 13845 Received: (qmail 21053 invoked from network); 30 Mar 2001 06:38:18 -0000 From: "Bart Schaefer" Message-Id: <1010330063727.ZM1057@candle.brasslantern.com> Date: Fri, 30 Mar 2001 06:37:27 +0000 In-Reply-To: Comments: In reply to Zefram "Re: "setopt noexec" and interactive shells" (Mar 27, 8:12pm) References: X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.dk Subject: Re: "setopt noexec" and interactive shells MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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)) )( 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