虚拟机映像的二进制差异和补丁实用程序 [英] Binary diff and patch utility for a virtual machine image

查看:22
本文介绍了虚拟机映像的二进制差异和补丁实用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要经常发布一些软件,该软件包含在一个VMWare磁盘文件中,即.vmdk文件.我想要的是某种二进制差异和补丁实用程序,以使生成的增量尽可能小.

I need to release some software quite frequently, and the software is contained as a VMWare disk file, i.e., .vmdk file. What I want is some kind of binary diff and patch utility to make the delta generated as small as possible.

推荐答案

让我从久经考验的方法开始,然后指出一些最近的方法.

Let me start off with tried-and-true approaches, then point out some more recent approaches.

我见过的处理二进制文件的方法

很久以前,人们将二进制文件的新旧版本扩展为临时文本"文件(每个字节扩展为 3 个字节:2 个十六进制数字和一个换行符).然后通过旧版本的diff"(肯定无法处理二进制文件)运行这两个文本"文件以制作补丁文件.然后我们通过尚未 8-bit-clean 的通信线路传输那个文本"补丁文件.在接收端,将旧二进制文件扩展为临时文本版本,然后修补旧文本文件,然后将新文本文件压缩回二进制文件(将每对十六进制数字压缩为一个字节,然后丢弃换行符和任何可能潜入的回车符).

A long time ago, people expanded the old and the new versions of a binary file into temporary "text" files (every byte expanded to 3 bytes: 2 hex digits and a newline). Then run these two "text" files through an old version of "diff" (that definitely couldn't handle binary files) to make a patch file. Then we transmitted that "text" patch file over communication lines that were not yet 8-bit-clean. On the receive end, one expanded the old binary file into a temporary text version, then patched that old text file, and then compressed the new text file back into a binary file (compressing each pair of hex digits into one byte, and throwing away the newlines and any carriage returns that might have crept in).

最近,我一直在使用 rsync (或一些建立在它之上的实用程序比如齐声).它可以很好地处理任意二进制文件.我通常会进行实时更新,Unison 在我的本地机器上运行,rsync 在文件服务器上运行,相互交流.

More recently, I have been using rsync (or some utility built on top of it such as Unison). It handles arbitrary binary files just fine. I generally do a live update, with Unison running on my local machine and rsync running on the file server, talking back and forth to each other.

无论补丁文件是如何生成的,您都可以使用任何数据压缩实用程序来压缩该文件.

No matter how a patch file is generated, you can use any data compression utility to compress that file.

据我所知,应该可以处理二进制文件的方法

StackOverflow:如何为二进制差异输出文件创建一个 PATCH 文件"建议使用 bsdiff.

另一个StackOverflow 问题意味着vimdiff"似乎可以充分处理任意字节.

Another StackOverflow question implies that "vimdiff" seems to handle arbitrary bytes adequately.

StackOverflow:有用的二进制文件Diff Tool" 提到了其他一些二进制差异工具.

StackOverflow: "Useful Binary Diff Tool" mentions a few other binary difference tools.

我听说一些基于 rsync 的工具 -- "rdiff" 和 "rdiff-backup"和duplicity"——允许你创建一个补丁文件.然后收到该补丁文件的人可以使用它将旧的二进制文件更新为新的二进制文件.

I hear that some tools based on rsync -- "rdiff" and "rdiff-backup" and "duplicity" -- allow you create a patch file. Then a person who receives that patch file can use it to update their old binary file to a new binary file.

维基百科声称标准diff"和patch"实用程序的最新版本支持二进制文件.你试过吗?

The Wikipedia claims that recent versions of the standard "diff" and "patch" utilities support binary files. Have you tried that?

可执行文件压缩的​​前沿研究

如果您对在更新可执行文件时尽可能减小 delta 文件的前沿研究感兴趣,请查看小胡瓜的工作原理"作者:Stephen Adams 2009 年在 Chromium 项目中.

If you are interested in cutting-edge research on making the delta file as small as possible when updating executable files, you'll want to check out "How Courgette works" by Stephen Adams 2009 at The Chromium Projects.

除其他外,接收补丁的计算机反汇编"旧应用程序,将所有绝对地址和偏移量转换为符号;然后修补反汇编的代码;然后将修补后的代码重新组装"到新版本的应用程序中.

Among other things, the computer that receives the patch "disassembles" the old application, converting all absolute addresses and offsets into symbols; then patches the disassembled code; then "reassembles" the patched code into the new version of the application.

这篇关于虚拟机映像的二进制差异和补丁实用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆