Hi Eric,
* Eric Blake wrote on Sat, Aug 14, 2010 at 07:20:45PM CEST:
On 08/14/2010 12:32 AM, Ralf Wildenhues wrote:
This patch fixes a long-standing issue GCC has with Autoconf: cache
files are not updated atomically. (This was IIUC the primary reason
GCC introduced per-configure cache files.)
There's a small chance of a leftover file in the directory where the
cache file resides, when a signal arrives at the right time. Not sure
if that's worth changing the exit trap, that wasn't done for the
'confcache' file either; but of course, the latter would be cleaned up
after another configure run. OTOH, the exit trap could then open up a
symlink attack upon '--cache-file=/tmp/config.cache'.
Is it worth documenting that such a scratch file is safe to delete?
Hey, I was trying to get you to decide all the hard questions! ;-)
I'm really reluctant to admit defeat in public, as in:
* doc/autoconf.texi (Cache Files): Leftover temporary cache
files may be deleted by the user.
+# Using a symlinked cache file works.
+:> cache
+rm -f config.cache
+AS_LN_S([cache], [config.cache])
+AT_CHECK_CONFIGURE([-C])
+AT_CHECK([test -s cache || test ! -h config.cache])
Will this test work on mingw, which lacks symlinks?
Yes. I verified that now on MSYS and Cygwin.
Do we need to add an extra check before AT_CHECK_CONFIGURE that skips
if config.cache is not a symlink?
No, because the last AT_CHECK is designed to catch both cases. I've
added a comment to this end now, see below.