Summary: | Fun with scratch files on Windows MKTEMP only allows for 26 files | ||
---|---|---|---|
Product: | gcc | Reporter: | Tobias Burnus <burnus> |
Component: | libfortran | Assignee: | Francois-Xavier Coudert <fxcoudert> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | fxcoudert, hjl.tools, jb, jvdelisle2 |
Priority: | P3 | Keywords: | patch |
Version: | 4.6.0 | ||
Target Milestone: | --- | ||
URL: | http://gcc.gnu.org/ml/fortran/2011-03/msg00102.html | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2011-03-12 15:22:42 |
Description
Tobias Burnus
2011-01-24 17:05:13 UTC
Seems the reason for Windows _mktemp() behavior is due to replicating some age-old BSD behavior. From the Linux mktemp(3) manpage: BUGS Never use mktemp(). Some implementations follow 4.3BSD and replace XXXXXX by the current process ID and a single letter, so that at most 26 different names can be returned. Since on the one hand the names are easy to guess, and on the other hand there is a race between testing whether the name exists and opening the file, every use of mktemp() is a security risk. The race is avoided by mkstemp(3). (Needless to say, libgfortran use mkstemp() ifavailable, mktemp() is just a fallback.) A patch for the first half of the PR can be found here: http://gcc.gnu.org/ml/fortran/2011-03/msg00102.html Author: fxcoudert Date: Sat Mar 19 12:09:27 2011 New Revision: 171178 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171178 Log: PR libfortran/47439 * io/unix.c (tempfile): Work around poor mktemp() implementations. * gfortran.dg/scratch_1.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/scratch_1.f90 Modified: trunk/gcc/testsuite/ChangeLog trunk/libgfortran/ChangeLog trunk/libgfortran/io/unix.c On Linux/ia32, revision 171179 gave: FAIL: gfortran.dg/scratch_1.f90 -O0 execution test FAIL: gfortran.dg/scratch_1.f90 -O1 execution test FAIL: gfortran.dg/scratch_1.f90 -O2 execution test FAIL: gfortran.dg/scratch_1.f90 -O3 -fomit-frame-pointer execution test FAIL: gfortran.dg/scratch_1.f90 -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions execution test FAIL: gfortran.dg/scratch_1.f90 -O3 -fomit-frame-pointer -funroll-loops execution test FAIL: gfortran.dg/scratch_1.f90 -O3 -g execution test FAIL: gfortran.dg/scratch_1.f90 -Os execution test Author: fxcoudert Date: Sat Mar 19 14:35:05 2011 New Revision: 171180 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171180 Log: PR libfortran/47439 * gfortran.dg/scratch_1.f90: Adjust test. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/scratch_1.f90 (In reply to comment #4) > FAIL: gfortran.dg/scratch_1.f90 -O0 execution test Must be a limit on the number of concurrently open files (the test checks for 3000). Next commit fixed it. |