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

Re: Bug in alias expansion



On Wed, 18 Nov 2015 07:52:46 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Nov 18,  2:13pm, Peter Stephenson wrote:
> } Currently we expand both when parsing the entrails of the $(...)
> } and executing it, but should possibly only do so in the latter case.
> } I haven't look to see if this affects any tests.
> 
> Would not-expanding affect cmd_or_math() adversely?  Is that why we
> expand and then backtrack?

I can't offhand think of a case.  The crucial thing about cmd_or_math()
is to get the parentheses right.  Being affected by this change implies
it's currently propagating the effect to some outer layer of expansion,
which we're in the process of deciding is probably a bad thing.  If this
is correct it applies recursively, so nested expansions aren't an issue.
Did you have some vague pointers in mind?

I don't believe there's ever a case where we won't do the alias
expansion when we finally execute the inside of a $(...), because it's
always reparsed for execution (considered a bug up to now but getting us
out of the present hole), and $((...)) is equivalent to math eval in
double quotes, so no global aliases, if that's what you mean.

Come to think of it, the name of the function dquote_parse() kind of
implies we're not expanding aliases, but then it was named before we
started handling $(...) better, so that's not a great pointer.

Anyway, there are some pretty hairy tests, so if we change it we should
find out quickly.

pws



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