[Pkg-zsh-devel] Bug#871787: Bug#871787: zsh: error "defining function based on alias ..."

Vincent Lefevre vincent at vinc17.net
Fri Aug 11 23:07:35 UTC 2017


On 2017-08-11 21:59:12 +0200, Axel Beckert wrote:
> Vincent Lefevre wrote:
> > > 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,
> 
> Granted. Actually I thought about that already, too. Cloning the bug
> report for that then.
> 
> Currently planned text in /usr/share/doc/zsh/NEWS.Debian.gz:
> 
> zsh (5.4.1-1) unstable; urgency=medium
> 
>   Zsh version 5.4.1 introduced a change which doesn't allow aliases and
>   functions of the same name by default:
> 
>   > 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.
> 
>   The common error message triggered by this change looks as follows:
> 
>   > zsh: defining function based on alias `foo'
>   > zsh: parse error near `()'
> 
>   See https://bugs.debian.org/871787 for more information.
> 
>  -- Axel Beckert <abe at debian.org>  Fri, 11 Aug 2017 21:43:25 +0200
> 
> Do you think that suffices?

For the announcement, yes.

> > 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.
> 
> Hrm. Doesn't it suffice to put nocorrect into the function?

I don't think so. As explained in the zsh man pages, "nocorrect" is
a bit special. It is "interpreted immediately, before any parsing is
done". So, I assume that its only use is explicitly on the command
line or via an alias.

In any case, if I disable the function from my settings, I still
want the "nocorrect" on ssh.

-- 
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