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

Re: Test Failures Latest CVS



"Bart Schaefer" wrote:
> The question is, -should- it have been changed?
> ... difficult to understand ...
> ... This seems backwards to me. ...
> ... always before it has been the case ...

One real bug turned up here, at least.  This is after removing that patch.

% foo='where i walked lizards wandered here and there around'
% print ${(S)foo%%(#b)(h*e)} 
where i walked lizards wandered here and t around
% print ${foo[$mbegin,$mend]}
ere 
% print $mbegin
-10
% print $mend
-7

Those should always be positive; the fact they appear close to correct when
counting backwards is a coincidence.

Index: Src/glob.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/glob.c,v
retrieving revision 1.19
diff -u -r1.19 glob.c
--- Src/glob.c	2001/07/06 09:03:48	1.19
+++ Src/glob.c	2001/07/06 09:14:49
@@ -2236,16 +2236,17 @@
 	    break;
 
 	case (SUB_END|SUB_SUBSTR):
-	    /* Shortest at end with substrings */
-	    patoffset = ml;
-	    set_pat_start(p, l);
-	    if (pattry(p, s + l) && !--n) {
-		*sp = get_match_ret(*sp, l, l, fl, replstr);
-		patoffset = 0;
-		return 1;
-	    } /* fall through */
 	case (SUB_END|SUB_LONG|SUB_SUBSTR):
 	    /* Longest/shortest at end, matching substrings.       */
+	    patoffset = ml;
+	    if (!(fl & SUB_LONG)) {
+		set_pat_start(p, l);
+		if (pattry(p, s + l) && !--n) {
+		    *sp = get_match_ret(*sp, l, l, fl, replstr);
+		    patoffset = 0;
+		    return 1;
+		}
+	    }
 	    patoffset--;
 	    for (t = s + l - 1; t >= s; t--, patoffset--) {
 		if (t > s && t[-1] == Meta)

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************



Messages sorted by: Reverse Date, Date, Thread, Author