Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: Re: Minor expansion problem
- X-seq: zsh-workers 15872
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: Re: PATCH: Re: Minor expansion problem
- Date: Tue, 25 Sep 2001 17:07:29 +0000
- In-reply-to: <1010925163945.ZM5789@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <8328.1001434108@xxxxxxx> 	<1010925163945.ZM5789@xxxxxxxxxxxxxxxxxxxxxxx>
On Sep 25,  4:39pm, Bart Schaefer wrote:
}
} } > Expanding $(...) doesn't put
} } > in backslashes, but expanding `...` does.  This appears to be happening
} } > because the ${(e)exp} at _expand line 83 returns one word for `...` but
} } > an array for $(...).
} 
} This seems to fix it
No, on second look, I mistyped my test case; it doesn't fix it after all.
Seems subst_parse_str() needs to turn Qtick into Tick as well as Qstring
into String.  The following goes on top of 15871.
Now I'm concerned enough about this to wait for some feedback before I
commit it.  All tests pass (including the new one below), but better safe
than sorry.
Index: Src/subst.c
===================================================================
diff -c -r1.6 subst.c
--- Src/subst.c	2001/09/05 15:22:33	1.6
+++ Src/subst.c	2001/09/25 17:00:08
@@ -133,7 +133,7 @@
 		str3 = (char *)getdata(node);
 		continue;
 	    }
-	} else if ((qt = c == Qtick) || c == Tick)
+	} else if ((qt = c == Qtick) || (c == Tick ? (mult_isarr = 1) : 0))
 	  comsub: {
 	    LinkList pl;
 	    char *s, *str2 = str;
@@ -724,9 +724,12 @@
             int qt = 0;
 
 	    for (; *s; s++)
-		if (!qt && *s == Qstring)
-		    *s = String;
-                else if (*s == Dnull)
+		if (!qt) {
+		    if (*s == Qstring)
+			*s = String;
+		    else if (*s == Qtick)
+			*s = Tick;
+                } else if (*s == Dnull)
                     qt = !qt;
 	}
 	return 0;
Index: Test/D04parameter.ztst
===================================================================
diff -c -r1.4 D04parameter.ztst
--- Test/D04parameter.ztst	2001/09/05 15:22:35	1.4
+++ Test/D04parameter.ztst	2001/09/25 16:52:53
@@ -212,10 +212,17 @@
 >split me
 >I'm yours
 
-  foo='$(print Howzat)'
-  print ${(e)foo}
+  foo='$(print Howzat usay)'
+  print -l ${(e)foo}
 0:${(e)...}
 >Howzat
+>usay
+
+  foo='`print Howzat usay`'
+  print -l ${(e)foo}
+0:Regress ${(e)...} with backticks (see zsh-workers/15871)
+>Howzat
+>usay
 
   foo='I'\''m nearly out of my mind with tedium'
   bar=foo
-- 
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