From e202f960d544ec6ab11b4b5a31814fb5d793b134 Mon Sep 17 00:00:00 2001 From: CUBELinux build Date: Sat, 19 Sep 2026 00:13:21 -0400 Subject: [PATCH] cubelinux: the digest's byte count is the store's, not the reader's MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 'bytes=' reported how much had been read, so the same records disagreed between a file (16,537,532) and a device slot holding them (67,108,864). The gates compare this line, so it has to mean the same thing on both sides: it is now the header plus the records — the length the store actually is. Found by moving the machine's real store into a device store and comparing. --- drivers/cube/cubelinux_store.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/cube/cubelinux_store.rs b/drivers/cube/cubelinux_store.rs index 78c053d51..786bb48e6 100644 --- a/drivers/cube/cubelinux_store.rs +++ b/drivers/cube/cubelinux_store.rs @@ -325,12 +325,12 @@ fn digest(image: &[u8]) -> Line { let mut count: u64 = 0; let mut value_bytes: u64 = 0; let mut errors: u64 = 0; - let mut off = layout.image_off - + if header.version == VERSION_V1 { - HEADER_LEN_V1 - } else { - HEADER_LEN_V2 - }; + let header_len = if header.version == VERSION_V1 { + HEADER_LEN_V1 + } else { + HEADER_LEN_V2 + } as u64; + let mut off = layout.image_off + header_len as usize; let mut remaining = header.record_count; let end = layout.image_off + end; @@ -388,7 +388,11 @@ fn digest(image: &[u8]) -> Line { "digest version={} curve={} bytes={} records={} value_bytes={} fnv1a64={:016x} errors={}", header.version, header.curve, - image.len(), + // `bytes` is a property of the store, not of how it was read: the header plus the + // records, whatever padding the reader happened to see. Reporting what was read made + // the same records disagree between a file and a device — and the gates compare this + // line, so it has to mean the same thing on both sides. + header_len + count * RECORD_FIXED as u64 + value_bytes, count, value_bytes, h,