summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-04-26 09:51:27 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-04-26 09:51:27 +0000
commitba1a54551601f996c9fa6a44c6bd6b8b0f5ca53a (patch)
treed99b621286b51178db80de5bd5220738f428f5f1
parentce49d62d45278b2fe559b180ba6ef870215b2037 (diff)
downloadzsh-ba1a54551601f996c9fa6a44c6bd6b8b0f5ca53a.tar.gz
zsh-ba1a54551601f996c9fa6a44c6bd6b8b0f5ca53a.tar.xz
zsh-ba1a54551601f996c9fa6a44c6bd6b8b0f5ca53a.zip
21194: fix handling of zero-length quoted test strings for patterns
-rw-r--r--ChangeLog6
-rw-r--r--Src/pattern.c4
-rw-r--r--Test/D04parameter.ztst5
3 files changed, 14 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2b63a50ab..fde7347c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-04-26  Peter Stephenson  <pws@csr.com>
+
+	* 21195 (c.f. 21194 from Bart): Src/pattern.c,
+	Test/D04parameter.ztst: 21170 broke handling of zero-length
+	quoted test strings.
+
 2005-04-25  Peter Stephenson  <pws@csr.com>
 
 	* 21184: Test/B04read.ztst: test for foregoing fix.
diff --git a/Src/pattern.c b/Src/pattern.c
index 1033c776f..ed88bb7ce 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -1552,8 +1552,10 @@ pattryrefs(Patprog prog, char *string, int stringlen, int unmetalen,
 	*nump = 0;
     }
     /* inherited from domatch, but why, exactly? */
-    if (*string == Nularg)
+    if (*string == Nularg) {
 	string++;
+	unmetalen--;
+    }
 
     if (stringlen < 0)
 	stringlen = strlen(string);
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 5700a0722..7f2ed4670 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -599,3 +599,8 @@
 >said
 >i
 >willJOYCE
+
+  foo=
+  print "${${foo}/?*/replacement}"
+0:Quoted zero-length strings are handled properly
+>