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

PATCH: bug in length of saved glob flags in pattern



Pierre-Emmanuel Andrà let me into his Solaris 64 system to trace a
persistent failure, which proved interesting.  It's quite surprsing it
didn't fail on more 64-bit systems.

I think this is the last thing I need to do before 4.3.10.

Index: Src/pattern.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/pattern.c,v
retrieving revision 1.49
diff -u -r1.49 pattern.c
--- Src/pattern.c	15 Nov 2008 21:27:46 -0000	1.49
+++ Src/pattern.c	29 May 2009 20:57:45 -0000
@@ -668,7 +668,8 @@
 {
     long starter, br, ender, excsync = 0;
     int parno = 0;
-    int flags, gfchanged = 0, savglobflags = patglobflags;
+    int flags, gfchanged = 0;
+    long savglobflags = (long)patglobflags;
     Upat ptr;
 
     *flagp = 0;
@@ -688,7 +689,7 @@
     br = patnode(P_BRANCH);
     if (!patcompbranch(&flags))
 	return 0;
-    if (patglobflags != savglobflags)
+    if (patglobflags != (int)savglobflags)
 	gfchanged++;
     if (starter)
 	pattail(starter, br);
@@ -777,7 +778,7 @@
 		    patadd((char *)&up, 0, sizeof(union upat), 0);
 		}
 	    } else {
-		patglobflags = savglobflags;
+		patglobflags = (int)savglobflags;
 	    }
 	}
 	newbr = patcompbranch(&flags);
@@ -792,7 +793,7 @@
 	    return 0;
 	if (gfnode)
 	    pattail(gfnode, newbr);
-	if (!tilde && patglobflags != savglobflags)
+	if (!tilde && patglobflags != (int)savglobflags)
 	    gfchanged++;
 	pattail(starter, br);
 	if (excsync)
@@ -831,7 +832,7 @@
 	 * a later branch happened to put the flags back.
 	 */
 	pattail(ender, patnode(P_GFLAGS));
-	patglobflags = savglobflags;
+	patglobflags = (int)savglobflags;
 	patadd((char *)&savglobflags, 0, sizeof(long), 0);
     }
 
-- 
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