From 8ef94c111413ce14a7f69dfe643e69dde2e724e3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 17 Feb 2025 14:40:50 +0100 Subject: [PATCH] Add a structured log message for FOD hash mismatches --- src/libstore/unix/build/local-derivation-goal.cc | 6 ++++++ src/libutil/logging.hh | 1 + 2 files changed, 7 insertions(+) diff --git a/src/libstore/unix/build/local-derivation-goal.cc b/src/libstore/unix/build/local-derivation-goal.cc index 805c3bbca..9ab0da32b 100644 --- a/src/libstore/unix/build/local-derivation-goal.cc +++ b/src/libstore/unix/build/local-derivation-goal.cc @@ -2656,6 +2656,12 @@ SingleDrvOutputs LocalDerivationGoal::registerOutputs() worker.store.printStorePath(drvPath), wanted.to_string(HashFormat::SRI, true), got.to_string(HashFormat::SRI, true))); + // FIXME: put this in BuildResult and log that as JSON. + act->result(resHashMismatch, + {worker.store.printStorePath(drvPath), + wanted.to_string(HashFormat::SRI, true), + got.to_string(HashFormat::SRI, true) + }); } if (!newInfo0.references.empty()) { auto numViolations = newInfo.references.size(); diff --git a/src/libutil/logging.hh b/src/libutil/logging.hh index e8112c6b0..21493b969 100644 --- a/src/libutil/logging.hh +++ b/src/libutil/logging.hh @@ -36,6 +36,7 @@ typedef enum { resSetExpected = 106, resPostBuildLogLine = 107, resFetchStatus = 108, + resHashMismatch = 109, } ResultType; typedef uint64_t ActivityId;