Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: fixing ${1+"$@"} when word-splitting
- X-seq: zsh-workers 22263
- From: Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx>
- To: Peter Stephenson <pws@xxxxxxx>
- Subject: Re: PATCH: fixing ${1+"$@"} when word-splitting
- Date: Mon, 13 Feb 2006 11:00:01 -0800
- Cc: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- In-reply-to: <EXCHANGE0361Bp2fk8L0000c976@xxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20060211181440.GA30984@xxxxxxxxxxxxx> <200602122026.k1CKQHGH003629@xxxxxxxxxxxxxxxxx> <20060213105349.GD31780@xxxxxxxxxxxxx> <EXCHANGE03NXLbrBmWU0000c118@xxxxxxxxxxxxxxxxxx> <20060213174338.GC6952@xxxxxxxxxxxxx> <EXCHANGE0361Bp2fk8L0000c976@xxxxxxxxxxxxxxxxxx>
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..
--- 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;
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author