about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2012-10-03 18:11:12 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2012-10-03 18:11:12 +0000
commit61b9529ff848d6758b498389256111984bda1437 (patch)
tree1b52a789c476386ebfdfb1f3ed28bd05b69d5ada
parent76590bd93c438bb1f4dc3dc17fa478ab15533fef (diff)
downloadzsh-61b9529ff848d6758b498389256111984bda1437.tar.gz
zsh-61b9529ff848d6758b498389256111984bda1437.tar.xz
zsh-61b9529ff848d6758b498389256111984bda1437.zip
users/17310: we can't treat < after [ as a normal character.
Document problem and test for case that needs to work.
-rw-r--r--ChangeLog9
-rw-r--r--Doc/Zsh/params.yo5
-rw-r--r--Src/lex.c4
-rw-r--r--Test/A04redirect.ztst3
-rw-r--r--Test/D06subscript.ztst20
5 files changed, 17 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 681fd10e9..0d68f729f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-10-03  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* users/17310: Doc/Zsh/params.yo, Src/lex.c, Test/A04redirect.ztst,
+	Test/D06subscript.ztst: back off users/17304 owing to problem
+	with [ command, document problem, and test the case that needs
+	to work.
+
 2012-10-02  Peter Stephenson  <pws@csr.com>
 
 	* users/17304: Src/lex.c, Test/D06subscript.ztst: angle brackets
@@ -207,5 +214,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5731 $
+* $Revision: 1.5732 $
 *****************************************************
diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index bf9a68ba8..b7b7750ff 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -182,7 +182,10 @@ to the matching closing one is considered to be a list of flags, as in
 The flags tt(s), tt(n) and tt(b) take an argument; the delimiter
 is shown below as `tt(:)', but any character, or the matching pairs
 `tt(LPAR())...tt(RPAR())', `tt({)...tt(})', `tt([)...tt(])', or
-`tt(<)...tt(>)', may be used.
+`tt(<)...tt(>)', may be used, but note that `tt(<)...tt(>)' can only be
+used if the subscript is inside a double quoted expression or a
+parameter substitution enclosed in braces as otherwise the expression is
+interpreted as a redirection.
 
 The flags currently understood are:
 
diff --git a/Src/lex.c b/Src/lex.c
index d02b3885a..1cf3611c9 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -1218,7 +1218,7 @@ gettokstr(int c, int sub)
 		c = Comma;
 	    break;
 	case LX2_OUTANG:
-	    if (in_brace_param || sub || brct)
+	    if (in_brace_param || sub)
 		break;
 	    e = hgetc();
 	    if (e != '(') {
@@ -1255,7 +1255,7 @@ gettokstr(int c, int sub)
 		break;
 	    }
 	    lexstop = 0;
-	    if (in_brace_param || sub || brct)
+	    if (in_brace_param || sub)
 		break;
 	    goto brk;
 	case LX2_EQUALS:
diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst
index 3911b0629..d3c0a4a99 100644
--- a/Test/A04redirect.ztst
+++ b/Test/A04redirect.ztst
@@ -441,3 +441,6 @@
 0:failed assignment on non-posix-special, POSIX_BUILTINS
 >output
 ?zsh: read-only variable: foo
+
+  [</dev/null ]
+1:check behaviour with square brackets
diff --git a/Test/D06subscript.ztst b/Test/D06subscript.ztst
index f91d62f2f..cffca742e 100644
--- a/Test/D06subscript.ztst
+++ b/Test/D06subscript.ztst
@@ -249,23 +249,3 @@
   string[0]=!
 1:Can't set only element zero of string
 ?(eval):1: string: assignment to invalid subscript range
-
-  string="Life,+like+a+dome+of+many-colour'd+glass"
-  for delims in "()" "{}" "[]" "<>"; do
-    eval 'print ${string[(ws'$delims[1]'+'$delims[2]')2]}'
-    eval 'print $string[(ws'$delims[1]'+'$delims[2]')3]'
-    eval 'print "$string[(ws'$delims[1]'+'$delims[2]')4]"'
-  done
-0:Check matched delimiters in subscripts
->like
->a
->dome
->like
->a
->dome
->like
->a
->dome
->like
->a
->dome