I want to fix a bug. Where do I start?

Although I am not a professional programmer, I have written a program or two. Yet, nowadays every engineer and scientist learns to program a bit as well, and as such I am used to writing programs in Python, C and MATLAB. Now I want to give back a bit to Ubuntu and its great folks and fix a bug!

I had a look at the list of the bitesize campaign and had to find that most of them are not that easy for me to fix as I suspect they require a lot of time to get into the matter, and I do not have that. Still I discovered this one and it looks manageable and like a cool feature to me.

As I have never written a patch or released a program to the wild before though, I have no idea where to start. What should be my first step to tackle that problem?

Bottom line: Where and how do I start fixing that guy?


Answering this question can get long and complicated, so I am instead going to point you to resources available instead of rehashing them here.

Documentation

  1. Getting Set Up for Ubuntu Development
  2. How to Fix Bugs

Tutorials

We run events throughout the cycle to help people just like you, specifically we run Ubuntu Developer Week in IRC, which is a live tutorial and Question and Answer workshop. There's one coming up at the end of February if you want to join in!

Here are two logs from a past session to give you an idea:

  • Getting Started in Ubuntu Development I
  • Getting Started in Ubuntu Development II

Places to Find Opportunities

  • Harvest - this tool goes through all the patches and packages in Launchpad (and even looks in other distros) for patches. Many of these can be snagged, applied, tested, and then fixed in Ubuntu and then sent upstream.
  • Cleansweep - List of patches sitting in Launchpad that someone has attached to a bug report. These could be useful or not, they still should be looked at though.

Getting Help

Contacting the MOTU on the mailing list or IRC is a good way to get help for individual problems you run into:

  • https://wiki.ubuntu.com/MOTU/Contact

Feedback

We've spent a lot of time reworking this documentation to be as easy as we can, if you would take notes on your experiences and how we can improve this stuff it would be very useful to know how to make it suck less for people like you.


Jorge's generalized answer is a great introduction to jumping into Ubuntu development, but let's try to look a little closer at you specific issue...

Apport's main upstream developer and Ubuntu maintainer are one and the same. This simplifies things for you a bit. Instead of having to learn about packaging and patch systems, the easiest path here is to work directly on the upstream code.

Apport's development is hosted on Launchpad. It uses the bazaar distributed version control system to manage its source code. The first step towards fixing your bug is to grab the source. If you haven't used bazaar before, the bazaar in five minutes tutorial is a good place to start.

Install bazaar with:

sudo apt-get install bzr

Pull apport's source code:

bzr branch lp:apport

Now you can get started hacking. As with most VCSs, when working with bazaar, it is a good idea to only make one change per commit. You should also make your commit messages informative. It makes your changes much easier to review. When you are ready to make your first commit, run:

bzr commit -m "My commit message. Did foo to bar in order to achieve baz."

Continue making changes and commits until you are satisfied that your bug is fixed. With your last commit, you can also tag it as fixing the bug by appending --fixes lp:<bug_number> to the commit command. Now you are ready to submit your changes for review and inclusion.

First, you need to push it to Launchpad in order to make it publicly available:

bzr push lp:~<launchpad_username>/apport/<branch_name>

Your branch can now be found at:

https://code.launchpad.net/~<launchpad_username>/apport/<branch_name>/

Running bzr lp-open in the branch will open that location in a browser.

Now we want to propose a merge. On that page, select "Propose for merging."

propose for merging

On the next page, select your target branch and give an overview of your changes.

describe merge

You will now have an active merge proposal.

active review

The maintainers will review your changes. If they are appropriate, they will be merged and be available in the next release. Alternatively, the proposal may be set to "Needs Work," and the maintainers will discuss with you additional changes that should be made before merging. If this happens, please don't take it as any kind of personal rejection of your work. When contributing to a new project for the first time, there are often little things like coding style that you might not be aware of.