Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [Zsh bug] function define bug
- X-seq: zsh-users 20983
- From: Ngô Huy <huynhok.uit@xxxxxxxxx>
- To: Matthew Martin <phy1729@xxxxxxxxx>
- Subject: Re: [Zsh bug] function define bug
- Date: Wed, 25 Nov 2015 11:20:21 +0700
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vnoss.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=tE6leTy8rAlHpd6WnLwGt/HdfbsaJsKvDE4t2TQpxFk=; b=JOc/Y6LdLoWinR+7VXfkjgd3o3jb/Le6au4XRzGHso3VQMxx575TZinQoipJvrBDTe E0cjvTXS1C2urgX7f0pSzx2xNU9k1DVgsNfjrATPPaDxZn9iMe+72VEKvtI3YQnCjp2u 8eTd2NkR9Pkhq0NeA2pR87f2EwRowI+BqCaZg=
- In-reply-to: <CAGnh9tB8oEua8npLmkhbPPBvMq1C3wfusnTo0MzLx0RjAiGaHw@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAPO9ZdrRL9e+B4urS4S5EitsOqjQYYji6F13JWkmOwLA=FyEbw@mail.gmail.com> <CAGnh9tB8oEua8npLmkhbPPBvMq1C3wfusnTo0MzLx0RjAiGaHw@mail.gmail.com>
Dear Matthew
2015-11-25 11:06 GMT+07:00 Matthew Martin <phy1729@xxxxxxxxx>:
> On Tue, Nov 24, 2015 at 9:46 PM, Ngô Huy <huynhok.uit@xxxxxxxxx> wrote:
> > Dear folks,
> >
> > I found the problem in zsh define function. Demo
> >
> > ls test() { echo "Bug !!!"} && ls && test
> >
> > it will print
> >
> > Bug !!!
> > Bug !!!
>
>
> That's expected behaviour. Since MULTI_FUNC_DEF is set by default in zsh
> mode, both ls and test are being defined as functions with the body
> echo "Bug !!!".
>
> % func1 func2 () { echo This is "$0"; }
> % func1; func2
> This is func1
> This is func2
> % which func{1,2}
> func1 () {
> echo This is "$0"
> }
> func2 () {
> echo This is "$0"
> }
> % unsetopt MULTI_FUNC_DEF
> % func1 func2 () { echo This is "$0"; }
> zsh: parse error near `()'
>
I know this behavior likes advanced programming language but multì_func_def
should be turned off by default, it leads to risky problem when someone
searchs as grep, ls malicious strings without quote
Kind regards,
Severus
Messages sorted by:
Reverse Date,
Date,
Thread,
Author