28
29
it out and find your first bug to work on.
34
If you know which source package contains the code that shows the problem, it
35
is trivial. Just type in::
37
bzr branch lp:ubuntu/<packagename>
39
where ``<packagename>`` is the name of the source package. This will check out
40
the code of the latest Ubuntu development release. If you need the code of a
41
stable release, let's say ``hardy``, you would type in::
43
bzr branch lp:ubuntu/hardy/<packagename>
34
Figuring out what to fix
35
========================
37
If you don't know the source package containing the code that has the problem,
38
but you do know the path to the affected program on your system, you can
39
discover the source package that you'll need to work on.
41
Let's say you've found a bug in Tomboy, a note taking desktop application.
42
The Tomboy application can be started by running ``/usr/bin/tomboy`` on the
43
command line. To find the binary package containing this application, use
46
$ apt-file find /usr/bin/tomboy
48
This would print out::
50
tomboy: /usr/bin/tomboy
52
Note that the part preceding the colon is the binary package name. It's often
53
the case that the source package and binary package will have different names.
54
This is most common when a single source package is used to build multiple
55
different binary packages. To find the source package for a particular binary
58
$ apt-cache show tomboy | grep ^Source:
60
In this case, nothing is printed, meaning that ``tomboy`` is also the name of
61
the binary package. An example where the source and binary package names
62
differ is ``python-vigra``. While that is the binary package name, the source
63
package is actually ``libvigraimpex`` and can be found with this command (and
66
$ apt-cache show python-vigra | grep ^Source:
45
69
.. XXX: Link to SRU article.
75
Once you know the source package to work on, you will want to get a copy of
76
the code on your system, so that you can debug it. This is done by
77
:ref:`*branching* the source package <branching>` branch corresponding to the
78
source package. Launchpad maintains source package branches for all the
81
Once you've got a local branch of the source package, you can investigate the
82
bug, create a fix, and upload your proposed fix to Launchpad, in the form of a
83
Bazaar branch. When you are happy with your fix, you can :ref:`submit a
84
*merge proposal* <merge-proposal>`, which asks other Ubuntu developers to
85
review and approve your change. If they agree with your changes, an Ubuntu
86
developer will upload the new version of the package to Ubuntu so that
87
everyone gets the benefit or your excellent fix - and you get a little bit of
88
credit. You're now on your way to becoming an Ubuntu developer!
90
We'll describe specifics on how to branch the code, push your fix, and request
91
a review in the following sections.
51
97
There are entire books written about finding bugs, fixing them, testing them,
52
98
etc. If you are completely new to programming, try to fix easy bugs such as
63
109
.. XXX: Link to 'update to a new version' article.
66
If you find a patch to fix the problem, running this command in the source
67
directory should apply the patch::
69
patch -p1 < ../bugfix.patch
111
If you find a patch to fix the problem, say, attached to a bug report, running
112
this command in the source directory should apply the patch::
114
$ patch -p1 < ../bugfix.patch
71
116
Refer to the ``patch(1)`` manpage for options and arguments such as
72
117
``--dry-run``, ``-p<num>``, etc.
78
To build a test package with your changes, run these commands::
81
pbuilder-dist <release> build ../<package>_<version>.dsc
83
This will create a source package from the branch contents (``-us -uc`` will
84
just omit the step to sign the source package) and pbuilder-dist will build
85
the package from source for whatever ``release`` you choose.
87
Once the build succeeded, install the package from
88
``~/pbuilder/<release>_result/`` (using ``sudo dpkg -i
89
<package>_<version>.deb``). Then test to see if the bug is fixed.
96
It is very important to document your change sufficiently so developers who
97
look at the code in the future won't have to guess what your reasoning was and
98
what your assumptions were. Every Debian and Ubuntu package source includes
99
``debian/changelog``, where changes of each uploaded package are tracked.
101
The easiest way to do this is to run::
105
This will add a boilerplate changelog entry for you and launch an editor
106
where you can fill out the blanks. An example of this could be::
108
specialpackage (1.2-3ubuntu4) natty; urgency=low
110
* debian/control: updated description to include frobnicator (LP: #123456)
112
-- Emma Adams <emma.adams@isp.com> Sat, 17 Jul 2010 02:53:39 +0200
114
``dch`` should fill out the first and last line of such a changelog entry for
115
you already. Line 1 consists of the source package name, the version number,
116
which Ubuntu release it is uploaded to, the urgency (which almost always is
117
'low'). The last line always contains the name, email address and timestamp
118
(in RFC 2822 format) of the change.
120
With that out of the way, let's focus on the actual changelog entry itself:
121
it is very important to document:
123
#. where the change was done
125
#. where the discussion of the change happened
127
In our (very sparse) example the last point is covered by "(LP: #123456)"
128
which refers to Launchpad bug 123456. Bug reports or mailing list threads
129
or specifications are usually good information to provide as a rationale for a
130
change. As a bonus, if you use the ``LP: #<number>`` notation for Launchpad
131
bugs, the bug will be automatically closed when the package is uploaded to
138
With the changelog entry written and saved, you can just run::
142
and the change will be committed (locally) with your changelog entry as a
145
To push it to Launchpad, as the remote branch name, you need to stick to the
146
following nomenclature::
148
lp:~<yourlpid>/ubuntu/<release>/<package>/<branchname>
150
This could for example be::
152
lp:~emmaadams/ubuntu/natty/specialpackage/fix-for-123456
156
bzr push lp:~emmaadams/ubuntu/natty/specialpackage/fix-for-123456
159
you should be all set. The push command should push it to Launchpad and the
160
second command will open the Launchpad page of the remote branch in your
161
browser. There find the "(+) Propose for merging" link, click it to get the
162
change reviewed by somebody and included in Ubuntu.
168
.. XXX: link to 'forwarding patches' article
169
.. XXX: link to 'debdiff' article (in case of slow internet, package not