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

Re: Bug in alias expansion

On Wed, 18 Nov 2015 10:42:54 +0000
Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
> > Addendum:  To some extent it does not.
> > 
> > torch% alias foo='echo x)$(:'
> > torch% print $(foo)
> > zsh: command not found: fooecho
> This is a completely different problem again.  There appear to be three
> different but interacting issues:
> - this one, which could be hairy as we emerge from parsing a $(...)
> expansion with an alias unpopped --- I'm not sure yet if that's
> tractable without making the code yet more unreadable

Actually, now I start looking, I think I'm inclining to Mikael's view on
the interaction between this and the position of alias expansion, even
if it's global.  At the top level we have $(, foo, ).  foo clearly
starts within the $(.  So it's hard to see how the $( can then end
within the foo; it seems to violate the hierarchy.  Yes, I know aliases
can violate hierarchies, but only once they're expanded, obviously.  I
can't see a sensible reason for expanding foo until we're already within
the context of the $(...) --- surely the intention of $(...) is to
protect the outside world from whatever's inside, and if foo isn't
inside I'm no longer sure which way up I am.

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.


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