From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 901 invoked from network); 16 Feb 2001 07:43:46 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 16 Feb 2001 07:43:46 -0000 Received: (qmail 14767 invoked by alias); 16 Feb 2001 07:43:40 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 13492 Received: (qmail 14753 invoked from network); 16 Feb 2001 07:43:39 -0000 From: "Bart Schaefer" Message-Id: <1010216074307.ZM16574@candle.brasslantern.com> Date: Fri, 16 Feb 2001 07:43:07 +0000 In-Reply-To: Comments: In reply to Peter Stephenson "Re: More incompatibility (word splitting)" (Feb 15, 10:35am) References: X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: PATCH: Re: More incompatibility (word splitting) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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