From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14249 invoked by alias); 9 Apr 2010 15:34:52 -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: 27865 Received: (qmail 24712 invoked from network); 9 Apr 2010 15:34:48 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) 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.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Fri, 9 Apr 2010 15:37:54 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: Is this a bug? Why not? Message-ID: <20100409153754.76d0f6a6@news01> In-Reply-To: <100401155118.ZM11873@torch.brasslantern.com> References: <100330224612.ZM1818@torch.brasslantern.com> <20100331060602.GA91691@redoubt.spodhuis.org> <100331081153.ZM2688@torch.brasslantern.com> <20100401082624.GA56998@redoubt.spodhuis.org> <100401073618.ZM10593@torch.brasslantern.com> <20100401215752.GA34619@redoubt.spodhuis.org> <100401155118.ZM11873@torch.brasslantern.com> Organization: CSR X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.8; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 09 Apr 2010 14:37:55.0312 (UTC) FILETIME=[3DD83F00:01CAD7F2] X-Scanned-By: MailControl A_09_30_00 (www.mailcontrol.com) on 10.71.0.138 On Thu, 01 Apr 2010 15:51:18 -0700 Bart Schaefer wrote: > On Apr 1, 2:57pm, Phil Pennock wrote: > } Subject: Re: Is this a bug? Why not? > } > } > E.g., why doesn't the following cause $foo to be quoted? > } > > } > schaefer[516] ARGV0=sh Src/zsh > } > $ foo="???" > } > $ print ${foo+"$foo"} > } > Doc Etc Src > } > $ > } > > } > It works in bash. > > } Is this use-case important enough to warrant yet another option? > > Normally I'd be a stickler for not changing existing behavior, but in > this case it looks so obviously like a bug in the way glob_subst is > implemented that I'm not sure a new option is needed. I think that's correct. It might be as simple as this. Index: Src/subst.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/subst.c,v retrieving revision 1.102 diff -p -u -r1.102 subst.c --- Src/subst.c 27 Mar 2010 19:04:36 -0000 1.102 +++ Src/subst.c 9 Apr 2010 14:34:26 -0000 @@ -2417,7 +2417,7 @@ paramsubst(LinkList l, LinkNode n, char multsub(&val, spbreak && !aspar, (aspar ? NULL : &aval), &isarr, NULL); opts[SHWORDSPLIT] = ws; copied = 1; - spbreak = 0; + spbreak = globsubst = 0; } break; case ':': Index: Test/D04parameter.ztst =================================================================== RCS file: /cvsroot/zsh/zsh/Test/D04parameter.ztst,v retrieving revision 1.40 diff -p -u -r1.40 D04parameter.ztst --- Test/D04parameter.ztst 15 Mar 2010 10:19:38 -0000 1.40 +++ Test/D04parameter.ztst 9 Apr 2010 14:34:26 -0000 @@ -221,6 +221,16 @@ >\\foo matched by \\*\\ >a\\b not matched by \\*\\ + ( + setopt globsubst + foo="boring*" + print ${foo+$foo} + print ${foo+"$foo"} + ) +0:globsubst together with nested quoted expansion +>boringfile +>boring* + print -l "${$(print one word)}" "${=$(print two words)}" 0:splitting of $(...) inside ${...} >one word -- 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