Dimitri PISSARENKO
dimitri.pissarenko@gmx.net
Dimitri Pissarenko
To explain and to demonstrate how patches can be created and applied for updating the source code

This tool can be downloaded from Petri (2004).
The command
diff -r dir1 dir2
shows all the differences between the directories dir1 and dir2. It produces a text output, which is rather unsuitable for humans.
This section is based upon Compaq Servers And Linux (2003).
In order to create a patch, which updates olddir to newdir, following command should be invoked
diff -Naur olddir newdir > new-patch
Invoke the command
patch -d directoryToPatch -p1 -i ../patch-file
where directoryToPatch is the directory to be patched and patch-file is the patch to be applied.
In the directory examples you'll find directories demetrix-0.0.10 and demetrix-0.0.11, using which you can experiment with diff and path.
Let's create a patch, which updates demetrix-0.0.10 to demetrix-0.0.11 and then actually apply this patch to see the effect.
Use WinDiff for this.
cd into the examples directory. Then, enter the following command
diff -Naur demetrix-0.0.10 demetrix-0.0.11 > patch-2004-05-04-demetrix-0.0.10
Now copy demetrix-0.0.10 to a new directory demetrix-0.0.10-2 by means of the command
cp -r demetrix-0.0.10 demetrix-0.0.10-2
We will use out patch to update demetrix-0.0.10-2 to demetrix-0.0.11.
Use WinDiff for this.
Invoke
patch -d demetrix-0.0.10-2 -p1 -i ../patch-2004-04-05-demetrix-0.0.10
The name of the path should include following three pieces of information:
Name of the product
Version, against which the patch was created (olddir)
Date, when the patch was created
|
Petri (2004) |
Daniel Petri, 2004, Where can I download the Windows 2000 Resource Kit tools?, http://www.petri.co.il/download_free_reskit_tools.htm (URL accessed on May 4, 2004) |
|
Compaq Servers And Linux (2003) |
Compaq Servers And Linux, 2003, How to create and use a patch in Linux, http://www.cpqlinux.com/patch.html (URL accessed on May 4, 2004) |