about summary refs log tree commit diff
path: root/Src/pattern.c
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2013-12-16 22:20:06 +0000
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2013-12-16 22:20:06 +0000
commitdb23c630051fe330782cda4089a16de7ec579f29 (patch)
treea5116fd1f42c7d42b5490d169a054a344731bf82 /Src/pattern.c
parentf06851f50d78b17a45159976aa167682ffdb87c2 (diff)
downloadzsh-db23c630051fe330782cda4089a16de7ec579f29.tar.gz
zsh-db23c630051fe330782cda4089a16de7ec579f29.tar.xz
zsh-db23c630051fe330782cda4089a16de7ec579f29.zip
32136: fix problem with kshglob.
Non-pattern characters that could be followed by "(" to introduce
a ksh glob but weren't caused failures.
Diffstat (limited to 'Src/pattern.c')
-rw-r--r--Src/pattern.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/Src/pattern.c b/Src/pattern.c
index a7ef12573..b79c3b444 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -1265,12 +1265,18 @@ patcomppiece(int *flagp, int paren)
 	     * the character following is an end-of-segment character.  Thus
 	     * tildes are not special if there is nothing following to
 	     * be excluded.
+	     *
+	     * Don't look for X()-style kshglobs at this point; we've
+	     * checked above for the case with parentheses and we don't
+	     * want to match without parentheses.
 	     */
-	    if (kshchar || (memchr(zpc_special, *patparse, ZPC_COUNT) &&
-			    (*patparse != zpc_special[ZPC_TILDE] ||
-			     patparse[1] == '/' ||
-			     !memchr(zpc_special, patparse[1], ZPC_SEG_COUNT))))
+	    if (kshchar ||
+		(memchr(zpc_special, *patparse, ZPC_NO_KSH_GLOB) &&
+		 (*patparse != zpc_special[ZPC_TILDE] ||
+		  patparse[1] == '/' ||
+		  !memchr(zpc_special, patparse[1], ZPC_SEG_COUNT)))) {
 		break;
+	    }
     	}
 
 	/* Remember the previous character for backtracking */