about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-05-29 16:06:47 +0100
committerPeter Stephenson <pws@zsh.org>2015-05-29 16:06:47 +0100
commite88610b786461f4e7f6a51f084d5aaae0e8ecd85 (patch)
treeaf58e0fa45df48e5a92f5e70937129df078a23c7
parentd9243734e1df5ae56ecf15ccd4f0d2ed1f5a0017 (diff)
downloadzsh-e88610b786461f4e7f6a51f084d5aaae0e8ecd85.tar.gz
zsh-e88610b786461f4e7f6a51f084d5aaae0e8ecd85.tar.xz
zsh-e88610b786461f4e7f6a51f084d5aaae0e8ecd85.zip
35326: $#- was misparsed as ${#-}
-rw-r--r--ChangeLog7
-rw-r--r--Src/subst.c2
-rw-r--r--Test/D04parameter.ztst5
3 files changed, 11 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 2c9c3d226..f379ddb19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,10 @@
 2015-05-29  Peter Stephenson  <p.stephenson@samsung.com>
 
-	* 20237: Src/Modules/parameter.c: $functions[foo] shouldn't be
-	unmetafied when passed as parameter body.
+	* 35326: Src/subst.c, Test/D04parameter.ztst: $#- was misparsed
+	as ${#-}.
+
+	* users/20237: Src/Modules/parameter.c: $functions[foo]
+	shouldn't be unmetafied when passed as parameter body.
 
 2015-05-28  Daniel Hahler  <zsh@thequod.de>
 
diff --git a/Src/subst.c b/Src/subst.c
index d4a04b8e5..168f7f156 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -2170,7 +2170,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags)
 		     */
 		    || ((cc == '#' || cc == Pound) &&
 			s[2] == Outbrace)
-		    || cc == '-' || (cc == ':' && s[2] == '-')
+		    || (inbrace && (cc == '-' || (cc == ':' && s[2] == '-')))
 		    || (isstring(cc) && (s[2] == Inbrace || s[2] == Inpar)))) {
 	    getlen = 1 + whichlen, s++;
 	    /*
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index d96ffb64f..c41e05ed3 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -1703,3 +1703,8 @@
   funnychars='The qu*nk br!wan f@x j/mps o[]r \(e la~# ^"&;'
   [[ $funnychars = ${~${(b)funnychars}} ]]
 0:${(b)...} quoting protects from GLOB_SUBST
+
+  set --
+  print $#-1
+0:Avoid confusion after overloaded characters in braceless substitution
+>0-1