On Fri, 12 Dec 2025, Pali Rohár wrote:

It differs in few minutes for "." entry. I guess that this can happen
when log file t_findfirst.log is being written to the current directory
which can affect ctime of ".". Probably same problem can happen also for
"..".

It is quite tricky to find out which entries could be modified during
current the test. It can depends on fs caches or other unknown things.
I remember that I read somewhere that FindFirstFile can return cached
values.

Quick fix which avoids this test for . and .. entries:


diff --git a/mingw-w64-crt/testcases/t_findfirst.c 
b/mingw-w64-crt/testcases/t_findfirst.c
index de88f6a19979..b8932c359c37 100644
--- a/mingw-w64-crt/testcases/t_findfirst.c
+++ b/mingw-w64-crt/testcases/t_findfirst.c
@@ -17,8 +17,8 @@
    fprintf (stderr, "Error: Function %s" F " failed: errno=%d (%s)\n", 
#STATFUNC, d.name, errno, strerror (errno)); \
    return 1; \
  } \
-  if (STRCMPAW(d.name, "t_findfirst.log") == 0) { \
-    fprintf (stderr, "Skipping file t_findfirst.log as it is being changed during 
the test\n"); \
+  if (STRCMPAW(d.name, ".") == 0 || STRCMPAW(d.name, "..") == 0 || STRCMPAW(d.name, 
"t_findfirst.log") == 0) { \
+    fprintf (stderr, "Skipping entry " F " as it is being changed during the 
test\n", d.name); \
  } else { \
    if (st.st_atime != d.time_access) { \
      fprintf (stderr, "Error: " F ": %s st_atime (%I64d) differs from %s 
time_access (%I64d)\n", d.name, #STATFUNC, (long long)st.st_atime, #FINDFUNC, (long 
long)d.time_access); \

Now with this in place, I'm getting more errors later:


Skipping entry . as it is being changed during the test
Skipping entry . as it is being changed during the test
Skipping entry . as it is being changed during the test
Skipping entry . as it is being changed during the test
Skipping entry . as it is being changed during the test
Skipping entry . as it is being changed during the test
Skipping entry . as it is being changed during the test
Skipping entry . as it is being changed during the test
Skipping entry .. as it is being changed during the test
Skipping entry .. as it is being changed during the test
Skipping entry .. as it is being changed during the test
Skipping entry .. as it is being changed during the test
Skipping entry .. as it is being changed during the test
Skipping entry .. as it is being changed during the test
Skipping entry .. as it is being changed during the test
Skipping entry .. as it is being changed during the test
Error: complex:stat st_ctime (1765576697) differs from _findnext64i32 time_write (1765576704)

// Martin

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to