From: Mark Walters Date: Sun, 18 Nov 2012 17:35:23 +0000 (+0000) Subject: Re: [PATCH 01/18] cli: add stub for insert command X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=d854883d7b5a15907dcfd3e6a26b1387af629542;p=notmuch-archives.git Re: [PATCH 01/18] cli: add stub for insert command --- diff --git a/88/d11abb7b55fcdc3f7aa0291f25cf94379c4b7f b/88/d11abb7b55fcdc3f7aa0291f25cf94379c4b7f new file mode 100644 index 000000000..34f07ef97 --- /dev/null +++ b/88/d11abb7b55fcdc3f7aa0291f25cf94379c4b7f @@ -0,0 +1,188 @@ +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 954F2431FB6 + for ; Sun, 18 Nov 2012 09:35:27 -0800 (PST) +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 hvIetqDB8ARW for ; + Sun, 18 Nov 2012 09:35:27 -0800 (PST) +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 D2FE5431FAF + for ; Sun, 18 Nov 2012 09:35:26 -0800 (PST) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1Ta8mD-0006KB-AK; Sun, 18 Nov 2012 17:35:25 +0000 +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.69) + (envelope-from ) + id 1Ta8mC-0003xt-WF; Sun, 18 Nov 2012 17:35:25 +0000 +From: Mark Walters +To: Peter Wang , notmuch@notmuchmail.org +Subject: Re: [PATCH 01/18] cli: add stub for insert command +In-Reply-To: <1343223767-9812-1-git-send-email-novalazy@gmail.com> +References: <1343223767-9812-1-git-send-email-novalazy@gmail.com> +User-Agent: Notmuch/0.14+81~g9730584 (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Sun, 18 Nov 2012 17:35:23 +0000 +Message-ID: <87fw46q0f7.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable +X-Sender-Host-Address: 93.97.24.31 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: 7f9e8f0bcc1f536eb94a3f92e5bd6b5e (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.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, 18 Nov 2012 17:35:27 -0000 + + +Hi + +I have now been through essentially the whole series (except the tests) +and broadly like it. Just to summarise my concerns from the individual +replies here: + +What should insert do when interrupted and is it safe? I am not +knowledgeable enough to be confident about that. + +I think some of the talloc allocations need their return values +checked. I am more worried about this here then in most of the rest of +notmuch as we are writing to the database (and even to the mailstore +itself). + +My other concerns (code duplication with notmuch-tag.c and possible +deadlock in the tmp file code and file overwriting) are easily fixable + +Best wishes + +Mark + + + + +On Wed, 25 Jul 2012, Peter Wang wrote: +> This does nothing yet. +> --- +> Makefile.local | 1 + +> notmuch-client.h | 3 +++ +> notmuch-insert.c | 27 +++++++++++++++++++++++++++ +> notmuch.c | 3 +++ +> 4 files changed, 34 insertions(+), 0 deletions(-) +> create mode 100644 notmuch-insert.c +> +> diff --git a/Makefile.local b/Makefile.local +> index 296995d..950f046 100644 +> --- a/Makefile.local +> +++ b/Makefile.local +> @@ -282,6 +282,7 @@ notmuch_client_srcs =3D \ +> notmuch-config.c \ +> notmuch-count.c \ +> notmuch-dump.c \ +> + notmuch-insert.c \ +> notmuch-new.c \ +> notmuch-reply.c \ +> notmuch-restore.c \ +> diff --git a/notmuch-client.h b/notmuch-client.h +> index f930798..edbd3ee 100644 +> --- a/notmuch-client.h +> +++ b/notmuch-client.h +> @@ -132,6 +132,9 @@ int +> notmuch_dump_command (void *ctx, int argc, char *argv[]); +>=20=20 +> int +> +notmuch_insert_command (void *ctx, int argc, char *argv[]); +> + +> +int +> notmuch_new_command (void *ctx, int argc, char *argv[]); +>=20=20 +> int +> diff --git a/notmuch-insert.c b/notmuch-insert.c +> new file mode 100644 +> index 0000000..0e061a0 +> --- /dev/null +> +++ b/notmuch-insert.c +> @@ -0,0 +1,27 @@ +> +/* notmuch - Not much of an email program, (just index and search) +> + * +> + * Copyright =C2=A9 2012 Peter Wang +> + * +> + * This program is free software: you can redistribute it and/or modify +> + * it under the terms of the GNU General Public License as published by +> + * the Free Software Foundation, either version 3 of the License, or +> + * (at your option) any later version. +> + * +> + * This program is distributed in the hope that it will be useful, +> + * but WITHOUT ANY WARRANTY; without even the implied warranty of +> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +> + * GNU General Public License for more details. +> + * +> + * You should have received a copy of the GNU General Public License +> + * along with this program. If not, see http://www.gnu.org/licenses/ . +> + * +> + * Author: Peter Wang +> + */ +> + +> +#include "notmuch-client.h" +> + +> +int +> +notmuch_insert_command (void *ctx, int argc, char *argv[]) +> +{ +> + return 1; +> +} +> diff --git a/notmuch.c b/notmuch.c +> index 477a09c..86239fd 100644 +> --- a/notmuch.c +> +++ b/notmuch.c +> @@ -53,6 +53,9 @@ static command_t commands[] =3D { +> { "new", notmuch_new_command, +> "[options...]", +> "Find and import new messages to the notmuch database." }, +> + { "insert", notmuch_insert_command, +> + "[options...] [--] [+|- ...] < message", +> + "Add a new message into the maildir and notmuch database." }, +> { "search", notmuch_search_command, +> "[options...] [...]", +> "Search for messages matching the given search terms." }, +> --=20 +> 1.7.4.4 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch