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

PATCH: Re: Minor expansion problem



On Sep 25,  5:08pm, Peter Stephenson wrote:
}
} 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 $(...).
} 
} Yes, it's completely reproducible just with ${(e)exp}.

This seems to fix it (and a typo in a comment).  I'm a bit dubious of
changing mult_isarr possibly in the middle of a word, but that's what
happens in the $(...) case at line 111, so ...

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 16:33:20
@@ -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;
@@ -1492,7 +1492,7 @@
             /* This once was executed only `if (qt) ...'. But with that
              * patterns in a expansion resulting from a ${(e)...} aren't
              * tokenized even though this function thinks they are (it thinks
-             * they are because subst_parse_string() turns Qstring tokens
+             * they are because subst_parse_str() turns Qstring tokens
              * into String tokens and for unquoted parameter expansions the
              * lexer normally does tokenize patterns inside parameter
              * expansions). */


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