Hacker News new | past | comments | ask | show | jobs | submit login
More than you really wanted to know about Patch (landley.net)
139 points by signa11 on Jan 16, 2019 | hide | past | favorite | 10 comments



If you ever find yourself needing to maintain a set of patches to apply to two or more similar codebases (e.g. various linux kernels of various distros), I found stacked git to be very helpful for that purpose. http://www.procode.org/stgit/ (or maybe just apt-get install stgit).


Yes, I can definitely recommend stgit if what you're doing is basically "maintain this stack of patches". It's much more user-friendly as an UI for doing that than raw git rebase, though of course you can achieve the same workflow with the basic git plumbing.


Of course, this idea goes back further than "back in the 1980s" with Larry Wall.

In the mainframe world of the decade before that, people had ZAP, which later was to become SPZAP, OBJZAP, and AMASPZAP (not IAMASPZAP as the Hacker's Dictionary erroneously has it). ZAP's "NAME", "VER", and "REP" records work similarly to the process described by M. Landley: name the file, verify that the original contents at a particular place are thus, replace them with some new contents if so.

ZAP could also twiddle metadata, record patches applied, and dump contents. It has several imitators.

* https://ibm.com/support/knowledgecenter/en/SSB27U_6.4.0/com....

* https://ibm.com/support/knowledgecenter/en/SSLTBW_2.3.0/com....

* https://support.sas.com/documentation/onlinedoc/sasc/doc/tec...

* https://m204wiki.rocketsoftware.com/index.php/RockZap


Thanks for the links provided, made me happy to realise I don't have to parse that documentation :)


I was very surprised to learn that diff / patch file formats are essentially unstandardized. Shouldn't there be an RFC or something?


It's standardized the same way Perl is standardized - whatever the reference implementation does is the standard!


I hope someone somewhere is compiling this kind of material for the Foundation time capsule.


After reading the man page for diff and the -e option, I found that they actually generate the diff hunks from the end of the file to the beginning in order to keep the start line numbers consistent. I wonder why the other diff formats decided to do it the other way around (from beginning to end)? Doing it from end to beginning actually makes it easier to apply individual hunks without having to regenerate the diff after applying one (assuming you start with a later hunk before applying earlier ones).


That was quite refreshing to read. It's funny how little thought I'd given to such a vital tool

I had a good chuckle at 'given a choice between "system with no battery" and "system with systemd" it's no contest'


patch: hey everybody look at javascript it has two nulls. wat lol

javascript: at least my nulls aren't like midnight, january 1, 1970

unix: damn js that's an epoch burn




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: