Did a search for Patchers and didn't find anything. But seriously Patchers: How do they work?

I've done some googling, and i've gotten mixed results. I mean it seems they probably have some way of going in and changing the files (maybe comparing what is different between the files) but it seems like there is probably more going on than that. Or is it really as simple as running a diff. vs another file....and then applying the changes?

  • 3
    Define "patchers" - in what context? – Oded Sep 16 '11 at 21:39
  • "didn't find anything" - Patcher? a tool for quick creation of patches against a project source tree. Patcher functionality resembles a lightweight version control system. It has no repository, and only controls differences between a pristine version and a working copy... – gnat Sep 16 '11 at 22:01

Patchers vary in complexity. But the basic idea is that they follow a three-step process:

  1. Identify what is already present.

  2. Formulate a plan to convert that to the desired result.

  3. Execute that plan.

In the simplest form of patcher, one file is replaced by another. The existing file is usually identified by a checksum or hash to ensure that the patch should be applied. Then the old file is replaced with the new file, often stored in the patch file in compressed form.

More sophisticated patchers can analyze the existing file(s) and recognize versions that it can update to the version it patches to. They can then used 'diff' files that efficiently describe the difference between two files.

Some patchers can even build a checksum of all the files present on the system and then upload them to a central site which can then create a 'diff' specifically for that combination. Files recognized from previous versions will trigger a 'diff' for that file to be included in the package. Files not recognized (or those for which a compressed 'diff' is not available) will result in the entire new file being downloaded.

But the basic process is simple, remove the old, install the new.


Yes, it is really as simple as pie, you can learn it in 10 minutes :)

The (multi-lingual) article shows how to apply patches using the command line tool patch in various scenarios, and how to create patches using the command line tool diff.

Therefore, the article shows that patching is really simply reduced to diffing.

  • 1
    That only kind of says how to patch things or create patches. Not how the underlying patch program works. – Yam Marcovic Sep 16 '11 at 21:57
  • It explains that a patch is just a diff that you can then applying. – DaveFar Sep 16 '11 at 22:35
  • would you mind explaining more on what it does and why do you recommend it as answering the question asked? "Link-only answers" are not quite welcome at Stack Exchange – gnat Aug 7 '13 at 6:23
  • @gnat: yes, makes sense. should I give the link as a comment and remove the answer? Since the linked text is a really good explanation, it makes no sense to add more text to the answer, I think. – DaveFar Aug 7 '13 at 8:44
  • converting link-only answer to comment is a legitimate option; I for example did that once or twice to my own answers. Another option, also legitimate, is, as suggested at the guidance linked in my prior comment, to edit your answer to "quote the most relevant part of an important link". – gnat Aug 7 '13 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy