Joel Rosdahl [Thu, 14 May 2026 14:49:52 +0000 (16:49 +0200)]
feat: Add "exists" operation to remote storage helper protocol
In reshare mode, ccache now asks the remote storage helper if a value
exists before putting the value. This avoids sending the full payload to
the helper in case the value already exists.
Joel Rosdahl [Sat, 16 May 2026 21:23:28 +0000 (23:23 +0200)]
feat: Replace experimental greeting format 2 with info operation
af6f9141bb7c1dad010f42d7aa45be6f984f447b added experimental support for
a new greeting message format including server identity and diagnostics.
Storage helpers are supposed to use the new greeting format when ccache
sets the CRSH_FORMAT_MAX environment variable. While this complicates
the original protocol design, the advantage is that the client gets the
information directly without an extra IPC roundtrip.
After trying this change out for a while, I've decided to revert it:
1. It complicates storage helper implementation a bit too much.
2. It's another variable to set when starting the storage helper
for usage with `crsh:` URLs.
3. It's actually only when the client has logging enabled that the
server identity and diagnostics are of interest.
Instead, this commit adds an info operation with the same information,
handled as an ordinary capability evolution.
Joel Rosdahl [Mon, 27 Apr 2026 16:44:32 +0000 (18:44 +0200)]
fix: Disambiguate manifest and result hash for MSVC depend mode
When using depend mode with MSVC and the source file doesn't include any
file, the result hash becomes identical to the manifest hash. Fix this
by adding a "result" hash delimiter, similar to how it's done in the
non-MSVC case (result_key_from_depfile).
This bug has existed since the addition of depend mode support for MSVC
(b1348e5f5ebe10b486b4e86f0114884a04f9531a). It's not a big deal, but the
storage layer will use the same key, so manifest or result parsing might
fail and fall back to just running the compiler.
Joel Rosdahl [Sat, 25 Apr 2026 14:40:46 +0000 (16:40 +0200)]
fix: Increase default storage helper data/request timeouts to 10s/1m
On heavily loaded systems, ccache may see multi-second delays waiting
for responses from the storage helper. This can happen because of local
load, helper queueing or slow remote storage responses, even when
nothing is actually broken. The previous defaults were therefore too
aggressive and could cause spurious timeouts, leading to more local
compilation load and, in turn, even more timeouts.
Increase the default data and request timeouts to 10s and 1m
respectively while still keeping them low enough to detect a stuck
helper or malfunctioning remote storage in reasonable time.
Joel Rosdahl [Sat, 18 Apr 2026 19:06:11 +0000 (21:06 +0200)]
feat: Add diagnostics messages and identity to storage helper greeting
Storage helpers may need to report startup problems back to ccache, e.g.
unknown or malformed attributes. This can now be done in a new greeting
format where such diagnostic messages can be included. It also adds a
server identity field so that ccache can log the storage helper version.
Joel Rosdahl [Thu, 26 Mar 2026 08:13:39 +0000 (09:13 +0100)]
fix: Disable base directory when using MSVC's /Yc option
When creating a precompiled header (PCH), MSVC does not like relative
paths for /Yc and /FI arguments, so don't rewrite paths to relative in
that case.
Björn Svensson [Mon, 23 Mar 2026 19:29:32 +0000 (20:29 +0100)]
fix(http): Treat HTTP 2xx with empty body as cache miss (#1707)
fix(storage): Treat empty remote storage entries as errors
A remote storage backend returning a value with an empty body indicates
a corrupt or misconfigured entry, not a cache miss. Check for empty
values in the storage layer so that all current and future backends are
covered. The error is logged but the backend is not marked as failed,
since other entries may still be valid.
Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
The POSIX error for a missing command is not stable across systems. Some
environments report the posix_spawnp failure directly, while others
return a shell-style "Non-zero exit code: 127" instead.
Accept both outcomes in the test and capture the actual error string to
make future failures easier to diagnose.
Joel Rosdahl [Sat, 14 Mar 2026 12:06:18 +0000 (13:06 +0100)]
test: Don't check `.ltrans0.ltrans.su` files in `-flto` tests (#1704)
Different compilers produce different stack-usage files when linking
object files compiled with `-fstack-usage -flto`. Since ccache does not
cache linking anyway, skip checking the linking results to avoid
compiler-specific expectations.
Joel Rosdahl [Sun, 8 Mar 2026 12:19:11 +0000 (13:19 +0100)]
fix: Use OS-specific methods to reliably find the ccache executable path
argv[0] is not guaranteed to reflect the actual location of the
executable (e.g. when invoked via a symlink). Use platform-specific APIs
instead. Fall back to the argv[0]-based approach if the OS method fails.
Joel Rosdahl [Sat, 7 Mar 2026 21:42:11 +0000 (22:42 +0100)]
fix: Search for storage helper in libexec before PATH
Previously ccache searched for storage helpers in PATH before libexec
directories. The idea was that users could easily override a
system-installed helper by placing a newer version earlier in PATH.
However, this also meant that PATH was consulted even when a libexec
directory had been explicitly configured, or when the helper was
installed in the intended system location. In these cases, helpers found
in PATH could take precedence over the expected libexec helper.
Since installing helpers in a libexec directory is the intended
deployment model, prefer libexec locations over PATH.