How To Create and Submit a Patch

Introduction

A patch is exactly what the word says: a small piece of code used to repair a breach. It is normally a plain text file containing only the differences between the current version of the code and the fixed version.

Generating a Patch

Against Current Subversion

Against the Latest Release

If you do not have access to Subversion you can generate the patch against the latest release.

diff -rup /path/to/unmodified/source /path/to/modified/source > /path/to/patchfile.patch. 

To summarize the steps:

Usual patch problems

If you never made a patch before, that was submitted to a project, you will likely make the following mistakes:

The problem is that Windows an Unix has different line endings, and therefore diff thinks that the whole file changed, creating an unusable patch, that contains the whole file instead of a couple of lines that were changed.

When you mix original and modified tree, when doing the diff -ru, then you will get a patch, that undoes your changes from an already patched system, instead of applying your changes to an unpatched system. You can detect a correct patch yourself: If you have added some code, you should see more "+" at the begining of the lines than "-" in the patch file. If you see more "-" than "+", then you likely made the patch in the wrong direction.

Using Bugtracker

Closing a bug patch

If you have a patch that is closing bugs then you can attach the patch to the bug/bugs explaining what the patch is doing. You can also inform the cacert-dev mailing list ( http://lists.cacert.org/ )about the closed bug but don't attach the patch to the mail sent to the list, instead put the bug links in the mail where the attached patch is located. Test the patch locally on your own machine and look if it closes the bug there. Find the bug it is closing in the Open bugs list. Attach the patch to the bug report. Explain what the patch is doing and if there might be any problems with the patch. If you want to send a mail to the cacert-dev list and explain it there also. Remember to have the bug number or even better the link to the bug in the mail. Don't attach the patch to the mail.

How about enhancements?

THANKS FOR YOUR HELP!


SubmitPatch (last edited 2010-01-05 12:41:53 by UlrichSchroeter)