Apply Xdelta Patch Online

0 views
Skip to first unread message

Jule Kue

unread,
Aug 3, 2024, 4:25:36 PM8/3/24
to anvolosua

I am trying to maintain file history on a server from a client and I have thought of using xdelta for it. There is almost no help online for using xdelta. I gathered a few bits and pieces of code and tried to run it in order to understand it myself but the compiler gives the following error:

As for the linking issue you have. I guess you are using gcc, so it automatically uses correct linker for you. The thing is, you should provide library name, which you want to link your program with, as a linker option.

If everything is fine, you should have executable file "encode_decode_test". It's example uses xdelta3. Now you can build your program the same way. See "Makefile" file inside of "examples" directory to get a clue how to build your program. Note that there is no libraries involved now.

Essentially, I am looking for a GNU/Linux tool, that could recursively iterate through two directories, find file changes/additions/deletions; and for all changed files, output a diff. This can already be done by diff efficiently for text files, but not for large binary files - I would like also efficient "diffs" between binary files included in the final patch (which, I gather, is known as Binary delta compression - Wikipedia as subset of Delta encoding - Wikipedia). Or, in other words, do something like described in this "wishlist" comment (from CommandLineSyntax - xdelta - Google Project Hosting):

This facility does not exist, judging by Issue 21 - xdelta - Recursive directory diff support - Google Project Hosting), although there are ways around: the issue page has several suggestions for script wrappers, but I'd rather keep things self-contained in a single tool.

Most important for me would be the patching a "live" filesystem directory part as shown above, due to my intended use case - described in more detail below, and illustrated with a bash script that uses git.

I'd want to be able to update a static website on a cheapish Linux host/webfarm, which only allows FTP transfer (so no rsync and such) with a rather low transfer speed, and only allows PHP script execution. Typically I'd need to sync from local/client/home to server/webhost, but of course I do not want to upload 200 MB each time I want to update a page :)

I could use outlandishideas/sync GitHub to "Sync directory contents over HTTP using PHP", but besides only syncing from server to local, also only whole files are send: "No attempt is made to send diffs; this is not rsync". Similarly, I could use GNU FTPsync; it could probably handle file creation, modification and deletion, but it has the same problem - only whole files will be sent.

In principle, git could be used too - the below script generates directories testdir_old and testdir_new, and shows that git can encode the differences between them (in this case being "removed 1024; added 1024; modified/added 19; modified inline 1200", or total 3267 bytes of change) as a "sneakernet" git bundle file 4470 bytes in size. But even if I could persuade the host to install git up there, I'd still have to maintain a .git repo up on the webhost for the bundle to apply cleanly - and I definitely do not want to do that, as I couldn't spare the extra file size usage; also, it seems that managing large binary files with git - Stack Overflow requires git annex or git bup.. And putting around a script like below would be problematic because git would recreate new revision hashes each time, making the bundle not apply cleanly.

Also, since in PHP, I can apparently "untar-gz without exec()? - Stack Overflow", maybe it's worth trying to determine changes in directory, then pack only the changed files in a tar.gz, and send that to PHP script on the server, that would unpack it over the target directory. This would still send entire files, but at least they'd be compressed - but deletions on server would be difficult to handle.

Finally, the binary file diff utilities suggest that one could pack the directories in a .tar(.gz) each, and then run the utility on those files - e.g. (via ExternalCompression - xdelta - Google Project Hosting):

... or with bsdiff. However, that requires me to also maintain a tar archive of the entire site on the webhost, to allow the patches to apply cleanly to it, and the space is issue here again. It would also force me to ask the webhost to allow me the install and use of at least the patching parts of the tools; and that may be worth a try again, if those tools wouldn't also require me to keep an additional tar'd copy of the site on the host.

Anyways, below is the script that demonstrates extraction of a git .bundle as a recursive diff between two directories (or rather, two versions of the same directory); relevant terminal output is included in the comments:

This could be achieved eg. in mc, connect one panel over FTP to your web host, let other panel show the local version. Then select everything and copy, and choose to overwrite only all newer files (you can chose that for all files at once). Or use another file manager's synchronize facility, I believe krusader has some. Unless you've got big files which change only locally (what are they? databases1? executables maybe, but not compressed?), binary deltas won't give you much IMO.

This would have the advantage that you don't need to keep the servers state as a copy on the local machine - as it would be necessary if you want to create binary diffs first to send them to the server and then start patching there.

If you still would like to go for the diff/patch solution, you could try to use xargs to create multiple patch-files (with xdelta3 or whatever tool you like), tar and gzip them into one big blob, transfer that to the server and there "reverse" the whole process.

This is the command xdelta that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

OnWorks is a free online VPS hosting provider that gives cloud services like free workstations, online AntiVirus, free VPN secure proxies, and free personal and business email. Our free VPS can be based on CentOS, Fedora, Ubuntu and Debian. Some of them are customized to be like Windows online or MacOS online.

Why does that matter? Well, I'll let the wiki explain it:
"Along with most Nintendo Wi-Fi Connection services, the online shops in both Shadow Dragon and New Mystery of the Emblem permanently closed on May 20th, 2014. For Shadow Dragon, this had the effect of rendering the Elysian Whip (and in turn the Falcoknight class) and three of the Brave weapons as essentially unused content... for new save files created after that date on original cartridges." [Emphasis mine]

Be warned, these enemies will use these new items against you until you kill them and claim the weapons for your own. However, depending on your difficulty (primarily if you're playing on Normal), two or three of the above enemies will lack the weapon rank required to use the new items, although they will still drop them as normal. On higher difficulties, all bets are off - everybody is skilled enough to use everything in their new arsenal against you.

In addition, Falcoknights have been updated to use their FE12 stats; previously, as the class was not in the original FE1, the developers intended it mostly as an easter egg and did not seem to balance it. As a result, the Falcoknight had absolutely no advantages over the Dracoknight. Now, the Falcoknight has higher Speed, Skill, and a higher maximum Speed, but lower Strength than the Dracoknight, in line with their appearance in FE12.

3. Extract DeltaPatcherLite.exe, your unmodified .nds file of FE11, and EITHER OnlineItemsInGame.xdelta OR OnlineItemsWithHardPrologue.xdelta to the same folder. DO NOT USE BOTH .xdelta FILES; CHOOSE ONLY ONE. The difference is explained above.

Cool, the online shop closure rendering some items unobtainalbe was pretty blegh. Now with those 3 patches (gaiden req removal, hard more prologue and now this one), the enjoyability of the game will really go up.

I can't seem to figure out how to hack that one out, but when I do, I'll update all of my other patches. It's funny; I don't even care for the character, really - she's just the last vestige of FE11's absurd "death requirements" mechanic that has yet to be scrubbed away.

That and she has her adoring fans that await for the day you finally conquer FE11's absurd system of locking content behind death. (I'd have been fine with Gaiden if they just had alternate requirements like leveling specific characters or recruiting a specific unit, etc.)

* A third Elysian Whip has been added; Tiki is holding it in Chapter 19, and she'll drop it if you want to kill her to access 24x. The Online Shop allowed you to buy a maximum of 3 Elysian Whips, so having 3 added by the mod was only logical.

* Falcoknights have been updated to use their FE12 stats; previously, as the class was not in the original FE1, the developers intended it mostly as an easter egg and did not seem to balance it. As a result, the Falcoknight had absolutely no advantages over the Dracoknight. Now, the Falcoknight has higher Speed, Skill, and a higher maximum Speed, but lower Strength than the Dracoknight, in line with their appearance in FE12.

Neat, that's one way to go about it. Would it be possible to do what the Wii U VC release did and have the online shop always accessible, and the stock using the system clock? Or is that too difficult to do?

The update is now live on RH.net, so the link in the OP is once again the place to find the latest version - no further confusion with Mega links necessary, just use the link in the OP. Sorry for the delay.

c80f0f1006
Reply all
Reply to author
Forward
0 new messages