zsh-users
 help / color / mirror / code / Atom feed
From: Cuong Manh Le <cuong.manhle.vn@gmail.com>
To: "Ngô Huy" <huynhok.uit@vnoss.org>
Cc: Matthew Martin <phy1729@gmail.com>, Zsh Users <zsh-users@zsh.org>
Subject: Re: [Zsh bug] function define bug
Date: Wed, 25 Nov 2015 15:49:35 +0700	[thread overview]
Message-ID: <CALS7p_cNO6=ZVnU9Zw_4exY+DWZxjEXQ=SOwU3O2fwDmq7Jmfg@mail.gmail.com> (raw)
In-Reply-To: <CAPO9Zdp4eHtM3n0GrP0TE2b9-u=6eWXYzrZg6w4BtbTL7644zA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1398 bytes --]

Hi Severus,

Can you give a demo?

You can turn off `multì_func_def` but you can always do multiple function
definition with reserved word `function`

Best.

On Wed, Nov 25, 2015 at 11:20 AM, Ngô Huy <huynhok.uit@vnoss.org> wrote:

> Dear Matthew
>
> 2015-11-25 11:06 GMT+07:00 Matthew Martin <phy1729@gmail.com>:
>
> > On Tue, Nov 24, 2015 at 9:46 PM, Ngô Huy <huynhok.uit@vnoss.org> 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
>

  reply	other threads:[~2015-11-25 14:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25  3:46 Ngô Huy
2015-11-25  4:06 ` Matthew Martin
2015-11-25  4:20   ` Ngô Huy
2015-11-25  8:49     ` Cuong Manh Le [this message]
2015-11-25  9:03       ` Ngô Huy
2015-11-25  9:04         ` Ngô Huy
2015-11-25  9:16           ` Christoph (Stucki) von Stuckrad
2015-11-25  9:20         ` Cuong Manh Le
2015-11-25  9:39           ` Ngô Huy
2015-11-25  9:58             ` Cuong Manh Le
2015-11-25 10:00             ` Peter Stephenson
2015-11-25 10:13               ` Ngô Huy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALS7p_cNO6=ZVnU9Zw_4exY+DWZxjEXQ=SOwU3O2fwDmq7Jmfg@mail.gmail.com' \
    --to=cuong.manhle.vn@gmail.com \
    --cc=huynhok.uit@vnoss.org \
    --cc=phy1729@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).