Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: More incompatibility :-) RE: PATCH: 3.1.9-dev-8: Re: Word splitting in zsh



On Feb 13, 12:57pm, Andrej Borsenkow wrote:
> Subject: RE: More incompatibility :-) RE: PATCH: 3.1.9-dev-8: Re: Word spl
> 
> > 	print ${=foo+"$(unsetopt shwordsplit;print -l $bar)"}
> >
> > actually *does* split the value of $bar within the command subst.  Hmm.
> 
> Yep. That is exactly what I meant. I'm not sure what is current
> status, but I always assumed that any flag applies to current value
> only and not propagates to nested substitutions. At least this sounds
> logical.

Depends on what you mean by "nested substitutions."

Without my patch, the flag effectively applies to all nested substitutions
because splitting is done again at each level *after* the value propagates
up from the any nested substitution.

With my patch, for exactly the ${x+y} and ${x-y} cases, the current state
of splitting is deliberately propagated to the right-hand-side, which is
not so much a nested substitution as it is a "alternate" substitution.
However, the way that I propagated it causes it to override `setopt' for
the shwordsplit option, which is correct in the current shell but not in
subshells i.e. $(...).

The two possible solutions to this are (1) make ${=...} behave the way
Andrej says is "logical", so that e.g. with shwordsplit turned off, in
${=x+${y}} no word splitting would happen at all (because it's not on
in $y, even though it's on for $x; or (2) figure out how to reset the
value of mult_spbreak to 0 during $(...) (mult_shwsplit is ignored if
mult_spbreak is 0).

(1) actually means removing mult_spbreak and mult_shwsplit entirely; I
put them in because I thought to do otherwise would be too great a
behavior change from the way zsh works without the patch.



Messages sorted by: Reverse Date, Date, Thread, Author