Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug in alias expansion
- X-seq: zsh-workers 37124
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Bug in alias expansion
- Date: Mon, 16 Nov 2015 01:50:42 +0100
- Cc: zsh workers <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=+NJYrtG4EPid50Bth2gHtT0S2vro7ghRvIHpKSgotZ8=; b=fLBO0ak7DhMDkZzNdvKL3ykVmoqpJkV/kr/BExbug+dJV9rQUQbiLiHDPWi2seq/T/ SZxE/1KthTvxjy+X0U42qqx77q14a2h/53RJx1f54lVzG3iwl3O8Qj7EpQU4ZA2Tsdxb +ljaPf6q0d8hvwmi0GodaZA9UyBf9N69friY3MWCFxrbaD0hbUPQFP8M13L0lifRMbcq /5IE9C4ykf0ocYi1+6H+uBk1v52m63Ixo+AGiGt26JW8Yz119SIDZAdGhT4ey0hVp0aJ +HbbwS8x1BE8y+l56NoAPijwQMck1pkmpzsu+SHEOj9phzJaOe23Z1e1pfncS6TvJ0KJ cjmA==
- In-reply-to: <151115144805.ZM20614@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAFvQaj4AKN36Ntdxt0rNCqPxWFHtjLMt3zPK65y2Xf9G5iUfWA@mail.gmail.com> <20151115200356.0f3a80a2@ntlworld.com> <151115144805.ZM20614@torch.brasslantern.com>
On Sun, Nov 15, 2015 at 11:48 PM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Nov 15, 8:03pm, Peter Stephenson wrote:
> }
> } I don't know why this works in other contexts.
>
> Addendum: To some extent it does not.
>
> torch% alias foo='echo x)$(:'
> torch% print $(foo)
> zsh: command not found: fooecho
>
> This should of course expand to
>
> print $( echo x)$(: )
>
> which is perfectly valid and definitely should not produce "fooecho",
> so the backtracking is still messed up somewhere and parse_subscript()
> is potentially a red herring.
>
> In older versions of zsh it gagged in a different way:
>
> % alias -g foo='echo x)$(:'
> % print $(foo)
> zsh: parse error near `)'
> zsh: parse error in command substitution
This error is definitely what I would expect from the above command.
It's expanded in the subshell¹, so it shouldn't possibly be able to
affect the syntax of the parent shell.
¹
% alias -g foo=bar
% echo $(foo)
zsh: command not found: bar
% unalias \foo; foo; echo $(foo)
zsh: command not found: bar
zsh: command not found: foo
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author