Skip to content

fix compressed stream backwrite and must-compress error.#444

Merged
sisong merged 1 commit into
sisong:masterfrom
AInba:master
Mar 19, 2026
Merged

fix compressed stream backwrite and must-compress error.#444
sisong merged 1 commit into
sisong:masterfrom
AInba:master

Conversation

@AInba
Copy link
Copy Markdown
Contributor

@AInba AInba commented Mar 12, 2026

使用HPatchLite库tinyuz算法,流式制作差分包时报错

@sisong
Copy link
Copy Markdown
Owner

sisong commented Mar 14, 2026

非常感谢你的PR;
按你的场景描述"HPatchLite+tinyuz+流式制作差分",流式制作差分是指-s模式diff,还是只是流式输出补丁? 这是你自己搭建的场景吗?(因为HPatchLite当前只提供了-m内存式diff)
tinyuz换成zlib或lzma也报错吗? 如果不是,那就应该修改tinyuz的包装器。
请问你修复了什么场景下的bug?(更准确的描述,如何重复?& 它会在其他条件下也触发吗?)

@AInba
Copy link
Copy Markdown
Contributor Author

AInba commented Mar 19, 2026

触发场景:
hdiffz编译上tinyuz库,运行命令hdiffz -s -SD -c-tinyuz old.bin new.bin out.hdiff,报错如下:
[tuz] dictSize: config=30, actual(curDictSizeMax)=1, back-write to pos 0 (update header)
stream diff run an error: TCompressedStream::write() writeToPos error! ERROR!

使用zlib/lzma不会报错,主要是它们压缩过程是顺序写,不会出现 writeToPos 回退;而 tinyuz 会在压缩过程中回写补丁头,导致 writeToPos 回退到已写区域。
旧版 TCompressedStream 只允许顺序写因此报 writeToPos error。
本次修改在保持顺序写语义的同时,允许在已写入范围内回写头部,从而兼容 tinyuz 这类实现。

@sisong sisong merged commit e809521 into sisong:master Mar 19, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants