[ccache] integrity

Joel Rosdahl joel at rosdahl.net
Sat Oct 12 12:12:44 MDT 2013

On 7 July 2013 03:32, Raymond Jennings <shentino at gmail.com> wrote:

> Just curious, but how well does ccache resist corruption?
> I assume it takes basic precautions like locking and whatnot?  So that two
> parallel compiles don't stomp on each other?

When a ccache process creates a result in the cache, it uses unique names
for the temporary files and (on Unix) renames them into place, which is
atomic. No locks are used for this. The cache directory also contains some
files that contain statistics, and locks in the form of lockfiles (actually
symlinks) are used to serialize access to those files.

However, if an already cached object file gets corrupted for some reason
(e.g. due to filesystem corruption or hardware problems), ccache will
happily deliver the object file anyway. This could be solved by letting
ccache checksum the object files.

-- Joel

More information about the ccache mailing list