cubelinux: the digest's byte count is the store's, not the reader's

'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.
This commit is contained in:
CUBELinux build
2026-09-19 00:13:21 -04:00
parent 3ee59dafff
commit e202f960d5
+11 -7
View File
@@ -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,