]> git.ipfire.org Git - thirdparty/ccache.git/commit
fix: Disable caching for modified source/include files
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 14 Jan 2024 09:46:54 +0000 (10:46 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 14 Jan 2024 21:07:00 +0000 (22:07 +0100)
commit43c3a44aadcb122853ee1e3eb8db00db9d8de68f
tree464e098fd6f7b6b07931266c1ff12a2ad6443567
parent6b85822b50cc509b4d595bf89340bdf0da526dc9
fix: Disable caching for modified source/include files

On a cache miss, ccache opts out of the direct mode when a "too new"
include file is found. This is done to avoid a race condition in the
direct mode when a header file if modified after ccache is invoked but
before the compiler is executed. Modifying the main source code file is
not a race condition when "run_second_cpp = false", which was the case
at the time the direct mode was introduced. However, the default of
run_second_cpp was changed to true in ccache 3.3, and the potiential
race condition then exists for both the source and the include files.

Fix this by disabling caching completely (not only the direct mode) when
modification of a source/include file is detected.

Closes #1378.
doc/MANUAL.adoc
src/ccache.cpp
src/core/Statistic.hpp
src/core/Statistics.cpp
test/suites/base.bash
test/suites/direct.bash
test/suites/pch.bash