Patches
This page is part of the Bug Squad’s KnowledgeBase - pages with information about how to triage bugs. |
Definition
What is a patch? A patch is a change to an Ubuntu package that will resolve a bug report. These include but are not necessarily limited to:
- changes to the packaging of an Ubuntu package
- changes to the source code included in an Ubuntu package
These changes can appear in a few different formats:
diff
A diff is a plain text file that contains differences between the original file and changed file.
Example:
diff -Nurp ciso-1.0.0/ciso.h ciso-1.0.0-fixed/ciso.h --- ciso-1.0.0/ciso.h 2006-11-03 12:53:02.000000000 -0800 +++ ciso-1.0.0-fixed/ciso.h 2008-11-27 13:32:01.000000000 -0800 @@ -28,9 +28,9 @@ typedef struct ciso_header { unsigned char magic[4]; /* +00 : 'C','I','S','O' */ -unsigned long header_size; /* +04 : header size (==0x18) */ +uint32_t header_size; /* +04 : header size (==0x18) */ unsigned long long total_bytes; /* +08 : number of original data size */ -unsigned long block_size; /* +10 : number of compressed block size */ +uint32_t block_size; /* +10 : number of compressed block size */ unsigned char ver; /* +14 : version 01 */ unsigned char align; /* +15 : align of index value */ unsigned char rsv_06[2]; /* +16 : reserved */
debdiff
A debdiff is a plain text file that contains the differences between two Ubuntu package versions. The debdiff will probably include changes to the source of the package itself inaddition to files in the debian directory.
Shortened Example:
diff -u ciso-1.0.0/debian/rules ciso-1.0.0/debian/rules --- ciso-1.0.0/debian/rules +++ ciso-1.0.0/debian/rules @@ -20,8 +20,10 @@ CFLAGS += -O2 endif +include /usr/share/dpatch/dpatch.make + configure: configure-stamp -configure-stamp: +configure-stamp: patch dh_testdir # Add here commands to configure the package. @@ -39,7 +41,9 @@ touch $@ -clean: +clean: clean-patched unpatch + +clean-patched: dh_testdir dh_testroot rm -f build-stamp configure-stamp @@ -86 +90 @@ -.PHONY: build clean binary-indep binary-arch binary install configure +.PHONY: build clean clean-patched binary-indep binary-arch binary install configure diff -u ciso-1.0.0/debian/control ciso-1.0.0/debian/control --- ciso-1.0.0/debian/control +++ ciso-1.0.0/debian/control @@ -1,8 +1,9 @@ Source: ciso Section: utils Priority: optional -Maintainer: Gaëtan Petit <tenshu@gmail.com> -Build-Depends: debhelper (>= 5), zlib1g-dev +Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com> +XSBC-Original-Maintainer: Gaëtan Petit <tenshu@gmail.com> +Build-Depends: debhelper (>= 5), zlib1g-dev, dpatch Standards-Version: 3.7.2
Other
- image files - in the event a package is missing a menu icon
Patches in Launchpad
Attachments that are patches can be flagged in the Launchpad bug tracker, which then makes them show up in search results and on other reports. Attachments to bug reports appear in the attachments portlet on the right hand side of a bug report.
The third attachment has a star by it, which indicates that this attachment is flagged as a patch. However, these stars do not normally show up in Launchpad, they require the lp_patches Greasemonkey script. There is also an "edit" link next to each attachment, that will take you to the following page:
Here you can set and unset the patch flag on a per attachment basis.
Process
How do patches end up in Ubuntu packages? Lets look at the process in reverse, from the actually upload to a patch being added to a pbug report.
The last step for a bug report with a patch to be fixed is for it to be sponsored to the appropriate archive
There are two sponsorship queues one for packages in the main and restricted repositories and one for packages in the universe and multiverse repositories
- Bug reports end up in the sponsorship queue by having the appropriate team subscribed (NOT assigned) to the bug report - ubuntu-main-sponsors or ubuntu-universe-sponsors
- Can only bugs with debdiffs have the sponsor teams subscribed?
- Before being sponsored bug reports should be identified as having patches or not