文件: core/io/index_cache.rs:63 分类: 缓存一致性
core/io/index_cache.rs:63
问题: 文件指纹仅 hash 前 4KB + 后 4KB + 文件大小。文件中间部分被修改但大小/head/tail 不变时,会命中过期缓存。
hasher_state.update(&head); // 前 4KB hasher_state.update(&tail); // 后 4KB hasher_state.update(&file_size.to_le_bytes()); // ← 中间区域变化完全检测不到
建议修复: 加入 mtime/inode,小文件全文件 hash,大文件分块 rolling hash。
技术缺陷确认属实:compute_file_hash(core/io/index_cache.rs:63)确实只采样 head 4KB + tail 4KB + file_size,中间区域不参与指纹计算。
compute_file_hash
但实际风险极低:
如需加强:加 mtime 即可,无需 rolling hash。
Close as wontfix / low-risk.
No dependencies set.
The note is not visible to the blocked user.
文件:
core/io/index_cache.rs:63分类: 缓存一致性
问题: 文件指纹仅 hash 前 4KB + 后 4KB + 文件大小。文件中间部分被修改但大小/head/tail 不变时,会命中过期缓存。
建议修复: 加入 mtime/inode,小文件全文件 hash,大文件分块 rolling hash。
审核结论:关闭(风险极低)
技术缺陷确认属实:
compute_file_hash(core/io/index_cache.rs:63)确实只采样 head 4KB + tail 4KB + file_size,中间区域不参与指纹计算。但实际风险极低:
如需加强:加 mtime 即可,无需 rolling hash。
Close as wontfix / low-risk.