Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id B7F774196F3 for ; Sat, 27 Mar 2010 21:28:06 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FBkoUkrT0GPo for ; Sat, 27 Mar 2010 21:28:05 -0700 (PDT) Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) by olra.theworths.org (Postfix) with ESMTP id B833D4196F2 for ; Sat, 27 Mar 2010 21:28:05 -0700 (PDT) Received: from localhost (unknown [192.168.200.4]) by max.feld.cvut.cz (Postfix) with ESMTP id 1136619F3420; Sun, 28 Mar 2010 06:28:05 +0200 (CEST) X-Virus-Scanned: IMAP AMAVIS Received: from max.feld.cvut.cz ([192.168.200.1]) by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new, port 10044) with ESMTP id y-Odc0pVWLtm; Sun, 28 Mar 2010 06:28:03 +0200 (CEST) Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) by max.feld.cvut.cz (Postfix) with ESMTP id 9F88619F33CD; Sun, 28 Mar 2010 06:28:03 +0200 (CEST) Received: from steelpick.2x.cz (r5da224.net.upc.cz [86.49.116.224]) (Authenticated sender: sojkam1) by imap.feld.cvut.cz (Postfix) with ESMTPSA id 40449FA003; Sun, 28 Mar 2010 06:28:02 +0200 (CEST) Received: from wsh by steelpick.2x.cz with local (Exim 4.71) (envelope-from ) id 1Nvk6V-0002RD-7q; Sun, 28 Mar 2010 06:28:03 +0200 From: Michal Sojka To: Sebastian Spaeth , notmuch@notmuchmail.org In-Reply-To: <878w9d2ovw.fsf@SSpaeth.de> References: <1269638293-23520-1-git-send-email-sojkam1@fel.cvut.cz> <878w9dqqub.fsf@SSpaeth.de> <878w9d2ovw.fsf@SSpaeth.de> Date: Sun, 28 Mar 2010 06:28:03 +0200 Message-ID: <87zl1tgje4.fsf@steelpick.2x.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch new X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Mar 2010 04:28:06 -0000 On Sun, 28 Mar 2010, Sebastian Spaeth wrote: > On Sun, 28 Mar 2010 00:37:00 +0100, "Sebastian Spaeth" wrote: > > On Fri, 26 Mar 2010 22:18:13 +0100, Michal Sojka wrote: > > > When Ctrl-C is pressed in a wrong time during notmuch new, it can lead > > > to removal of messages from the database even if the files were not > > > removed. > > CC -O2 notmuch-new.o > notmuch-new.c: In function 'add_files_recursive': > notmuch-new.c:519: error: 'add_files_state_t' has no member named 'interrupted' > make: *** [notmuch-new.o] Error 1 > > I have not checked the code yet, but simply applying this patch make the > compile fail. Oh, sorry. I thought it is so trivial, that I didn't even compile it for master. The right version is here: --8<---------------cut here---------------start------------->8--- >From 117de1fcc316a4792244a36b68e38215ff2a5bdc Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Fri, 26 Mar 2010 22:16:26 +0100 Subject: [PATCH v2] Prevent data loss caused by SIGINT during notmuch new When Ctrl-C is pressed in a wrong time during notmuch new, it can lead to removal of messages from the database even if the files were not removed. It happened at least once to me. Signed-off-by: Michal Sojka --- notmuch-new.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/notmuch-new.c b/notmuch-new.c index 44b50aa..109bef2 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -454,6 +454,9 @@ add_files_recursive (notmuch_database_t *notmuch, next = NULL; } + if (! interrupted) + goto DONE; + /* Now that we've walked the whole filesystem list, anything left * over in the database lists has been deleted. */ while (notmuch_filenames_valid (db_files)) -- 1.7.0.2