[Pkg-zsh-devel] Bug#871787: Bug#871787: zsh: error "defining function based on alias ..."
Vincent Lefevre
vincent at vinc17.net
Fri Aug 11 16:15:21 UTC 2017
On 2017-08-11 17:17:36 +0200, Axel Beckert wrote:
> Vincent Lefevre wrote:
> > There's a major regression, which breaks my startup scripts:
> >
> > zira% alias foo=bar
> > zira% foo() { : }
> > zsh: defining function based on alias `foo'
> > zsh: parse error near `()'
>
> I don't see what should be wrong here. Seems like a new safe-guard
> avoiding redefining an alias as function without unaliasing it first.
> Looks legit to me on a first glance.
>
> Digging through the upstream commits, I found this commit which looks
> like this new behaviour is totally on purpose:
>
> commit bb218704d27bcca9aa4426296dcd5c13d58b330a
> Author: Peter Stephenson <p.w.stephenson at ntlworld.com>
> Date: Tue Jan 10 19:14:26 2017 +0000
>
> 40306 with doc tweaks: Change behaviour expanding alias in ()
> function definition.
>
> Now an error unless the () is part of the same error as the name.
> Add ALIAS_FUNC_DEF option to allow it again.
>
> So you should either add this option or change the syntax of your
> startup scripts. I hence consider this to be a non-bug.
OK, but perhaps this should be announced then, since there are
legitimate uses and this is a change in the behavior.
In my case, this is typically something like:
alias ssh='nocorrect ssh'
and a ssh wrapper is defined as a function. I don't see anything
wrong with this kind of construct.
> Retitling and downgrading the bug report accordingly for the
> remainder of the bug report:
>
> > Well, I'm not sure whether there are other issues or this is a
> > consequence of the above bug, but completions are alo broken.
> > For instance, I can no longer complete on the "man" command.
>
> Works fine for me on a first glance, both without arguments as well as
> with the beginning of a command already typed.
I'll try to find the cause of the other issues.
--
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
More information about the Pkg-zsh-devel
mailing list