| 1 |
= Contributing |
| 2 |
|
| 3 |
== Submitting patches or diff’s to the FreeRADIUS project |
| 4 |
|
| 5 |
For a person or company wishing to submit a change to the FreeRADIUS |
| 6 |
project the process can sometimes be daunting if you’re not familiar |
| 7 |
with "the system." This text is a collection of suggestions which can |
| 8 |
greatly increase the chances of your change being accepted. |
| 9 |
|
| 10 |
Note: Only trivial patches will be accepted via email. Large patches, or |
| 11 |
patches that modify a number of files MUST be submitted as a |
| 12 |
https://github.com/FreeRADIUS/freeradius-server/pulls[pull-request via GitHub]. |
| 13 |
|
| 14 |
== Hints and tips |
| 15 |
|
| 16 |
=== 1. Describe your changes |
| 17 |
|
| 18 |
Describe the technical detail of the change(s) your patch or commit |
| 19 |
includes. |
| 20 |
|
| 21 |
Be as specific as possible. The WORST descriptions possible include |
| 22 |
things like "update file X", "bug fix for file X", or "this patch |
| 23 |
includes updates for subsystem X. Please apply." |
| 24 |
|
| 25 |
If your description starts to get long, that’s a sign that you probably |
| 26 |
need to split up your commit. See the next point. |
| 27 |
|
| 28 |
=== 2. Separate your changes |
| 29 |
|
| 30 |
Separate each logical change into its own commit. |
| 31 |
|
| 32 |
For example, if your changes include both bug fixes and performance |
| 33 |
enhancements for a single module, separate those changes into two or |
| 34 |
more patches. |
| 35 |
|
| 36 |
On the other hand, if you make a single change to numerous files, group |
| 37 |
those changes into a single commit. Thus a single LOGICAL change is |
| 38 |
contained within a single commit. |
| 39 |
|
| 40 |
If one commit depends on another commit in order for a change to be |
| 41 |
complete, that is OK. Simply note "this commit depends on commit X" in |
| 42 |
the extended commit description. |
| 43 |
|
| 44 |
If your commit includes significant whitespace changes these should also |
| 45 |
be broken out into another, separate, commit. |
| 46 |
|
| 47 |
== Submitting patches via GitHub |
| 48 |
|
| 49 |
See the following links for more details about submitting via github: |
| 50 |
|
| 51 |
* https://help.github.com/articles/fork-a-repo |
| 52 |
* http://wiki.freeradius.org/contributing/GitHub |
| 53 |
|
| 54 |
== Submitting patches via email |
| 55 |
|
| 56 |
=== 1. diff -u |
| 57 |
|
| 58 |
Use `diff -u` or `diff -urN` to create patches. |
| 59 |
|
| 60 |
All changes to the source occur in the form of patches, as generated by |
| 61 |
diff(1). When creating your patch, make sure to create it in unified |
| 62 |
diff format, as supplied by the `-u` argument to diff(1). Patches |
| 63 |
should be based in the root source directory, not in any lower |
| 64 |
subdirectory. |
| 65 |
|
| 66 |
To create a patch for a single file, it is often sufficient to do:: |
| 67 |
|
| 68 |
``` |
| 69 |
SRCTREE=/home/user/src/freeradiusd/ |
| 70 |
MYFILE=src/modules/rlm_foo/foo.c |
| 71 |
|
| 72 |
cd $SRCTREE |
| 73 |
cp $MYFILE $MYFILE.orig |
| 74 |
vi $MYFILE # make your change |
| 75 |
diff -u $MYFILE.orig $MYFILE > /tmp/patch |
| 76 |
``` |
| 77 |
|
| 78 |
To create a patch for multiple files, you should unpack a `vanilla`, |
| 79 |
or unmodified source tree, and generate a diff against your own source |
| 80 |
tree. For example: |
| 81 |
|
| 82 |
``` |
| 83 |
MYSRC=/home/user/src/freeradiusd-feature/ |
| 84 |
|
| 85 |
gunzip freeradiusd-version.tar.gz |
| 86 |
tar xvf freeradiusd-version.tar |
| 87 |
diff -urN freeradiusd-version $MYSRC > ~/feature-version.patch |
| 88 |
``` |
| 89 |
|
| 90 |
=== 2. Select e-mail destination |
| 91 |
|
| 92 |
If you are on the developers mailing list, send the patch there. |
| 93 |
mailto:[email protected][[email protected]] |
| 94 |
|
| 95 |
Otherwise, send the patch to |
| 96 |
mailto:[email protected][[email protected]] |
| 97 |
|
| 98 |
=== 3. No MIME, no links, no compression, no attachments. Just plain text |
| 99 |
|
| 100 |
The developers need to be able to read and comment on the changes you |
| 101 |
are submitting. It is important for a developer to be able to `quote` |
| 102 |
your changes, using standard e-mail tools, so that they may comment on |
| 103 |
specific portions of your code. |
| 104 |
|
| 105 |
For this reason, all patches should be submitting e-mail `inline`. |
| 106 |
|
| 107 |
Do not attach the patch as a MIME attachment, compressed or not. Many |
| 108 |
popular e-mail applications will not always transmit a MIME attachment |
| 109 |
as plain text, making it impossible to comment on your code. A MIME |
| 110 |
attachment also takes a bit more time to process, decreasing the |
| 111 |
likelihood of your MIME-attached change being accepted. |
| 112 |
|
| 113 |
Compressed patches are generally rejected outright. If the developer has |
| 114 |
to do additional work to read your patch, the odds are that it will be |
| 115 |
ignored completely. |
| 116 |
|
| 117 |
=== 4. E-mail size |
| 118 |
|
| 119 |
Large changes are not appropriate for mailing lists, and some |
| 120 |
maintainers. If your patch, exceeds 5Kb in size, you must submit the |
| 121 |
patch via GitHub instead. |
| 122 |
|
| 123 |
=== 5. Name the version of the server |
| 124 |
|
| 125 |
It is important to note, either in the subject line or in the patch |
| 126 |
description, the server version to which this patch applies. |