> From: Bruno Haible <br...@clisp.org> > Cc: bug-gnulib@gnu.org, la...@gnus.org, 57...@debbugs.gnu.org, > jporterb...@gmail.com > Date: Sun, 21 Aug 2022 18:20:52 +0200 > > I changed test-tempname.c to skip the case 1 and execute only case 2, and > added printf statements per the attached tempname.c.diff. Then ran > $ for i in `seq 1000`; do ./test-tempname.exe; done 2>&1 | tee out1000 > > In 32-bit mingw, the result is fully deterministic: each run behaves the same. > The first file name is always gl-temp-3FXzHa.xyz; > the second file name is always gl-temp-HgtmVy.xyz. > > Thus, for a single Emacs process, things will look fine, but as soon as > someone > starts to use temporary files in two different Emacs processes, in the way Eli > described, there will be massive collisions. > > In 64-bit mingw, the 'tempname 1' value is deterministic. This simply shows > that Windows 10 does not use address space randomization (ASLR).
Some of these problems could be alleviated if the initial value of 'v' depended on something non-deterministic, like the program's PID and/or the current wallclock time (no need to use anything as fancy as clock_gettime, a simple call to 'clock' should be enough).