install: read the installed file back - metadata on this share can be a cache

One file was reported converted and was not: 'ok 1085 MB -> 478 MB' printed, every metadata probe
agreed, and the live file was still the H.264 original afterwards, with no error anywhere. RaiDrive
/ Dokan serves cached attributes, so a rename can appear to succeed while nothing landed. The
install step now reads the live file back and compares its SHA-256 with the encode it just made -
the one check a cache cannot satisfy. Costs a read per file; catches a whole class of silent
no-ops that today's 'success' reports hid.
This commit is contained in:
2026-10-07 11:54:17 +08:00
parent aad65c56d4
commit 59eabc7eda
+13
View File
@@ -668,6 +668,19 @@ def process(src, args, dest=None, origin=None):
ok, msg = probe_ok(live, info, expect_vc)
if not ok:
return "FAIL post-replace gate on share: %s" % msg, None
# Metadata can lie on this share. RaiDrive/Dokan serves CACHED attributes, and a rename did
# not actually land for one file while every metadata probe insisted it had: the run
# reported "ok 1085 MB -> 478 MB" and the live file was still the H.264 original afterwards,
# with nothing anywhere reporting an error. So read the installed file back and compare its
# hash with what we encoded - the only check that cannot be served from a cache.
try:
h_back, n_back = _sha_remote(live)
except OSError as e:
return "FAIL install verify: cannot read the installed file back: %s" % e, None
if (h_back, n_back) != (h_loc, n_loc):
return ("FAIL install verify: the live file is NOT the encode we made "
"(live %s/%d bytes vs ours %s/%d) - the replace did not land"
% (h_back[:12], n_back, h_loc[:12], n_loc)), None
return "ok", {"sha256": h_loc, "bytes": n_loc, "src_bytes": n_in,
"src_mb": round(info["size"] / 1e6, 1),
"out_mb": round(n_loc / 1e6, 1),