Wednesday, September 2, 2009

Fixing small bugs in Ubuntu

A bugs like typo doesn't require you to have a great technical knowledge. Yet there are many bugs in launchpad that are related to typos. Once you start fixing this kinds of bugs chances are you will move on and start fixing more complex bug simple and small bugs.

So how do we get started ? If you haven't missed yesterday's #ubuntu-classroom you should have known a lot. Here I'm just trying to replay yesterday's class by dholbach on "Fixing small bugs in Ubuntu".

First of all lets prepare our system. It is recommended to use a development release. Its not important at this moment. For now open your terminal and type:
sudo apt-get install --no-install-recommends bzr ubuntu-dev-tools devscripts dpkg-dev cdbs
Now make sure you have 'Sources' enabled in System -> Administration -> Software Sources -> Ubuntu Software .

Now open ~/.bashrc file in your favorite text editor. Add the following line to it.
export DEBFULLNAME='Your Name'
export DEBEMAIL='youremail@domain.com'
Now save the file and run it by going to terminal and typing:
source ~/.bashrc
What this does is sets the variable DEBFULLNAME and DEBEMAIL for this session. After every restart the ~/.bashrc file is automatically run and sets the variable.

Now lets look at the bug https://bugs.launchpad.net/ubuntu/+source/edubuntu-addon-meta/+bug/404608

The bug states a typo in package description.
Now lets get the source of the package edubuntu-addon-meta. Open your terminal and type:
apt-get source edubuntu-addon-meta

now cd to that directory(edubuntu-addon-meta-0.12)

The package description is in the file debian/control. Open that file, fix the typo and save it.

Now we need to document the change we made in debian/changelog.
For this we can use dch tool. Now run:
dch -i
This will create a changelog entry increment the version number.
Now put something like this as the actual changelog entry
debian/control: replaced "form" with "from". (LP: #404608)
This describes what action was done on what file and also mentions the bug number in special format. The format LP: #xxxxxxxxxx closes the bug automatically on upload. With detailed information it enables others to revisit the bug and better understand why you did you changes. Save the file now.

Now run:
debuild -S
which will rebuild the source package. You can ignore the signing part for now. Now if you cd .. then you'll see edubuntu-addon-meta_0.12.dsc edubuntu-addon-meta_0.12.tar.gz edubuntu-addon-meta_0.13.dsc edubuntu-addon-meta_0.13.tar.gz and few other files.
This means you successfully rebuilt the source package.

After fixing the bug it is must for you to test it before distributing.

Now run:
debdiff edubuntu-addon-meta_0.12.dsc edubuntu-addon-meta_0.13.dsc
This will show the difference in the version.
You can redirect the output to edubuntu-addon-meta.fix and attach to bug report.

Bug fixed.

Please go through the irc logs to see this in action and to see more bugs fixed.

0 comments:

Post a Comment