From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20506 invoked from network); 13 Feb 2006 19:00:19 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.0 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 13 Feb 2006 19:00:19 -0000 Received: (qmail 52996 invoked from network); 13 Feb 2006 19:00:13 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 13 Feb 2006 19:00:13 -0000 Received: (qmail 9197 invoked by alias); 13 Feb 2006 19:00:06 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 22263 Received: (qmail 9188 invoked from network); 13 Feb 2006 19:00:06 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 13 Feb 2006 19:00:06 -0000 Received: (qmail 52313 invoked from network); 13 Feb 2006 19:00:06 -0000 Received: from dsl3-63-249-88-2.cruzio.com (HELO dot.blorf.net) (63.249.88.2) by a.mx.sunsite.dk with SMTP; 13 Feb 2006 19:00:05 -0000 Received: by dot.blorf.net (Postfix, from userid 1000) id 7771E5ED7; Mon, 13 Feb 2006 11:00:01 -0800 (PST) Date: Mon, 13 Feb 2006 11:00:01 -0800 From: Wayne Davison To: Peter Stephenson Cc: Zsh hackers list Subject: Re: PATCH: fixing ${1+"$@"} when word-splitting Message-ID: <20060213190001.GD6952@dot.blorf.net> References: <20060211181440.GA30984@dot.blorf.net> <200602122026.k1CKQHGH003629@pwslaptop.csr.com> <20060213105349.GD31780@dot.blorf.net> <20060213174338.GC6952@dot.blorf.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="YiEDa0DAkWCtVeE4" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.11 --YiEDa0DAkWCtVeE4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Feb 13, 2006 at 06:08:57PM +0000, Peter Stephenson wrote: > unfortunately the saga continues... :-) Yup. Thanks for the extensive testing! > % fn() { local IFS=.-; print -l ${=1:-$ZSH_VERSION}; } > % fn > 4.3.0-dev-3 The attached patch fixes this by temporarily setting SHWORDSPLIT during the multsub() call when '=' was specified. I also tested that this change works properly with ${=1:-"$ZSH_VERSION"} (i.e. giving the output above). ..wayne.. --YiEDa0DAkWCtVeE4 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="more-splitting.diff" --- subst.c 2006-02-13 09:53:12.000000000 -0800 +++ subst.c 2006-02-13 10:50:52.000000000 -0800 @@ -2040,6 +2040,7 @@ /* Fall Through! */ case '-': if (vunset) { + int ws = opts[SHWORDSPLIT]; val = dupstring(s); /* If word-splitting is enabled, we ask multsub() to split * the substituted string at unquoted whitespace. Then, we @@ -2048,7 +2049,9 @@ * keep its array splits, and weird constructs such as * ${str+"one two" "3 2 1" foo "$str"} to only be split * at the unquoted spaces. */ + opts[SHWORDSPLIT] = spbreak; multsub(&val, spbreak && !aspar, (aspar ? NULL : &aval), &isarr, NULL); + opts[SHWORDSPLIT] = ws; copied = 1; spbreak = 0; } --YiEDa0DAkWCtVeE4--