about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2001-07-06 09:23:55 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2001-07-06 09:23:55 +0000
commit4a8b8bd7522df86d74bbfdb9c1086ae64ad6f861 (patch)
treec50eb9c77a092b5efb8c2739cf0c700d0a389e21 /Src
parent40e17d980fd478b91cbfaeedfd3a887ada443cd5 (diff)
downloadzsh-4a8b8bd7522df86d74bbfdb9c1086ae64ad6f861.tar.gz
zsh-4a8b8bd7522df86d74bbfdb9c1086ae64ad6f861.tar.xz
zsh-4a8b8bd7522df86d74bbfdb9c1086ae64ad6f861.zip
15277: Src/glob.c: real backreferencing bug with ${(S)...%%...}
Diffstat (limited to 'Src')
-rw-r--r--Src/glob.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/Src/glob.c b/Src/glob.c
index 5be79329b..2f64434c4 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -2236,16 +2236,17 @@ igetmatch(char **sp, Patprog p, int fl, int n, char *replstr)
 	    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)