This page is still a beta!

Bugfixes and Patches

August 11, 2006

Author: Sebastian Kurfürst and Ingmar Schlecht

We all want to make TYPO3 even better than it is, and many people want to contribute with bugfixes. Often, it is hard for newcomers to use the tools most effectively and in a way the core team can use their contributions (patches, etc...).

Intended Audience

This document is made for all TYPO3 developers who want to contribute code in the form of bug fixes. Besides that, it is intended for people with a professional background who use and modify TYPO3 on a daily basis, and want to let their improvements float back into the core.

Find a bug

Go to http://bugs.typo3.org and look for a bug which suits you. If you want to fix the bug, add a short note.

The TYPO3 source layout

You should seperate the data of your development installation (dummy package) and the source files. For that, you should use symlinks (or junctions under Windows).

You should have one unmodified source tree ready, which you don't touch. Before you start digging into the code, copy this source tree to a different location. Modify only the new one.

Now, go and fix the bug by editing TYPO3 core files.

After you fixed the bug, it is important to upload what you did to the bugtracker.

Diff

Of course, it would be a possibility to upload changed source files. This, however, would have several disadvantages: everybody would need exactly the same versions and it would not be possible that two people edit the same file.

That's why we use a tool called diff: (on windows, we recommend http://winmerge.sf.net)

Go to the directory where both source trees are located, go to the commandline and type:

diff -ruN typo3_source_old/ typo3_source_new/ > patchfile.patch

The command line options do the following: r stands for recusrive, u for unified (we cannot apply the patches otherwise), N for considering new files.

patchfile.patch now contains the differences between the versions. Please upload patchfile.patch to the bugtracker and monitor the bug, so you will be notified when something happens. Make sure to add a short note to the bug again.

Cleaning up

It is very important that you delete the modified sources now, to make sure you won't accidently fix more bugs inside. We can only accept patch files which relate to a single bug.

If you want to fix more than one bug, please start over again by copying the original sources to a new location.

Patch

Bugs with fixes in the bugtracker need to be verified by numerous people. You can do that, too. Start again by copying the unmodified sources to a different location. Then you should use the command "patch" which applies the differences contained in the patch to your sources. Make sure you are inside the source tree which should be modified before running the following commands!

patch -p1 -dry-run < patchfile.patch 

If this runs without any errors, issue the other command which patches the sources. If there are errors, change the number after -p to something between 0 and 3.

patch -p1 < patchfile.patch 

Now, test the patch and provide feedback.

Subversion

You can use the stable sources without any problems, but if you want to try out cutting-edge code, you need to run subversion.

First, check out the code completely from our repository:

svn co https://svn.sourceforge.net/svnroot/typo3/TYPO3core/trunk TYPO3core

You now find the sources in the directory TYPO3core. To update the sources to the most recent state, change to TYPO3core directory and issue the command:

svn update

We hope this intro will help you fixing bugs in an effective manner and are looking forward towards your contribution.