autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Try to update config.cache atomically; respect symlinks.


From: Eric Blake
Subject: Re: Try to update config.cache atomically; respect symlinks.
Date: Fri, 27 Aug 2010 11:36:08 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.2

On 08/16/2010 02:03 PM, Ralf Wildenhues wrote:
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.

I think the problem is rare enough, and agree with your sentiment of not documenting it (at least, not for now). Maybe if we ever get reports of someone wondering about stale files...

And I agree that an exit trap to remove files in a remote directory exposes symlink removal attacks, so it's not worth adding.

+# 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.

Looks good with that comment; I'm okay if you go ahead and apply this patch.

--
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]