From: Mark Walters Date: Sat, 22 Jun 2013 06:50:00 +0000 (+0100) Subject: Re: [PATCH v6 01/12] tag-util: move out 'tag' command-line checks X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=df675c0f1fae26372e5e9867d10a00679504cd73;p=notmuch-archives.git Re: [PATCH v6 01/12] tag-util: move out 'tag' command-line checks --- diff --git a/98/f0ea40a873b8c05171ed39c61e7a770922828c b/98/f0ea40a873b8c05171ed39c61e7a770922828c new file mode 100644 index 000000000..8d84701e0 --- /dev/null +++ b/98/f0ea40a873b8c05171ed39c61e7a770922828c @@ -0,0 +1,131 @@ +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 07EF8431FB6 + for ; Fri, 21 Jun 2013 23:50:20 -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 iowm1FtpDtXq for ; + Fri, 21 Jun 2013 23:50:12 -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 E540C431FAE + for ; Fri, 21 Jun 2013 23:50:11 -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 1UqHe7-0008PS-R0; Sat, 22 Jun 2013 07:50:06 +0100 +Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) + (envelope-from ) + id 1UqHe7-0007bh-Gm; Sat, 22 Jun 2013 07:50:03 +0100 +From: Mark Walters +To: Peter Wang , notmuch@notmuchmail.org +Subject: Re: [PATCH v6 01/12] tag-util: move out 'tag' command-line checks +In-Reply-To: <1371880008-18312-2-git-send-email-novalazy@gmail.com> +References: <1371880008-18312-1-git-send-email-novalazy@gmail.com> + <1371880008-18312-2-git-send-email-novalazy@gmail.com> +User-Agent: Notmuch/0.15.2+171~ge2f30a2 (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Sat, 22 Jun 2013 07:50:00 +0100 +Message-ID: <87ppvevduv.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 93.97.24.31 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: 7062fce1babddeb672b6ec6050de6852 (of first 20000 bytes) +X-SpamAssassin-Score: -0.0 +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 -0.0 points. + Summary of the scoring: + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * -0.0 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: Sat, 22 Jun 2013 06:50:20 -0000 + + + +I am working my way through the series: I have done everything except +the main patch (3/12). As I think one more series is needed please can you +update this commit message as it is now only moving one error condition +(since Jani already moved the other) + +> parse_tag_command_line checked for two error conditions which are +> specific to the 'tag' command. It can be reused for the forthcoming +> notmuch 'insert' command if we move the checks out, into notmuch-tag.c. + +Best wishes + +Mark + + +> --- +> notmuch-tag.c | 5 +++++ +> tag-util.c | 6 +++--- +> 2 files changed, 8 insertions(+), 3 deletions(-) +> +> diff --git a/notmuch-tag.c b/notmuch-tag.c +> index 9a5d3e7..3b09df9 100644 +> --- a/notmuch-tag.c +> +++ b/notmuch-tag.c +> @@ -247,6 +247,11 @@ notmuch_tag_command (notmuch_config_t *config, int argc, char *argv[]) +> fprintf (stderr, "Error: 'notmuch tag' requires at least one tag to add or remove.\n"); +> return 1; +> } +> + +> + if (*query_string == '\0') { +> + fprintf (stderr, "Error: notmuch tag requires at least one search term.\n"); +> + return 1; +> + } +> } +> +> if (notmuch_database_open (notmuch_config_get_database_path (config), +> diff --git a/tag-util.c b/tag-util.c +> index c5f5859..92e08a1 100644 +> --- a/tag-util.c +> +++ b/tag-util.c +> @@ -190,9 +190,9 @@ parse_tag_command_line (void *ctx, int argc, char **argv, +> +> *query_str = query_string_from_args (ctx, argc - i, &argv[i]); +> +> - if (*query_str == NULL || **query_str == '\0') { +> - fprintf (stderr, "Error: notmuch tag requires at least one search term.\n"); +> - return TAG_PARSE_INVALID; +> + if (*query_str == NULL) { +> + fprintf (stderr, "Out of memory.\n"); +> + return TAG_PARSE_OUT_OF_MEMORY; +> } +> +> return TAG_PARSE_SUCCESS; +> -- +> 1.7.12.1 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch