From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7152 invoked by alias); 8 Jan 2011 02:17:19 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28595 Received: (qmail 4844 invoked from network); 8 Jan 2011 02:17:16 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110107181708.ZM628@torch.brasslantern.com> Date: Fri, 07 Jan 2011 18:17:06 -0800 In-reply-to: <20110107225616.GA99800@redoubt.spodhuis.org> Comments: In reply to Phil Pennock "Re: exec -a and parameter expansion" (Jan 7, 5:56pm) References: <8739p4wekt.fsf@gmail.com> <20110107225616.GA99800@redoubt.spodhuis.org> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Christian Neukirchen , zsh-workers@zsh.org Subject: Re: exec -a and parameter expansion MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jan 7, 5:56pm, Phil Pennock wrote: } Subject: Re: exec -a and parameter expansion } } Unfortunately, my understanding of zsh's internal parse state is } weak enough that I don't know the fix. Somewhere in the BINF_EXEC } handling, I *think* that some kind of unmeta() is needed, but my naive } approaches have not worked. The problem here is that zsh does the following operations (this is all in exec.c in the block before the comment "Do prefork substitutions"): (1) Check that the command type is WC_SIMPLE; (2) Check whether the first argument is a precommand modifier or other special builtin ("exec" qualifies); (3) Process options of those special builtins; (4) Remove the precommand modifier or special builtin and its arguments from the command line; (5) "Do prefork substitutions" Guess at which step variable expansion is performed? Interestingly, if I simply move (5) up to before (1), I get EXACTLY ONE failure from the "make check" test suite: *** /tmp/zsh.ztst.out.31800 Fri Jan 7 18:08:59 2011 --- /tmp/zsh.ztst.tout.31800 Fri Jan 7 18:08:59 2011 *************** *** 1,4 **** 1 1 0 ! arg1 arg2 noktarg1 0 1 --- 1,4 ---- 1 1 0 ! arg1 noktarg1 0 1 Test ../../zsh-4.0/Test/E01options.ztst failed: output differs from expected as shown above for: setopt kshtypeset ktvars=(ktv1 ktv2) typeset ktfoo=`echo arg1 arg2` $ktvars print $+ktv1 $+ktv2 $+ktv3 print $ktfoo unsetopt kshtypeset typeset noktfoo=`echo noktarg1 noktarg2` print $noktfoo print $+noktarg1 $+noktarg2 unset ktfoo ktv1 ktv2 noktfoo noktarg2 Was testing: KSH_TYPESET option So either there are some missing test cases for other things that this would cause to break, or we should rearrange execcmd() so that "typeset" is the only special-cased builtin ahead of prefork(). --