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

Re: Bug / error in manpage.



On Tue, 2 Oct 2012 18:39:31 +0000
Larry Schrof <larrys@xxxxxx> wrote:
> Agreed - I was thinking it was probably a matter of time before one of you
> came
> up with a good example.
> 
> Are you thinking mentioning angle-brackets needing special quoting, or are
> you thinking about just removing mention of them from that section of
> the manpage?

I was going to mention the problem...

Index: Doc/Zsh/params.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/params.yo,v
retrieving revision 1.71
diff -p -u -r1.71 params.yo
--- Doc/Zsh/params.yo	21 Sep 2012 12:45:27 -0000	1.71
+++ Doc/Zsh/params.yo	2 Oct 2012 19:59:27 -0000
@@ -182,7 +182,10 @@ to the matching closing one is considere
 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:
 
Index: Src/lex.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/lex.c,v
retrieving revision 1.71
diff -p -u -r1.71 lex.c
--- Src/lex.c	2 Oct 2012 12:46:46 -0000	1.71
+++ Src/lex.c	2 Oct 2012 19:59:27 -0000
@@ -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:
Index: Test/A04redirect.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/A04redirect.ztst,v
retrieving revision 1.23
diff -p -u -r1.23 A04redirect.ztst
--- Test/A04redirect.ztst	8 Dec 2011 15:55:11 -0000	1.23
+++ Test/A04redirect.ztst	2 Oct 2012 19:59:27 -0000
@@ -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
Index: Test/D06subscript.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/D06subscript.ztst,v
retrieving revision 1.14
diff -p -u -r1.14 D06subscript.ztst
--- Test/D06subscript.ztst	2 Oct 2012 12:46:46 -0000	1.14
+++ Test/D06subscript.ztst	2 Oct 2012 19:59:27 -0000
@@ -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

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



Messages sorted by: Reverse Date, Date, Thread, Author