Submitting patches or diff's to the FreeRADIUS project
======================================================

For a person or company wishing to submit a change to the
FreeRADIUS project, the process can sometimes be daunting if you're
not familiar with "the system." This text is a collection of
suggestions which can greatly increase the chances of your change
being accepted.

Only trivial patches will be accepted via email.
Large patches, or patches that modify a number of files MUST be
submitted as a pull-request via GitHub.

See the following for more details:
	- https://help.github.com/articles/fork-a-repo
	- http://wiki.freeradius.org/contributing/GitHub


Submitting patches via email
----------------------------

   1. "diff -u"

      Use "diff -u" or "diff -urN" to create patches.

      All changes to the source occur in the form of patches, as
      generated by diff(1).  When creating your patch, make sure to
      create it in "unified diff" format, as supplied by the '-u'
      argument to diff(1). Patches should be based in the root source
      directory, not in any lower subdirectory.

      To create a patch for a single file, it is often sufficient to do:

           SRCTREE=/home/user/src/freeradiusd/
           MYFILE=src/modules/rlm_foo/foo.c

           cd $SRCTREE
           cp $MYFILE $MYFILE.orig
           vi $MYFILE # make your change
           diff -u $MYFILE.orig $MYFILE > /tmp/patch

      To create a patch for multiple files, you should unpack a
      "vanilla", or unmodified source tree, and generate a diff
      against your own source tree. For example:

           MYSRC=/home/user/src/freeradiusd-feature/

	   gunzip freeradiusd-version.tar.gz
           tar xvf freeradiusd-version.tar
           diff -urN freeradiusd-version $MYSRC > ~/feature-version.patch

   2. Describe your changes.

      Describe the technical detail of the change(s) your patch includes.

      Be as specific as possible. The WORST descriptions possible
      include things like "update file X", "bug fix for file X",
      or "this patch includes updates for subsystem X. Please apply."

      If your description starts to get long, that's a sign that you
      probably need to split up your patch. See #3, next.

   3. Separate your changes.

      Separate each logical change into its own patch.

      For example, if your changes include both bug fixes and
      performance enhancements for a single module, separate those
      changes into two or more patches.

      On the other hand, if you make a single change to numerous
      files, group those changes into a single patch. Thus a single
      LOGICAL change is contained within a single patch.

      If one patch depends on another patch in order for a change to
      be complete, that is OK. Simply note "this patch depends on
      patch X" in your patch description.

   4. Select e-mail destination.

      If you are on the developers mailing list, send the patch there.
      freeradius-devel@lists.freeradius.org

      Otherwise, send the patch to 'patches@freeradius.org'

   5. No MIME, no links, no compression, no attachments. Just plain text.

      The developers need to be able to read and comment on the
      changes you are submitting. It is important for a developer to
      be able to "quote" your changes, using standard e-mail tools, so
      that they may comment on specific portions of your code.

      For this reason, all patches should be submitting e-mail
      "inline".

      Do not attach the patch as a MIME attachment, compressed or
      not. Many popular e-mail applications will not always transmit a
      MIME attachment as plain text, making it impossible to comment
      on your code. A MIME attachment also takes a bit more time to
      process, decreasing the likelihood of your MIME-attached change
      being accepted.

      Compressed patches are generally rejected outright.  If the
      developer has to do additional work to read your patch, the odds
      are that it will be ignored completely.

   6. E-mail size.

      When sending patches, always follow step #5.

      Large changes are not appropriate for mailing lists, and some
      maintainers. If your patch, exceeds 40Kb in size, it is
      preferred that you store your patch on an Internet-accessible
      server, and provide instead a URL (link) pointing to your patch.

   7. Name the version of the server.

      It is important to note, either in the subject line or in the
      patch description, the server version to which this patch
      applies.

   8. Don't get discouraged. Re-submit.

      After you have submitted your change, be patient and wait. If
      the patch is approved and applied, it will appear in the next
      version of the server.

      However, if your change doesn't appear in the next version of
      the server, there could be any number of reasons. It's YOUR job
      to narrow down those reasons, correct what was wrong, and submit
      your updated change.

      It is quite common a patch to be "dropped" without
      comment. That's the nature of the system. If your patch is
      dropped, it could be due to

           A style issue (see section 2, below),
           An e-mail formatting issue (see section item 5, above)
           A technical problem with your change
           Your patch got lost among other patches

      When in doubt, re-submit.
