From: Mark Walters Date: Sun, 22 Apr 2012 07:42:34 +0000 (+0100) Subject: Re: [PATCH v2 4/4] new: Fix missing end_atomic in remove_filename on error X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=fdbb385f2f9f5aec1560f930ca288c3575ffb7b1;p=notmuch-archives.git Re: [PATCH v2 4/4] new: Fix missing end_atomic in remove_filename on error --- diff --git a/80/c393219a88fc04d64f9180bf3626aaf4655a13 b/80/c393219a88fc04d64f9180bf3626aaf4655a13 new file mode 100644 index 000000000..fb3bbea53 --- /dev/null +++ b/80/c393219a88fc04d64f9180bf3626aaf4655a13 @@ -0,0 +1,124 @@ +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 3EB58431FAF + for ; Sun, 22 Apr 2012 00:42:18 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 B2+uEkiYoj1Z for ; + Sun, 22 Apr 2012 00:42:16 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 9705A431FAE + for ; Sun, 22 Apr 2012 00:42:16 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1SLrR0-0004Hf-LQ; Sun, 22 Apr 2012 08:42:14 +0100 +Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223] + helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) + (envelope-from ) + id 1SLrR0-00000x-9h; Sun, 22 Apr 2012 08:42:14 +0100 +From: Mark Walters +To: Austin Clements , notmuch@notmuchmail.org +Subject: Re: [PATCH v2 4/4] new: Fix missing end_atomic in remove_filename on + error +In-Reply-To: <1335068868-12593-5-git-send-email-amdragon@mit.edu> +References: <1330357759-1337-1-git-send-email-amdragon@mit.edu> + <1335068868-12593-1-git-send-email-amdragon@mit.edu> + <1335068868-12593-5-git-send-email-amdragon@mit.edu> +User-Agent: Notmuch/0.12+110~gbc97b4a (http://notmuchmail.org) Emacs/23.3.1 + (x86_64-pc-linux-gnu) +Date: Sun, 22 Apr 2012 08:42:34 +0100 +Message-ID: <877gx8kyad.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 94.192.233.223 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: e84890b7daac992a5a6cdc69cd748415 (of first 20000 bytes) +X-SpamAssassin-Score: -1.8 +X-SpamAssassin-SpamBar: - +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored -1.8 points. + Summary of the scoring: + * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, + * medium trust + * [138.37.6.40 listed in list.dnswl.org] + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay + * domain + * 0.5 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +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, 22 Apr 2012 07:42:18 -0000 + +On Sun, 22 Apr 2012, Austin Clements wrote: +> Previously, if we failed to find the message by filename in +> remove_filename, we would return immediately from the function without +> ending its atomic block. Now this code follows the usual goto DONE +> idiom to perform cleanup. + +The whole series looks good to me modulo the return value in Patch 2/4. + +Best wishes + +Mark + +> --- +> notmuch-new.c | 5 ++++- +> 1 files changed, 4 insertions(+), 1 deletions(-) +> +> diff --git a/notmuch-new.c b/notmuch-new.c +> index 2103b18..9eebea4 100644 +> --- a/notmuch-new.c +> +++ b/notmuch-new.c +> @@ -779,7 +779,8 @@ remove_filename (notmuch_database_t *notmuch, +> return status; +> status = notmuch_database_find_message_by_filename (notmuch, path, &message); +> if (status || message == NULL) +> - return status; +> + goto DONE; +> + +> status = notmuch_database_remove_message (notmuch, path); +> if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) { +> add_files_state->renamed_messages++; +> @@ -790,6 +791,8 @@ remove_filename (notmuch_database_t *notmuch, +> add_files_state->removed_messages++; +> } +> notmuch_message_destroy (message); +> + +> + DONE: +> notmuch_database_end_atomic (notmuch); +> return status; +> } +> -- +> 1.7.9.1 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch