From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29643 invoked from network); 11 Sep 2008 12:44:41 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,HTML_MESSAGE autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 11 Sep 2008 12:44:41 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 96063 invoked from network); 11 Sep 2008 12:44:30 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 11 Sep 2008 12:44:30 -0000 Received: (qmail 10362 invoked by alias); 11 Sep 2008 12:44:19 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25642 Received: (qmail 10344 invoked from network); 11 Sep 2008 12:44:17 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 11 Sep 2008 12:44:17 -0000 Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.173]) by bifrost.dotsrc.org (Postfix) with ESMTP id 2D643802710A for ; Thu, 11 Sep 2008 14:44:09 +0200 (CEST) Received: by wf-out-1314.google.com with SMTP id 29so344444wff.3 for ; Thu, 11 Sep 2008 05:44:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type:references; bh=2mbiRInBbq7DvuUCirjcz2K5Qn/WdUV7HRY7nnTCzK0=; b=D37Mlwa97CzABxyh2Q47VYNkpUGOKbhIvxkg4JnImsRVZ0j8oD0TdsNoe3yR/J9Bdz prBHoIFA+oZgpnzoOuZ3frRDNacy8uSp8Hq0DOApo8vlCc1Bj2sWn5cZLXjqvKhvQQyn S4lkoMvLHOfOZbNG1UhFF+BuVFM1zLJjZ/6gw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=MUtGqiurpwLivOTpAJJTOWIb9DtTod83DuxJaTW/XreM62hQVWvaIBWYc3hXB9Jv6f kGus4bs4niUlyvONeWD+fMc3B2VsNVfK+uTgWfvNoiKcY2RfAOthoiHGFYl/6Yy14mNK R/4z/QpcqAFtJax/H1yD+J/7+2nQVirSe+Nto= Received: by 10.115.59.4 with SMTP id m4mr1896388wak.104.1221137048000; Thu, 11 Sep 2008 05:44:08 -0700 (PDT) Received: by 10.114.159.2 with HTTP; Thu, 11 Sep 2008 05:44:07 -0700 (PDT) Message-ID: <6cd6de210809110544u569838dk5a93a739fa267822@mail.gmail.com> Date: Thu, 11 Sep 2008 08:44:07 -0400 From: "Rocky Bernstein" To: "Peter Stephenson" Subject: Re: preventing the leading space in process substitution Cc: "Zsh Hackers' List" In-Reply-To: <20080911130005.7c5e2b7c@news01> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_12659_22600948.1221137048010" References: <20080909144101.GA30693@lapse.rw.madduck.net> <200809101124.m8ABOlKI005063@news01.csr.com> <080910074842.ZM19151@torch.brasslantern.com> <200809101510.m8AFAajX007203@news01.csr.com> <080910090554.ZM19272@torch.brasslantern.com> <6cd6de210809101151q4d0a2a35p452fe656e0ee7dd5@mail.gmail.com> <20080911130005.7c5e2b7c@news01> X-Virus-Scanned: ClamAV 0.92.1/8216/Thu Sep 11 13:13:36 2008 on bifrost X-Virus-Status: Clean ------=_Part_12659_22600948.1221137048010 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Thanks. I think this will be a big improvement. A gentle nudge on having trap DEBUG (if not other traps as well) inherited in subshells. ;-) Thanks again. On Thu, Sep 11, 2008 at 8:00 AM, Peter Stephenson wrote: > On Wed, 10 Sep 2008 14:51:04 -0400 > "Rocky Bernstein" wrote: > > Also (mentioned previously), I think the multiple function definition > with a > > single body syntax should be removed when sh or bash emulation is in > effect. > > Those POSIX shell variants neither support this form and having it around > > allows it to get confused causing a more obscure error message when one > > writes "typeset -a foo=(list)" which is valid in those other POSIX shell > > variants. > > (Moved to zsh-workers.) > > That's probably useful; it's been spotted before that multiple function > definitions of this form can be pretty confusing to zsh users, too. > > Note, however, that the case you showed already gives a different error, > since the parentheses aren't empty. In bash/ksh emulation you should get > the reasonable "typeset: foo: can't assign initial value for array". > > Index: Doc/Zsh/options.yo > =================================================================== > RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v > retrieving revision 1.63 > diff -u -r1.63 options.yo > --- Doc/Zsh/options.yo 7 Aug 2008 16:27:15 -0000 1.63 > +++ Doc/Zsh/options.yo 11 Sep 2008 11:43:08 -0000 > @@ -1133,6 +1133,14 @@ > > will restore normally handling of tt(SIGINT) after the function exits. > ) > +pindex(MULTI_FUNC_DEF) > +item(tt(MULTI_FUNC_DEF) )( > +Allow definitions of multiple functions at once in the form `tt(fn1 > +fn2)var(...)tt(LPAR()RPAR())'; if the option is not set, this causes > +a parse error. Definition of multiple functions with the tt(function) > +keyword is always allowed. Multiple function definitions are not often > +used and can cause obscure errors. > +) > pindex(MULTIOS) > item(tt(MULTIOS) )( > Perform implicit bf(tee)s or bf(cat)s when multiple > Index: Src/options.c > =================================================================== > RCS file: /cvsroot/zsh/zsh/Src/options.c,v > retrieving revision 1.45 > diff -u -r1.45 options.c > --- Src/options.c 7 Aug 2008 16:27:15 -0000 1.45 > +++ Src/options.c 11 Sep 2008 11:43:08 -0000 > @@ -181,6 +181,7 @@ > 0 > #endif > }, MULTIBYTE}, > +{{NULL, "multifuncdef", OPT_EMULATE|OPT_ZSH}, > MULTIFUNCDEF}, > {{NULL, "multios", OPT_EMULATE|OPT_ZSH}, MULTIOS}, > {{NULL, "nomatch", OPT_EMULATE|OPT_NONBOURNE},NOMATCH}, > {{NULL, "notify", OPT_ZSH}, NOTIFY}, > Index: Src/parse.c > =================================================================== > RCS file: /cvsroot/zsh/zsh/Src/parse.c,v > retrieving revision 1.73 > diff -u -r1.73 parse.c > --- Src/parse.c 1 Sep 2008 20:18:48 -0000 1.73 > +++ Src/parse.c 11 Sep 2008 11:43:08 -0000 > @@ -1663,6 +1663,9 @@ > zlong oldlineno = lineno; > int onp, so, oecssub = ecssub; > > + if (!isset(MULTIFUNCDEF) && argc > 1) > + YYERROR(oecused); > + > *complex = c; > lineno = 0; > incmdpos = 1; > Index: Src/zsh.h > =================================================================== > RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v > retrieving revision 1.145 > diff -u -r1.145 zsh.h > --- Src/zsh.h 3 Sep 2008 09:08:22 -0000 1.145 > +++ Src/zsh.h 11 Sep 2008 11:43:08 -0000 > @@ -1882,6 +1882,7 @@ > MENUCOMPLETE, > MONITOR, > MULTIBYTE, > + MULTIFUNCDEF, > MULTIOS, > NOMATCH, > NOTIFY, > > > -- > Peter Stephenson Software Engineer > CSR PLC, Churchill House, Cambridge Business Park, Cowley Road > Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 > ------=_Part_12659_22600948.1221137048010 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
Thanks. I think this will be a big improvement.

A gentle nudge on having trap DEBUG (if not other traps as well) inherited in subshells. ;-)

Thanks again.

On Thu, Sep 11, 2008 at 8:00 AM, Peter Stephenson <pws@csr.com> wrote:
On Wed, 10 Sep 2008 14:51:04 -0400
"Rocky Bernstein" <rocky.bernstein@gmail.com> wrote:
> Also (mentioned previously), I think the multiple function definition with a
> single body syntax should be removed when sh or bash emulation is in effect.
> Those POSIX shell variants neither support this form and having it around
> allows it to get confused causing a more obscure error message when one
> writes "typeset -a foo=(list)" which is valid in those other POSIX shell
> variants.

(Moved to zsh-workers.)

That's probably useful; it's been spotted before that multiple function
definitions of this form can be pretty confusing to zsh users, too.

Note, however, that the case you showed already gives a different error,
since the parentheses aren't empty.  In bash/ksh emulation you should get
the reasonable "typeset: foo: can't assign initial value for array".

Index: Doc/Zsh/options.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v
retrieving revision 1.63
diff -u -r1.63 options.yo
--- Doc/Zsh/options.yo  7 Aug 2008 16:27:15 -0000       1.63
+++ Doc/Zsh/options.yo  11 Sep 2008 11:43:08 -0000
@@ -1133,6 +1133,14 @@

 will restore normally handling of tt(SIGINT) after the function exits.
 )
+pindex(MULTI_FUNC_DEF)
+item(tt(MULTI_FUNC_DEF) <Z>)(
+Allow definitions of multiple functions at once in the form `tt(fn1
+fn2)var(...)tt(LPAR()RPAR())'; if the option is not set, this causes
+a parse error.  Definition of multiple functions with the tt(function)
+keyword is always allowed.  Multiple function definitions are not often
+used and can cause obscure errors.
+)
 pindex(MULTIOS)
 item(tt(MULTIOS) <Z>)(
 Perform implicit bf(tee)s or bf(cat)s when multiple
Index: Src/options.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/options.c,v
retrieving revision 1.45
diff -u -r1.45 options.c
--- Src/options.c       7 Aug 2008 16:27:15 -0000       1.45
+++ Src/options.c       11 Sep 2008 11:43:08 -0000
@@ -181,6 +181,7 @@
                             0
 #endif
                             },                         MULTIBYTE},
+{{NULL, "multifuncdef",              OPT_EMULATE|OPT_ZSH},      MULTIFUNCDEF},
 {{NULL, "multios",           OPT_EMULATE|OPT_ZSH},      MULTIOS},
 {{NULL, "nomatch",           OPT_EMULATE|OPT_NONBOURNE},NOMATCH},
 {{NULL, "notify",            OPT_ZSH},                  NOTIFY},
Index: Src/parse.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/parse.c,v
retrieving revision 1.73
diff -u -r1.73 parse.c
--- Src/parse.c 1 Sep 2008 20:18:48 -0000       1.73
+++ Src/parse.c 11 Sep 2008 11:43:08 -0000
@@ -1663,6 +1663,9 @@
           zlong oldlineno = lineno;
           int onp, so, oecssub = ecssub;

+           if (!isset(MULTIFUNCDEF) && argc > 1)
+               YYERROR(oecused);
+
           *complex = c;
           lineno = 0;
           incmdpos = 1;
Index: Src/zsh.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v
retrieving revision 1.145
diff -u -r1.145 zsh.h
--- Src/zsh.h   3 Sep 2008 09:08:22 -0000       1.145
+++ Src/zsh.h   11 Sep 2008 11:43:08 -0000
@@ -1882,6 +1882,7 @@
    MENUCOMPLETE,
    MONITOR,
    MULTIBYTE,
+    MULTIFUNCDEF,
    MULTIOS,
    NOMATCH,
    NOTIFY,


--
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070

------=_Part_12659_22600948.1221137048010--