[notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch new
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 30 Mar 2010 08:23:23 +0000 (10:23 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:27 +0000 (09:36 -0800)
d7/b872e3dc3b6daf318197c6d7d8e6c643657861 [new file with mode: 0644]

diff --git a/d7/b872e3dc3b6daf318197c6d7d8e6c643657861 b/d7/b872e3dc3b6daf318197c6d7d8e6c643657861
new file mode 100644 (file)
index 0000000..79e4203
--- /dev/null
@@ -0,0 +1,88 @@
+Return-Path: <sojkam1@fel.cvut.cz>\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 E8C41417339\r
+       for <notmuch@notmuchmail.org>; Tue, 30 Mar 2010 01:23:28 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.9\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
+       tests=[BAYES_00=-1.9] autolearn=ham\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 gSsPgvTqQHlZ for <notmuch@notmuchmail.org>;\r
+       Tue, 30 Mar 2010 01:23:28 -0700 (PDT)\r
+Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
+       by olra.theworths.org (Postfix) with ESMTP id E8B15431FC1\r
+       for <notmuch@notmuchmail.org>; Tue, 30 Mar 2010 01:23:27 -0700 (PDT)\r
+Received: from localhost (unknown [192.168.200.4])\r
+       by max.feld.cvut.cz (Postfix) with ESMTP id 42E1C19F340C;\r
+       Tue, 30 Mar 2010 10:23:27 +0200 (CEST)\r
+X-Virus-Scanned: IMAP AMAVIS\r
+Received: from max.feld.cvut.cz ([192.168.200.1])\r
+       by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,\r
+       port 10044)\r
+       with ESMTP id 0h3kC7ewMWnj; Tue, 30 Mar 2010 10:23:26 +0200 (CEST)\r
+Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\r
+       by max.feld.cvut.cz (Postfix) with ESMTP id 0E06D19F3403;\r
+       Tue, 30 Mar 2010 10:23:26 +0200 (CEST)\r
+Received: from steelpick.2x.cz (k335-30.felk.cvut.cz [147.32.86.30])\r
+       (Authenticated sender: sojkam1)\r
+       by imap.feld.cvut.cz (Postfix) with ESMTPSA id 0A4AFFA003;\r
+       Tue, 30 Mar 2010 10:23:26 +0200 (CEST)\r
+Received: from wsh by steelpick.2x.cz with local (Exim 4.71)\r
+       (envelope-from <sojkam1@fel.cvut.cz>)\r
+       id 1NwWjN-0002DX-SB; Tue, 30 Mar 2010 10:23:25 +0200\r
+From: Michal Sojka <sojkam1@fel.cvut.cz>\r
+To: notmuch@notmuchmail.org\r
+Date: Tue, 30 Mar 2010 10:23:23 +0200\r
+Message-Id: <1269937403-8495-1-git-send-email-sojkam1@fel.cvut.cz>\r
+X-Mailer: git-send-email 1.7.0.2\r
+In-Reply-To: <874ojy9q1z.fsf@steelpick.2x.cz>\r
+References: <874ojy9q1z.fsf@steelpick.2x.cz>\r
+Subject: [notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch\r
+       new\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: Tue, 30 Mar 2010 08:23:29 -0000\r
+\r
+When Ctrl-C is pressed in a wrong time during notmuch new, it can lead\r
+to removal of messages from the database even if the files were not\r
+removed.\r
+\r
+It happened at least once to me.\r
+\r
+Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>\r
+---\r
+ notmuch-new.c |    3 +++\r
+ 1 files changed, 3 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/notmuch-new.c b/notmuch-new.c\r
+index 44b50aa..5ade168 100644\r
+--- a/notmuch-new.c\r
++++ b/notmuch-new.c\r
+@@ -454,6 +454,9 @@ add_files_recursive (notmuch_database_t *notmuch,\r
+       next = NULL;\r
+     }\r
\r
++    if (interrupted)\r
++      goto DONE;\r
++    \r
+     /* Now that we've walked the whole filesystem list, anything left\r
+      * over in the database lists has been deleted. */\r
+     while (notmuch_filenames_valid (db_files))\r
+-- \r
+1.7.0.2\r
+\r