[PATCH 1/6] lib: construct compactor within try block to catch any exceptions
authorJani Nikula <jani@nikula.org>
Fri, 1 Nov 2013 14:27:10 +0000 (15:27 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:57:50 +0000 (09:57 -0800)
e4/b2c4ee0c50f7f93572ccd6e77aefbb8ac4ed06 [new file with mode: 0644]

diff --git a/e4/b2c4ee0c50f7f93572ccd6e77aefbb8ac4ed06 b/e4/b2c4ee0c50f7f93572ccd6e77aefbb8ac4ed06
new file mode 100644 (file)
index 0000000..05e4be0
--- /dev/null
@@ -0,0 +1,99 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id A4BCA431FD0\r
+       for <notmuch@notmuchmail.org>; Fri,  1 Nov 2013 07:27:38 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id Aw7yuZKubvAJ for <notmuch@notmuchmail.org>;\r
+       Fri,  1 Nov 2013 07:27:34 -0700 (PDT)\r
+Received: from mail-ea0-f173.google.com (mail-ea0-f173.google.com\r
+       [209.85.215.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 40F66431FB6\r
+       for <notmuch@notmuchmail.org>; Fri,  1 Nov 2013 07:27:34 -0700 (PDT)\r
+Received: by mail-ea0-f173.google.com with SMTP id g10so2090283eak.4\r
+       for <notmuch@notmuchmail.org>; Fri, 01 Nov 2013 07:27:33 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=1e100.net; s=20130820;\r
+       h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+       :references:in-reply-to:references;\r
+       bh=emoBs7dLghtavfpAy7YxN20nFqQiC0CKb9juHaSjdOs=;\r
+       b=QjYtP5PS5lhDgsrZDuS+g+eZh95619OPq6kuZrttazvmrUBF4SKo4eCyrJUYD8kG+R\r
+       /LZSlJrEBO/iGEnq4tpAvKdEv0cEtSDEX1RgCWLu+vT9l7OfSODDF3VCuwLsdd6oPU5D\r
+       AaGMBWEAEzBuu35S02Yxq9z5CS20Ciw+sGZORDfQ7lO9etchYjLghCzJs7HYurqABHul\r
+       VcaE8fJfPpDnJ988+BnmRU2NL4r4BGjkh+OkYvK+JIfpYZ76EM3LuB1bna3HHOQwvhfy\r
+       xIvls3leu3RBGiE0g+N4ZANyQ1m8/4efMdgJ/3FUB3hq+xdALkDfIyhQ5z3A08hsapQ2\r
+       H7Ag==\r
+X-Gm-Message-State:\r
+ ALoCoQmaMA89uu8WeirCdvSdgXJLCddrNAfOoc7Ko9Eym6HX1RPUvMhj42+SwufoqEjN8l6Jvj2/\r
+X-Received: by 10.15.33.198 with SMTP id c46mr117965eev.115.1383316053166;\r
+       Fri, 01 Nov 2013 07:27:33 -0700 (PDT)\r
+Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3])\r
+       by mx.google.com with ESMTPSA id w6sm8341181eeo.12.2013.11.01.07.27.31\r
+       for <multiple recipients>\r
+       (version=TLSv1.1 cipher=RC4-SHA bits=128/128);\r
+       Fri, 01 Nov 2013 07:27:32 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/6] lib: construct compactor within try block to catch any\r
+       exceptions\r
+Date: Fri,  1 Nov 2013 15:27:10 +0100\r
+Message-Id:\r
+ <3812f697da88a2d4ad90e899484b99723c803ec7.1383315568.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.2.5\r
+In-Reply-To: <cover.1383315568.git.jani@nikula.org>\r
+References: <cover.1383315568.git.jani@nikula.org>\r
+In-Reply-To: <cover.1383315568.git.jani@nikula.org>\r
+References: <cover.1383315568.git.jani@nikula.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 01 Nov 2013 14:27:38 -0000\r
+\r
+Constructors may also throw exceptions. Catch them.\r
+---\r
+ lib/database.cc |    3 ++-\r
+ 1 files changed, 2 insertions(+), 1 deletions(-)\r
+\r
+diff --git a/lib/database.cc b/lib/database.cc\r
+index 20e5ec2..3dfea0f 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -864,7 +864,6 @@ notmuch_database_compact (const char* path,\r
+                         notmuch_compact_status_cb_t status_cb)\r
+ {\r
+     void *local = talloc_new (NULL);\r
+-    NotmuchCompactor compactor(status_cb);\r
+     char *notmuch_path, *xapian_path, *compact_xapian_path;\r
+     char *old_xapian_path = NULL;\r
+     notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS;\r
+@@ -910,6 +909,8 @@ notmuch_database_compact (const char* path,\r
+     }\r
\r
+     try {\r
++      NotmuchCompactor compactor(status_cb);\r
++\r
+       compactor.set_renumber(false);\r
+       compactor.add_source(xapian_path);\r
+       compactor.set_destdir(compact_xapian_path);\r
+-- \r
+1.7.2.5\r
+\r