Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Re: More incompatibility (word splitting)
- X-seq: zsh-workers 13492
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: PATCH: Re: More incompatibility (word splitting)
- Date: Fri, 16 Feb 2001 07:43:07 +0000
- In-reply-to: <Tc0a8890c51be182e54@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <Tc0a8890c51be182e54@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
On Feb 15, 10:35am, Peter Stephenson wrote:
}
} It sounds like Bart's original patch will have to do for the time being.
Here's the patch as I'm willing to commit it right now. I'm going to be
out of town all next week, so I'm not going to be able to mess with it
any further, and I don't want to put something really broken into CVS
right before I disappear.
This includes the hunk from 13455 and one line from 13452, plus a comment
explaining the shortcomings of the code as it stands. The effect is that
the ${1+"$@"} case is no longer worse than in 3.0.8, though the ${=1+"$@"}
case is still no better; but "${(A)foo=$@}" should be much better.
Index: Src/subst.c
--- zsh-forge/current/Src/subst.c Tue Jan 16 07:12:14 2001
+++ zsh-3.1.9/Src/subst.c Thu Feb 15 23:19:55 2001
@@ -1379,7 +1379,14 @@
case '-':
if (vunset) {
val = dupstring(s);
- multsub(&val, NULL, &isarr, NULL);
+ /*
+ * This is not good enough for sh emulation! Sh would
+ * split unquoted substrings, yet not split quoted ones
+ * (except according to $@ rules); but this leaves the
+ * unquoted substrings unsplit, and other code below
+ * for spbreak splits even within the quoted substrings.
+ */
+ multsub(&val, (aspar ? NULL : &aval), &isarr, NULL);
copied = 1;
}
break;
@@ -1446,6 +1453,14 @@
}
*idend = sav;
copied = 1;
+ if (isarr) {
+ if (nojoin)
+ isarr = -1;
+ if (qt && !getlen && isarr > 0) {
+ val = sepjoin(aval, sep, 1);
+ isarr = 0;
+ }
+ }
}
break;
case '?':
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author