[Pkg-zsh-devel] Bug#871787: Bug#871787: Bug#871787: zsh: error "defining function based on alias ..."
Vincent Lefevre
vincent at vinc17.net
Fri Aug 11 23:19:38 UTC 2017
On 2017-08-11 18:20:13 +0000, Daniel Shahaf wrote:
> Vincent Lefevre wrote on Fri, Aug 11, 2017 at 18:15:21 +0200:
> > OK, but perhaps this should be announced then, since there are
> > legitimate uses and this is a change in the behavior.
>
> It is mentioned in the list of incompatibilities in the upstream README.
>
> I suppose it could be added to NEWS.Debian.
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.
>
> As the upstream README explains, the problem is that
>
> alias ssh='nocorrect ssh'
> ssh() { command ssh "$@" }
>
> defines a function called 'nocorrect' whose body is { command ssh "$@" },
> due to the MULTI_FUNC_DEF option. That's the purpose of the warning,
> Is that what your code does?
Something like that, but this doesn't behave as you said. It seems
that the alias is expanded as usual, so that one gets:
nocorrect ssh() { command ssh "$@" }
which is transformed into:
ssh() { command ssh "$@" }
as expected (let's recall that "nocorrect" is special and taken
into account *before* parsing).
"where ssh" gives the expected ssh function:
zira:~> where ssh
ssh: aliased to nocorrect ssh
ssh () {
ssh_wrapper ssh "$@"
}
/usr/bin/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