Take the 2-minute tour ×
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.

So, how exactly do software patches work. If there is a certain bug in the source code of a program, how is this source code changed when one installs a patch? After the patch has been installed how is the program 'automatically' rebuilt?

share|improve this question
2  
I would think that (generally) the entire binary to be "updated" is completely replaced by a binary that's downloaded and copied over the top of the old one. –  jozzas Sep 13 '12 at 6:50

1 Answer 1

The whole program gets updated. In essence the operation could go as follows:

  • Request updates
  • Download updated files
  • Replace current files with the new downloaded files

Details how to manage this may vary, because for example it might not be possible to delete an executable file of a running process, so some form of a workaround is needed(run the updater as a separate program instead of the main application...). It could also be possible to simply just apply the actual changes between the old and the new file, rather than download the whole file. But again, these are just implementation details.

share|improve this answer
2  
Unless you're working with huge files and using a binary patcher. If for some reason unbeknownst to god and man you are developing an application with a monolithic executable file, it may be prudent to use a binary patching scheme. In this case, you compute only the difference between two binary files and send only the differing data. A real example of when this is used is say a large map file for a video game. These files can be hundreds of megabytes and are usually formatted such that resources are stored with padding in fixed size containers. If you only need to update one texture, –  David Cowden Sep 13 '12 at 8:07
    
simply send the new texture and the offset at which to write that texture plus padding. Rather than sending 200mb you're sending only a few. –  David Cowden Sep 13 '12 at 8:08

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.