From: Joel Rosdahl Date: Mon, 9 Jun 2025 17:55:23 +0000 (+0200) Subject: feat: Improve logging for manifest lookup X-Git-Tag: v4.12~93 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d42d162f40922701257ce2988d2e67061ebfd34a;p=thirdparty%2Fccache.git feat: Improve logging for manifest lookup --- diff --git a/src/ccache/core/manifest.cpp b/src/ccache/core/manifest.cpp index cbd2dd33..ada2b74d 100644 --- a/src/ccache/core/manifest.cpp +++ b/src/ccache/core/manifest.cpp @@ -162,6 +162,9 @@ Manifest::look_up_result_digest(const Context& ctx) const // Check newest result first since it's more likely to match. for (size_t i = m_results.size(); i > 0; i--) { const auto& result = m_results[i - 1]; + LOG("Considering result entry {} ({})", + i - 1, + util::format_digest(result.key)); if (result_matches(ctx, result, stated_files, hashed_files)) { LOG("Result entry {} matched in manifest", i - 1); return result.key; @@ -367,7 +370,7 @@ Manifest::result_matches( if (stated_files_iter == stated_files.end()) { util::DirEntry entry(path); if (!entry) { - LOG("Info: {} is mentioned in a manifest entry but can't be read ({})", + LOG("{} is mentioned in a manifest entry but can't be read ({})", path, strerror(entry.error_number())); return false; @@ -380,7 +383,8 @@ Manifest::result_matches( } const FileStats& fs = stated_files_iter->second; - if (fi.fsize != fs.size) { + if (fs.size != fi.fsize) { + LOG("Mismatch for {}: size {} != {}", path, fs.size, fi.fsize); return false; } @@ -422,13 +426,18 @@ Manifest::result_matches( return false; } if (ret.contains(HashSourceCode::found_time)) { + // hash_source_code_file has already logged. return false; } hashed_files_iter = hashed_files.emplace(path, actual_digest).first; } - if (fi.digest != hashed_files_iter->second) { + if (hashed_files_iter->second != fi.digest) { + LOG("Mismatch for {}: hash {} != {}", + path, + util::format_digest(hashed_files_iter->second), + util::format_digest(fi.digest)); return false; } }