From: Bart Schaefer <schaefer@brasslantern.com>
To: Christian Neukirchen <chneukirchen@gmail.com>, zsh-workers@zsh.org
Subject: Re: exec -a and parameter expansion
Date: Fri, 07 Jan 2011 18:17:06 -0800 [thread overview]
Message-ID: <110107181708.ZM628@torch.brasslantern.com> (raw)
In-Reply-To: <20110107225616.GA99800@redoubt.spodhuis.org>
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().
--
next prev parent reply other threads:[~2011-01-08 2:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-07 22:09 Christian Neukirchen
2011-01-07 22:56 ` Phil Pennock
2011-01-08 2:17 ` Bart Schaefer [this message]
2011-01-08 2:32 ` Bart Schaefer
2011-01-08 21:52 ` Peter Stephenson
2011-01-08 22:29 ` Peter Stephenson
2011-01-09 1:18 ` 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=110107181708.ZM628@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=chneukirchen@gmail.com \
--cc=zsh-workers@zsh.org \
/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).