On Wed, 22 Jul 2020 18:38:42 +0200, Theo Buehler wrote: > Likely glob. Many glob implementations were found to suffer from > complexity issues: https://research.swtch.com/glob > > The glob(3) in libc was fixed > https://github.com/openbsd/src/commit/5c36dd0c22429e7b00ed5df80ed1383807532b5 > 9 > but ksh's builtin glog still has the issue.
At the very least we should collapse consecutive stars. This is a separate issue from making gmatch() iterative. - todd Index: bin/ksh/misc.c =================================================================== RCS file: /cvs/src/bin/ksh/misc.c,v retrieving revision 1.74 diff -u -p -u -r1.74 misc.c --- bin/ksh/misc.c 7 Jul 2020 10:33:58 -0000 1.74 +++ bin/ksh/misc.c 22 Jul 2020 19:08:20 -0000 @@ -615,6 +615,9 @@ do_gmatch(const unsigned char *s, const break; case '*': + /* collapse consecutive stars */ + while (ISMAGIC(p[0]) && p[1] == '*') + p += 2; if (p == pe) return 1; s--;