summaryrefslogtreecommitdiffstats
path: root/Src/glob.c
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2026-06-04 06:44:16 +0200
committerMikael Magnusson <mikachu@gmail.com>2026-06-07 12:45:30 +0200
commitdda9d01fde4f6d692c1d66f458583abd0f084ef3 (patch)
tree9ceb96463b378bf9f27ed0b4e030cf7ee2691e97 /Src/glob.c
parent54670: don't cache the user saying --disable-multibyte as meaning multibyte s... (diff)
downloadzsh-dda9d01fde4f6d692c1d66f458583abd0f084ef3.tar
zsh-dda9d01fde4f6d692c1d66f458583abd0f084ef3.tar.gz
zsh-dda9d01fde4f6d692c1d66f458583abd0f084ef3.tar.bz2
zsh-dda9d01fde4f6d692c1d66f458583abd0f084ef3.tar.lz
zsh-dda9d01fde4f6d692c1d66f458583abd0f084ef3.tar.xz
zsh-dda9d01fde4f6d692c1d66f458583abd0f084ef3.tar.zst
zsh-dda9d01fde4f6d692c1d66f458583abd0f084ef3.zip
54671: fix anchored pattern with --disable-multibyte
Just copied this code over from the multibyte branch.
Diffstat (limited to 'Src/glob.c')
-rw-r--r--Src/glob.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/Src/glob.c b/Src/glob.c
index e9967cad1..5c6288060 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -3350,13 +3350,23 @@ igetmatch(char **sp, Patprog p, int fl, int n, char *replstr,
/* Largest possible match at tail of string: *
* move forward along string until we get a match. *
* Again there's no optimisation. */
- for (ioff = 0, t = s, umlen = uml; t <= send;
- ioff++, t++, umlen--) {
+ for (ioff = 0, t = s, umlen = uml; t <= send; ioff++) {
set_pat_start(p, t-s);
if (pattrylen(p, t, send - t, umlen, &patstralloc, ioff)) {
*sp = get_match_ret(&imd, t-s, uml);
return 1;
}
+ if (fl & SUB_START)
+ break;
+ if (t == send)
+ break;
+ t++;
+ umlen--;
+ }
+ if (!(fl & SUB_START) && pattrylen(p, send, 0, 0,
+ &patstralloc, ioff)) {
+ *sp = get_match_ret(&imd, uml, uml);
+ return 1;
}
break;