about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2014-08-04 19:52:50 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2014-08-04 19:52:50 +0100
commit6116f1dafa412d6ac6da347719f7ddae57b5e446 (patch)
treef158173672c1674668c3921facf2d484d6d143b5
parentb516dc37ac00f6f9627a360d54a7a612d945375c (diff)
downloadzsh-6116f1dafa412d6ac6da347719f7ddae57b5e446.tar.gz
zsh-6116f1dafa412d6ac6da347719f7ddae57b5e446.tar.xz
zsh-6116f1dafa412d6ac6da347719f7ddae57b5e446.zip
32954 plus new test: [[ ... = ...(#q...) ]] shouldn't force a glob.
The (#q...) expression should simply be removed to leave a normal pattern
as before
-rw-r--r--ChangeLog4
-rw-r--r--Src/cond.c3
-rw-r--r--Test/D02glob.ztst7
3 files changed, 10 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 0de5a9551..f47570672 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2014-08-04  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
+	* 32954 (plus new test): Src/cond.c, Test/D02glob.ztst:
+	(#q) on patterns with [[ ... = ... ] and [[ ... != ... ]]
+	shouldn't force a glob, it should simply be ignored.
+
 	* unposted: Src/subst.c:  remove unused variables.
 
 2014-08-04  Mikael Magnusson  <mikachu@gmail.com>
diff --git a/Src/cond.c b/Src/cond.c
index 3807409e3..df9065660 100644
--- a/Src/cond.c
+++ b/Src/cond.c
@@ -297,8 +297,7 @@ evalcond(Estate state, char *fromtest)
 
 		right = dupstring(opat = ecrawstr(state->prog, state->pc,
 						  &htok));
-		if (htok)
-		    cond_subst(&right, !fromtest);
+		singsub(&right);
 		save = (!(state->prog->flags & EF_HEAP) &&
 			!strcmp(opat, right) && pprog != dummy_patprog2);
 
diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst
index 358c93413..4697ca414 100644
--- a/Test/D02glob.ztst
+++ b/Test/D02glob.ztst
@@ -533,14 +533,12 @@
     cd glob.tmp
     [[ -n a*(#qN) ]] && print File beginning with a
     [[ -z z*(#qN) ]] && print No file beginning with z
-    [[ "a b c" = ?(#q) ]] && print Multiple files matched
     setopt nonomatch
     [[ -n z*(#q) ]] && print Normal string if nullglob not set
   )
 0:Force glob expansion in conditions using (#q)
 >File beginning with a
 >No file beginning with z
->Multiple files matched
 >Normal string if nullglob not set
 
  (){ print $#@ } glob.tmp/dir*(Y1)
@@ -562,3 +560,8 @@
 >Globs before last path component
 >Respects qualifiers
 >Argument required
+
+  [[ "ce fichier n'existe pas"  = (#b)ce\ (f[^ ]#)\ *s(#q./) ]]
+  print $match[1]
+0:(#q) is ignored completely in conditional pattern matching
+>fichier