* maint:
portability: Disable support for long double in snprintf replacement
portability: Handle system *sprintf functions with bad type signatures
portability: Add Holger Weiß's improved snprintf replacement
Several months ago I reported a problem with NFS corruption from three
simultaneous NFS users of ccache on the same file; two writers to the cache
and one reader.
I believe I have tracked this issue down to a race related to the use of
unlink. On NFS, unlink() is NOT atomic; so what seemed to be happening was
the second writer unlink()ed the first's object, then the reader got the
partially unlinked (truncated) object.
The following patch fixes this issue by always calling rename before a
unlink - a new x_unlink function. There are some places where temp files
are being unlinked; for performance these can remain as the ordinary
unlink.
Several months ago I reported a problem with NFS corruption from three
simultaneous NFS users of ccache on the same file; two writers to the cache
and one reader.
I believe I have tracked this issue down to a race related to the use of
unlink. On NFS, unlink() is NOT atomic; so what seemed to be happening was
the second writer unlink()ed the first's object, then the reader got the
partially unlinked (truncated) object.
The following patch fixes this issue by always calling rename before a
unlink - a new x_unlink function. There are some places where temp files
are being unlinked; for performance these can remain as the ordinary
unlink.
This has two benefits:
- It's more robust against file changes during reading.
- It improves performance on poor systems where mmap() doesn't use the disk
cache.
When writing a stats file, locking is now done by atomically creating a
symlink with lockfile_acquire() instead of locking with fcntl(). Updating
of the stats file while holding the lock is done using the
rename-into-place idiom since the lock may be intentionally broken by
another process, and if that happens, there should be no file corruption,
only lost information.
The major reason for the change is to be more robust against badly
implemented or configured network filesystems (e.g. NFS) where POSIX locks
may be broken in different ways.