]> 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:11:54 +0000 (22:11 +0100)
commitd75dbe260dbadf56ae9bd8a86f55ba23a27fd75a
treef5162c13ed81dbcf355dfd9ef175bbfad0c3426d
parent17b57411f4c699350055b0f63258217cc7301dca
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.

(cherry picked from commit 43c3a44aadcb122853ee1e3eb8db00db9d8de68f)
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