Next: , Up: Making Patches   [Contents][Index]

11.1 Tips for Patch Producers

To create a patch that changes an older version of a package into a newer version, first make a copy of the older and newer versions in adjacent subdirectories. It is common to do that by unpacking tar archives of the two versions.

To generate the patch, use the command ‘diff -Naur old new’ where old and new identify the old and new directories. The names old and new should not contain any slashes. The -N option lets the patch create and remove files; -a lets the patch update non-text files; -u generates useful timestamps and enough context; and -r lets the patch update subdirectories. Here is an example command, using Bourne shell syntax:

diff -Naur gcc-3.0.3 gcc-3.0.4

Tell your recipients how to apply the patches. This should include which working directory to use, and which patch options to use; the option ‘-p1’ is recommended. Test your procedure by pretending to be a recipient and applying your patches to a copy of the original files.

See Avoiding Common Mistakes, for how to avoid common mistakes when generating a patch.