From: ThisIsFineTM <184989147+ThisIsFineTM@users.noreply.github.com> Date: Mon, 8 Jun 2026 18:15:41 +0000 (+0000) Subject: fix: Logic error with read_only storage gating (#1747) X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2f0938da2be2cbb18c3240535ac7a35ad4b6d656;p=thirdparty%2Fccache.git fix: Logic error with read_only storage gating (#1747) RemoteStorageEntry::read_only is an std::optional. Storage::get_backend was treating read_only as a regular bool (likely a residue left over from a refactor?). Operator bool on std::optional is just a has_value check, so the backend storage gating was behaving as read_only even if read_only was explicitly set to false. --- diff --git a/src/ccache/storage/storage.cpp b/src/ccache/storage/storage.cpp index 61942e47..e5ecf6cc 100644 --- a/src/ccache/storage/storage.cpp +++ b/src/ccache/storage/storage.cpp @@ -582,7 +582,7 @@ Storage::get_backend(RemoteStorageEntry& entry, const std::string_view operation_description, const bool for_writing) { - if (for_writing && entry.config.read_only) { + if (for_writing && entry.config.read_only.value_or(false)) { LOG("Not {} {} storage since it is read-only", operation_description, entry.config.shards.front().url.scheme());