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

Re: Lots of test failures when --disable-multibyte



On Mon, Apr 4, 2022 at 3:00 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> Was testing: Zero-length string match in parameter substitution
>
> Plus the one immediately after it (Zero-length string match at end).
>
> I'm going to have to leave those one to someone else.

Actually this turned out to be pretty trivial, the git revision on the
test cases made it possible to find the previous patches to the
multibyte code and then copy to the corresponding spot.

diff --git a/Src/glob.c b/Src/glob.c
index ca28f20e8..400be12d5 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -3331,7 +3331,7 @@ 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;
+        for (ioff = 0, t = s, umlen = uml; t <= send;
          ioff++, t++, umlen--) {
         set_pat_start(p, t-s);
         if (pattrylen(p, t, send - t, umlen, &patstralloc, ioff)) {
@@ -3362,7 +3362,7 @@ igetmatch(char **sp, Patprog p, int fl, int n,
char *replstr,
         do {
         /* loop over all matches for global substitution */
         matched = 0;
-        for (; t < send; t++, ioff++, umlen--) {
+        for (; t <= send; t++, ioff++, umlen--) {
             /* Find the longest match from this position. */
             set_pat_start(p, t-s);
             if (pattrylen(p, t, send - t, umlen, &patstralloc, ioff)) {




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