From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15485 invoked from network); 25 Mar 2001 23:05:55 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 25 Mar 2001 23:05:55 -0000 Received: (qmail 708 invoked by alias); 25 Mar 2001 23:05:49 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 13756 Received: (qmail 696 invoked from network); 25 Mar 2001 23:05:48 -0000 From: "Bart Schaefer" Message-Id: <1010325230516.ZM11576@candle.brasslantern.com> Date: Sun, 25 Mar 2001 23:05:16 +0000 In-Reply-To: <1010325225123.ZM10966@candle.brasslantern.com> Comments: In reply to "Bart Schaefer" "Re: "setopt noexec" and interactive shells" (Mar 25, 10:51pm) References: <1010325225123.ZM10966@candle.brasslantern.com> 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 25, 10:51pm, Bart Schaefer wrote: } } Any comments on this patch? Ahem. I have my own comment: It doesn't work. I missed another spot where EXECOPT is tested. Critique the following patch instead. Index: Src/exec.c =================================================================== RCS file: /extra/cvsroot/zsh/zsh-3.1/Src/exec.c,v retrieving revision 1.128 diff -c -r1.128 exec.c --- Src/exec.c 2001/03/24 22:19:24 1.128 +++ Src/exec.c 2001/03/25 22:59:12 @@ -1639,7 +1639,7 @@ char *text; int save[10]; int fil, dfil, is_cursh, type, do_exec = 0, i, htok = 0; - int nullexec = 0, assign = 0, forked = 0; + int nullexec = 0, assign = 0, forked = 0, execopt; int is_shfunc = 0, is_builtin = 0, is_exec = 0; /* Various flags to the command. */ int cflags = 0, checked = 0; @@ -1648,6 +1648,7 @@ Wordcode beg = state->pc, varspc; FILE *oxtrerr = xtrerr; + execopt = !(unset(EXECOPT) && (unset(INTERACTIVE) || !isatty(0))); doneps4 = 0; redir = (wc_code(*state->pc) == WC_REDIR ? ecgetredirs(state) : NULL); if (wc_code(*state->pc) == WC_ASSIGN) { @@ -2092,7 +2093,7 @@ zwarn("writing redirection not allowed in restricted mode", NULL, 0); execerr(); } - if (unset(EXECOPT)) + if (!execopt) continue; switch(fn->type) { case REDIR_HERESTR: @@ -2218,7 +2219,7 @@ fputc('\n', xtrerr); fflush(xtrerr); } - } else if (isset(EXECOPT) && !errflag) { + } else if (execopt && !errflag) { /* * We delay the entersubsh() to here when we are exec'ing * the current shell (including a fake exec to run a builtin then -- 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