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 2D8C7429E3D for ; Thu, 17 Feb 2011 23:59:32 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled 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 t9dl3qpuOxaS for ; Thu, 17 Feb 2011 23:59:30 -0800 (PST) Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU [18.9.25.13]) by olra.theworths.org (Postfix) with ESMTP id D66A7429E2A for ; Thu, 17 Feb 2011 23:59:23 -0800 (PST) X-AuditID: 1209190d-b7cacae000000a14-d2-4d5e26db6146 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) by dmz-mailsec-scanner-2.mit.edu (Symantec Brightmail Gateway) with SMTP id 73.55.02580.BD62E5D4; Fri, 18 Feb 2011 02:59:23 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id p1I7xNrE009333; Fri, 18 Feb 2011 02:59:23 -0500 Received: from drake.mit.edu (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com [209.6.116.242]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id p1I7xM9F001528 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Fri, 18 Feb 2011 02:59:22 -0500 (EST) Received: from amthrax by drake.mit.edu with local (Exim 4.72) (envelope-from ) id 1PqLFK-0008L8-1E; Fri, 18 Feb 2011 02:59:22 -0500 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH 02/10] new: Don't loose messages on SIGINT. Date: Fri, 18 Feb 2011 02:58:52 -0500 Message-Id: <1298015940-31986-3-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1298015940-31986-1-git-send-email-amdragon@mit.edu> References: <1298015940-31986-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: AAAAAA== Cc: amdragon@mit.edu 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: Fri, 18 Feb 2011 07:59:32 -0000 Previously, message removals were always performed, even after a SIGINT. As a result, when a message was moved from one folder to another, a SIGINT between processing the directory the message was removed from and processing the directory it was added to would result in notmuch removing that message from the database. --- notmuch-new.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/notmuch-new.c b/notmuch-new.c index 941f9d6..a910e5f 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -837,7 +837,7 @@ notmuch_new_command (void *ctx, int argc, char *argv[]) removed_files = 0; renamed_files = 0; gettimeofday (&tv_start, NULL); - for (f = add_files_state.removed_files->head; f; f = f->next) { + for (f = add_files_state.removed_files->head; f && !interrupted; f = f->next) { status = notmuch_database_remove_message (notmuch, f->filename); if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) renamed_files++; @@ -852,7 +852,7 @@ notmuch_new_command (void *ctx, int argc, char *argv[]) } gettimeofday (&tv_start, NULL); - for (f = add_files_state.removed_directories->head, i = 0; f; f = f->next, i++) { + for (f = add_files_state.removed_directories->head, i = 0; f && !interrupted; f = f->next, i++) { _remove_directory (ctx, notmuch, f->filename, &renamed_files, &removed_files); if (do_print_progress) { -- 1.7.2.3