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?
Asked
Active
Viewed 1.2k times
8
-
2I 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. – John Lyon Sep 13 '12 at 06:50
1 Answers
10
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.

zxcdw
- 5,075
- 2
- 29
- 31
-
3Unless 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 08: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 08:08