Hi Collin,

> I also added the two test cases to gnulib, that way we can catch any
> other platforms that have a bug like this, or regressions.

I see the added test fail on Cygwin and native Windows. So I decided
to take a closer look.

First, let's listen to this advice from the HACKING file:

  A unit test can have many sub-tests. Try to make the sub-tests independent
  of each other, so that it becomes easy to disable some sub-tests by enclosing
  them in #if 0 ... #endif. 


2025-10-15  Bruno Haible  <[email protected]>

        glob tests: Improve maintainability.
        * tests/test-glob.c (main): Make the second added test independent from
        the first one.

diff --git a/tests/test-glob.c b/tests/test-glob.c
index 140a2b10f5..7b3439b6cd 100644
--- a/tests/test-glob.c
+++ b/tests/test-glob.c
@@ -110,12 +110,13 @@ main ()
       globfree (&g);
 
       /* "/*/////sh".  */
+      memset (pattern, '/', 9997);
       pattern[1] = '*';
-      pattern[9997] = 's';
-      pattern[9998] = 'h';
+      strcpy (pattern + 9997, "sh");
       res = glob (pattern, 0, NULL, &g);
       ASSERT (res == 0);
       globfree (&g);
+
       free (pattern);
     }
 




Reply via email to