Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
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

2 Answers

up vote 4 down vote accepted

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.

share|improve this answer

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

share|improve this answer
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. – DaveBall Sep 16 '11 at 22:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.