From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9026 invoked by alias); 28 Feb 2012 10:29:12 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30299 Received: (qmail 29268 invoked from network); 28 Feb 2012 10:29:10 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Tue, 28 Feb 2012 10:29:00 +0000 From: Peter Stephenson To: Subject: Re: regression in "$*" expansion Message-ID: <20120228102900.53d578bb@pwslap01u.europe.root.pri> In-Reply-To: <20120227202456.GD7566@yahoo.fr> References: <20120227202456.GD7566@yahoo.fr> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.101.10.170] X-Scanned-By: MailControl 7.6.6 (www.mailcontrol.com) on 10.71.0.142 On Mon, 27 Feb 2012 20:24:56 +0000 Stephane Chazelas wrote: > $ ARGV0=sh zsh -c 'IFS=; print -rl "$*"' x a b c > a > b > c > > (instead of expected "abc"). I don't really understand the nojoin flag (in the sense of "I never really understood string theory") but it shouldn't be doing anything related to SHWORDSPLIT within quotes, unless we're explicitly using (@) or $@ which we haven't tested at this point. So I think the fix is just this local change. Index: Src/subst.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/subst.c,v retrieving revision 1.132 diff -p -u -r1.132 subst.c --- Src/subst.c 20 Feb 2012 17:50:40 -0000 1.132 +++ Src/subst.c 28 Feb 2012 10:23:11 -0000 @@ -1649,7 +1649,7 @@ paramsubst(LinkList l, LinkNode n, char * This is one of the things that decides whether multsub * will produce an array, but in an extremely indirect fashion. */ - int nojoin = (pf_flags & PREFORK_SHWORDSPLIT) ? !(ifs && *ifs) : 0; + int nojoin = (pf_flags & PREFORK_SHWORDSPLIT) ? !(ifs && *ifs) && !qt : 0; /* * != 0 means ${...}, otherwise $... What works without braces * is largely a historical artefact (everything works with braces, Index: Test/D04parameter.ztst =================================================================== RCS file: /cvsroot/zsh/zsh/Test/D04parameter.ztst,v retrieving revision 1.62 diff -p -u -r1.62 D04parameter.ztst --- Test/D04parameter.ztst 22 Feb 2012 15:35:50 -0000 1.62 +++ Test/D04parameter.ztst 28 Feb 2012 10:23:11 -0000 @@ -1475,3 +1475,13 @@ print ${#foo} 0:Nularg removed from split empty string >0 + + (set -- a b c + setopt shwordsplit + IFS= + print -rl "$*" + unset IFS + print -rl "$*") +0:Regression test for shwordsplit with null or unset IFS and quoted array +>abc +>a b c -- Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog