Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a package of Bugzilla 4 in a Launchpad PPA. Keep getting a malformed patch and have redid the patch from ground up numerous times without any success. One of the logs can be seen here (it's very long so just ctrl+f for the word fail/ed). The error refers to the following lines in my code:

diff -Naur bugzilla-srcdir.orig// bugzilla-srcdir/
--- bugzilla-srcdir.orig//   2010-11-12 10:27:20.664915051 +0100
+++ bugzilla-srcdir/ 2010-11-12 10:28:19.721916586 +0100
@@ -144,7 +144,7 @@
        if (!i_am_cgi()
            && grep { $_ eq $script } SHUTDOWNHTML_EXIT_SILENTLY)
-            exit;
+            exit(0);

        # For security reasons, log out users when Bugzilla is down.
@@ -178,7 +178,7 @@
         $template->process("global/message.$extension.tmpl", $vars, \$t_output)
             || ThrowTemplateError($template->error);
         print $t_output . "\n";
-        exit;
+        exit(1);

diff -Naur bugzilla-srcdir.orig//chart.cgi bugzilla-srcdir/chart.cgi
--- bugzilla-srcdir.orig//chart.cgi 2010-11-12 10:26:25.625929357 +0100
+++ bugzilla-srcdir/chart.cgi   2010-11-12 10:28:19.721916586 +0100
@@ -79,7 +79,7 @@
if (grep(/^cmd-/, $cgi->param())) {
    my $params = $cgi->canonicalise_query("format", "ctype", "action");
    print $cgi->redirect("query.cgi?format=" . $cgi->param('query_format') .
                                               ($params ? "&$params" : ""));
-    exit;
+    exit(0);

my $action = $cgi->param('action');
@@ -102,7 +102,7 @@
if ($action eq "search") {
    my $params = $cgi->canonicalise_query("format", "ctype", "action");
    print $cgi->redirect("buglist.cgi" . ($params ? "?$params" : ""));
-    exit;
+    exit(0);

@@ -233,9 +233,9 @@
else {
        ThrowUserError('unknown_action', {action => $action});


# Find any selected series and return either the first or all of them.
sub getAndValidateSeriesIDs {

Ignore the time stamps, since I used the packaging source of Bugzilla 3.6 in Ubuntu Natty.

share|improve this question
up vote 2 down vote accepted

The patch that you are trying to apply in the branch has numerous patch hunks with incorrect whitespace or line counts. Both of these will cause the patch hunk to fail to apply.

In the example above, the first hunk has a missing space from most of the lines, causing it to not match the source. The second file has lines which aren't preceded by a single space, causing patch to try & interpret it as patch information. Once these errors are fixed, the are several more to fix in the patch.

share|improve this answer
Can you please refer to the exact lines, since I copied and pasted the code for the patch from the source. – Tamer Apr 26 '11 at 10:50
Never mind found it and fixed thanks :) – Tamer Apr 26 '11 at 13:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.