1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-01 05:16:05 +01:00

26055: ensure process substitution is handled before parameter and command

This commit is contained in:
Peter Stephenson 2008-11-17 16:11:29 +00:00
parent 0662164f13
commit 2fbc131ca8
4 changed files with 18 additions and 12 deletions

View file

@ -1,5 +1,9 @@
2008-11-17 Peter Stephenson <pws@csr.com>
* 26055: README, Doc/Zsh/expn.yo, Src/subst.c: ensure process
substitution is handled completely before parameter and
command substitution.
* 26053: Completion/Base/Utility/_arguments: handle
"<cmd> --help" output that includes optional parts of options
in square brackets.

View file

@ -360,9 +360,8 @@ Each part of a command argument that takes the form
is subject to process substitution. The expression may be preceeded
or followed by other strings except that, to prevent clashes with
commonly occurring strings and patterns, the last
form must occur at the start of a command argument, and none of
the forms may occur inside parentheses used for grouping of patterns or
inside parameter substitutions.
form must occur at the start of a command argument, and the forms
are only expanded when first parsing command or assignment arguments.
In the case of the tt(<) or tt(>) forms, the shell runs the commands in
var(list) asynchronously. If the system supports the tt(/dev/fd)

8
README
View file

@ -74,11 +74,9 @@ were only handled if they appeared as separate command arguments.
(However, the latter two forms caused the current argument to be
terminated and a new one started even if they occurred in the middle of
a string.) Now all three may be followed by other strings, and the
latter two may also be preceeded by other strings. None may occur inside
parameter substitutions, or inside parentheses used for grouping of
patterns, in order to avoid clashes with cases where
tt(<) or tt(>) were not treated specially in previous versions of the
shell.
latter two may also be preceeded by other strings. Remaining
limitations on their use (to reduce incompatibilities to a minimum)
are documented in the zshexpn.1 manual.
In previous versions of the shell it was possible to use index 0 in an
array or string subscript to refer to the same element as index 1 if the

View file

@ -152,8 +152,8 @@ stringsubst(LinkList list, LinkNode node, int ssub, int asssub)
char *str = str3, c;
while (!errflag && (c = *str)) {
if ((c == Inang || c == Outang || (str == str3 && c == Equals)) &&
str[1] == Inpar) {
if (((c = *str) == Inang || c == Outang || (str == str3 && c == Equals))
&& str[1] == Inpar) {
char *subst, *rest, *snew, *sptr;
int str3len = str - str3, sublen, restlen;
@ -181,8 +181,13 @@ stringsubst(LinkList list, LinkNode node, int ssub, int asssub)
str3 = snew;
str = snew + str3len + sublen;
setdata(node, str3);
continue;
} else if ((qt = c == Qstring) || c == String) {
} else
str++;
}
str = str3;
while (!errflag && (c = *str)) {
if ((qt = c == Qstring) || c == String) {
if ((c = str[1]) == Inpar) {
if (!qt)
list->list.flags |= LF_ARRAY;