From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21031 invoked by alias); 25 Nov 2015 09:03:13 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 20984 Received: (qmail 25126 invoked from network); 25 Nov 2015 09:03:11 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,HTML_MESSAGE, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 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=IqG8jnI60KQ2BW3G/zjDCNdp5yBYlWDcfC2QsdccnZU=; b=bgHQo4GzUFd2disIEz+rtJWDb0ajwSPfOXt9JjTXNw2LRw5Iv7VzpfIipY4tTO7hNi 43j8piAGL8LOdxKKxeOHjnEbzdtRSIR5Jd8oh6DDAbjNZlLPLzU14M1pvb0x8Gjnwfph 1Cniiu6wFPpGFFOhneBNGdyngDZPVoCMeXrrY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=IqG8jnI60KQ2BW3G/zjDCNdp5yBYlWDcfC2QsdccnZU=; b=OYKSSlPmmy/Ou77+uxOENVBElysDBhTwJJPc0CnoPHU5TCa3SMozNeHC18pyrZDHtf oYxtRBiiI5zVQJeDlti8Yr8YKVjNgLW0h0XEqc9flimCEYtUONes2BxvBTAW4QfudmWp sOJW+78XprgPrrMHyFe/4DZB4OA3kudx0xCxgqFXhKp1tJhGnmYiRUEPAuAAFL2MCEpF QODfohWPKimg0Xy4i7mstZHpExSaExdGxJ8yY3fUbPwQIGBIQTRYQTq0mbUM9NR1j10L GaPfa1lTm+pJ/XbwoQ4tP1iDjViRXLVIjXCgG7qYFKlNv3ZkkHzOueE2kGwnSnzd2Vpe hSeQ== X-Gm-Message-State: ALoCoQn0LpbbJb7gdoboa2caOyKnGHKBPL4n1WY5/v6HIB0E65yYaYF7o+qRe5w0wroA2qPVu0na MIME-Version: 1.0 X-Received: by 10.60.63.34 with SMTP id d2mr23903904oes.75.1448442188507; Wed, 25 Nov 2015 01:03:08 -0800 (PST) In-Reply-To: References: Date: Wed, 25 Nov 2015 16:03:08 +0700 Message-ID: Subject: Re: [Zsh bug] function define bug From: =?UTF-8?B?TmfDtCBIdXk=?= To: Cuong Manh Le Cc: Matthew Martin , Zsh Users Content-Type: multipart/alternative; boundary=001a1136b17a1fbf36052559ba03 --001a1136b17a1fbf36052559ba03 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Dear Cuong, 2015-11-25 15:49 GMT+07:00 Cuong Manh Le : > Hi Severus, > > Can you give a demo? > > You can turn off `mult=C3=AC_func_def` but you can always do multiple fun= ction > definition with reserved word `function` > > Best. > > > On Wed, Nov 25, 2015 at 11:20 AM, Ng=C3=B4 Huy wr= ote: > >> Dear Matthew >> >> 2015-11-25 11:06 GMT+07:00 Matthew Martin : >> >> > On Tue, Nov 24, 2015 at 9:46 PM, Ng=C3=B4 Huy = 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 z= sh >> > 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=C3=AC_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 >> > > this's just example: cat file | grep foobar(){ rm -rf *} grep wil execute rest of body Kind regards, Severus --001a1136b17a1fbf36052559ba03--