about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--Src/glob.c9
-rw-r--r--Src/pattern.c3
3 files changed, 13 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 3220b6291..88dad0284 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-09-23  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 31764 (with correction of sense of a test): Src/glob.c,
+	Src/pattern.c: use of array before initialisation wreaked havoc
+	in detecting glob qualifiers.
+
 2013-09-22  m0viefreak  <m0viefreak.cm@googlemail.com>
 
 	* 31754: Completion/Unix/Command/_git: _git: git rm: make git rm
diff --git a/Src/glob.c b/Src/glob.c
index 9299b95ea..e0d0cf68e 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -1112,7 +1112,8 @@ zglob(LinkList list, LinkNode np, int nountok)
     gf_pre_words = NULL;
 
     /* Check for qualifiers */
-    while (!nobareglob || zpc_special[ZPC_HASH] != Marker) {
+    while (!nobareglob ||
+	   (isset(EXTENDEDGLOB) && !zpc_disables[ZPC_HASH])) {
 	struct qual *newquals;
 	char *s;
 	int sense, paren;
@@ -1158,11 +1159,11 @@ zglob(LinkList list, LinkNode np, int nountok)
 	    case Outpar:
 		paren++; /*FALLTHROUGH*/
 	    case Bar:
-		if (zpc_special[ZPC_BAR] != Marker)
+		if (!zpc_disables[ZPC_BAR])
 		    nobareglob = 1;
 		break;
 	    case Tilde:
-		if (zpc_special[ZPC_TILDE] != Marker)
+		if (isset(EXTENDEDGLOB) && !zpc_disables[ZPC_TILDE])
 		    nobareglob = 1;
 		break;
 	    case Inpar:
@@ -1172,7 +1173,7 @@ zglob(LinkList list, LinkNode np, int nountok)
 	}
 	if (*s != Inpar)
 	    break;
-	if (s[1] == zpc_special[ZPC_HASH]) {
+	if (isset(EXTENDEDGLOB) && !zpc_disables[ZPC_HASH] && s[1] == Pound) {
 	    if (s[2] == 'q') {
 		*s = 0;
 		s += 2;
diff --git a/Src/pattern.c b/Src/pattern.c
index b7897e75c..4f0166bfa 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -245,7 +245,8 @@ static const char *zpc_strings[ZPC_COUNT] = {
  * Corresponding array of pattern disables as set by the user
  * using "disable -p".
  */
-static char zpc_disables[ZPC_COUNT];
+/**/
+char zpc_disables[ZPC_COUNT];
 
 /*
  * Stack of saved (compressed) zpc_disables for function scope.