Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: Re: More incompatibility (word splitting)



On Feb 16, 11:50am, Andrej Borsenkow wrote:
} Subject: RE: PATCH: Re: More incompatibility (word splitting)
}
} > Here's the patch as I'm willing to commit it right now.
} 
} Does it really fix two described incompatibilities? O

It fixes the incompatibility with 3.0.8, i.e. ${1+"$@"} does the right
thing when *not* emulating sh, which it didn't before.

It fixes "${(A)foo=$bar[@]}" but not [ ${foo=""} = "true" ].

Although actually, sigh, it breaks "${(A)=foo=$bar}" in that it splits
$bar and assigns the array to $foo but then doesn't split $foo when it
substitutes the end result.


--- zsh-forge/current/Src/subst.c	Fri Feb 16 00:35:19 2001
+++ zsh-3.1.9/Src/subst.c	Fri Feb 16 08:18:49 2001
@@ -1015,7 +1015,7 @@
 		spbreak = 0;
 		s++;
 	    } else
-		spbreak = 1;
+		spbreak = 2;
 	} else if ((c == '#' || c == Pound) &&
 		   (iident(cc = s[1])
 		    || cc == '*' || cc == Star || cc == '@'
@@ -1414,8 +1414,6 @@
 		    if (spsep || spbreak) {
 			aval = sepsplit(val, spsep, 0, 1);
 			isarr = 2;
-			sep = spsep = NULL;
-			spbreak = 0;
 			l = arrlen(aval);
 			if (l && !*(aval[l-1]))
 			    l--;
@@ -1456,10 +1454,12 @@
 		if (isarr) {
 		  if (nojoin)
 		    isarr = -1;
-		  if (qt && !getlen && isarr > 0) {
+		  if (qt && !getlen && isarr > 0 && !spsep && spbreak < 2) {
 		    val = sepjoin(aval, sep, 1);
 		    isarr = 0;
 		  }
+		  sep = spsep = NULL;
+		  spbreak = 0;
 		}
 	    }
 	    break;

-- 
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