Eli Zaretskii wrote: > Looking at your test program, I see that you generate the seconds file > name without deleting the first one. When a file by the first > generated name already exists, gen_tempname will indeed generate a > different name. But in the scenario I described, Emacs creates one > temporary file, uses it, then deletes it, and only after that creates > another file. I'm adding this scenario to the unit test. Still, the unit test succeeds when run once on: Linux, FreeBSD, NetBSD, OpenBSD, macOS, Solaris, Cygwin, native Windows. Since this contradicts what you debugged on mingw, I ran the test 10000 times on native Windows. Result: - on 32-bit mingw, no failure. - on 64-bit mingw, around 30 failures (or around 10 failures with Paul's newest patch). That is, a probability of ca. 0.3% of getting the same file name as on the previous call. Bruno