From: Tomi Ollila Date: Fri, 31 Oct 2014 16:46:20 +0000 (+0200) Subject: Re: [PATCH v5 0/7] notmuch search --output=sender/recipients X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=66255479b65dbf4157fcae5bf42cbc124ca7c859;p=notmuch-archives.git Re: [PATCH v5 0/7] notmuch search --output=sender/recipients --- diff --git a/df/adc57dce2a8087950b61691e4ec0d920e8e32a b/df/adc57dce2a8087950b61691e4ec0d920e8e32a new file mode 100644 index 000000000..ea32c96f7 --- /dev/null +++ b/df/adc57dce2a8087950b61691e4ec0d920e8e32a @@ -0,0 +1,234 @@ +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 2089F431FC2 + for ; Fri, 31 Oct 2014 09:46:52 -0700 (PDT) +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 LB7iKhogAWaE for ; + Fri, 31 Oct 2014 09:46:43 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 78FD1431FBC + for ; Fri, 31 Oct 2014 09:46:43 -0700 (PDT) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 2240B100051; + Fri, 31 Oct 2014 18:46:21 +0200 (EET) +From: Tomi Ollila +To: Michal Sojka , + Mark Walters , notmuch@notmuchmail.org +Subject: Re: [PATCH v5 0/7] notmuch search --output=sender/recipients +In-Reply-To: <87vbn06yry.fsf@steelpick.2x.cz> +References: <1414713573-21461-1-git-send-email-sojkam1@fel.cvut.cz> + <878ujwvctt.fsf@qmul.ac.uk> <8761f0v8v7.fsf@qmul.ac.uk> + <87vbn06yry.fsf@steelpick.2x.cz> +User-Agent: Notmuch/0.18.1+130~ga61922f (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable +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, 31 Oct 2014 16:46:52 -0000 + +On Fri, Oct 31 2014, Michal Sojka wrote: + +> On Fri, Oct 31 2014, Mark Walters wrote: +>> My only query is in the text output: should the name part be printed as +>> a quoted string. For example currently I get a line of the form +>> +>> Bloggs, Fred +> +> Good point. + +There has been some discussion on this issue on IRC channel, and the +opinion of most (seen so far) is that output the parts without quoting +(i.e. just like done in this patch series)... + +Taken the other example from Mark's earlyer email: + +Bloggs , Fred + +echo '^^^' | sed 's/.*:s) (= +*) + +echo '^^^' | sed 's/ <[^<]*$//' would leave only the name part + +and regexp '\(.*\) <\(.*\)>' or pcre-compatible /(.*)\s<(.*)>/ +would capture name & address parts... + +(all of the above untested, though;) + +In case instead of 'name ' there is only 'addr', then above +sed lines return the same (full) string and the regexps just don't +match. + +There were some suggestions how the text output could be changed on IRC; +if anyone wishes to bring those forward, please do so :D + +So, IMO, this issue is not showstopper in this series (if anything is); +patches 1-6 looks good to me on paper, but I have not tested those yet. + +Tomi + +(*) echo '^^^' | sed 's/.*.*//' would drop <>'s from first example + + +> +> On Fri, Oct 31 2014, Mark Walters wrote: +>> Hi +>> +>> I attach a patch which does the quoting for real names but I don't know +>> if we want it: it changes (example taken from the test suite) +>> +>> Fran=C3=A7ois Boulogne to +>> +>> =3D?iso-8859-1?q?Fran=3DE7ois?=3D Boulogne +>> +>> (which is what was in the original email) +>> +>> Plausibly the best thing is just to leave the series as is, so the +>> text output is readable and parseable in the common cases. +>> +>> Anyway the patch is attached if anyone wants to experiment. +>> +>> Best wishes +>> +>> Mark +>> +>> From 53b1ced2d6a9fbbba93448325f795e6b99faa240 Mon Sep 17 00:00:00 2001 +>> From: Mark Walters +>> Date: Fri, 31 Oct 2014 10:11:40 +0000 +>> Subject: [PATCH] search: quote real names for output=3Dsender/recipient = +in text +>> format +>> +>> This quotes the real name (when gmime thinks appropriate) for the text +>> output. For the other outputs the real name is separate from the +>> address so the consumer can do any quoting necessary. +>> --- +>> notmuch-search.c | 8 ++++---- +>> test/T090-search-output.sh | 8 ++++---- +>> 2 files changed, 8 insertions(+), 8 deletions(-) +>> +>> diff --git a/notmuch-search.c b/notmuch-search.c +>> index eae749a..8eac161 100644 +>> --- a/notmuch-search.c +>> +++ b/notmuch-search.c +>> @@ -47,6 +47,7 @@ typedef struct { +>> typedef struct { +>> const char *name; +>> const char *addr; +>> + const char *string; +>> } mailbox_t; +>>=20=20 +>> /* Return two stable query strings that identify exactly the matched +>> @@ -255,15 +256,13 @@ print_mailbox (const search_options_t *opt, const = +mailbox_t *mailbox) +>> { +>> const char *name =3D mailbox->name; +>> const char *addr =3D mailbox->addr; +>> + const char *string =3D mailbox->string; +>> sprinter_t *format =3D opt->format; +>>=20=20 +>> if (format->is_text_printer) { +>> char *mailbox_str; +>>=20=20 +>> - if (name && *name) +>> - mailbox_str =3D talloc_asprintf (format, "%s <%s>", name, addr); +>> - else +>> - mailbox_str =3D talloc_strdup (format, addr); +>> + mailbox_str =3D talloc_strdup (format, string); +>>=20=20 +>> if (! mailbox_str) { +>> fprintf (stderr, "Error: out of memory\n"); +>> @@ -309,6 +308,7 @@ process_address_list (const search_options_t *opt, G= +HashTable *addrs, +>> mailbox_t mbx =3D { +>> .name =3D internet_address_get_name (address), +>> .addr =3D internet_address_mailbox_get_addr (mailbox), +>> + .string =3D internet_address_to_string (address, TRUE), +> +> I'd prefer having the second parameter (encode) FALSE. This will still +> add quotes when necessary, but does not encode non-ascii characters so +> the result would be human readable. +> +> Another question is whether to add .string to mailbox_t. In this patch +> it doesn't matter, but if --output=3Dcount patch will be merged, this +> would mean that memory consumption doubles, because with --output=3Dcount +> the addresses are kept in memory and printed only after the search is +> completed. It would be therefore better to construct a new +> InternetAddressMailbox from name and addr in print_mailbox() and perform +> the conversion to string there. Thoughts? +> +> Thanks, +> -Michal +> +>> }; +>>=20=20 +>> if (is_duplicate (opt, addrs, mbx.name, mbx.addr)) +>> diff --git a/test/T090-search-output.sh b/test/T090-search-output.sh +>> index 841a721..776e3f4 100755 +>> --- a/test/T090-search-output.sh +>> +++ b/test/T090-search-output.sh +>> @@ -390,7 +390,7 @@ test_expect_equal_file OUTPUT EXPECTED +>> test_begin_subtest "--output=3Dsender" +>> notmuch search --output=3Dsender '*' >OUTPUT +>> cat <EXPECTED +>> -Fran=C3=A7ois Boulogne +>> +=3D?iso-8859-1?q?Fran=3DE7ois?=3D Boulogne +>> Olivier Berger +>> Chris Wilson +>> Carl Worth +>> @@ -437,7 +437,7 @@ test_begin_subtest "--output=3Drecipients" +>> notmuch search --output=3Drecipients '*' >OUTPUT +>> cat <EXPECTED +>> Allan McRae +>> -Discussion about the Arch User Repository (AUR) +>> +"Discussion about the Arch User Repository (AUR)" +>> olivier.berger@it-sudparis.eu +>> notmuch@notmuchmail.org +>> notmuch +>> @@ -449,9 +449,9 @@ test_expect_equal_file OUTPUT EXPECTED +>> test_begin_subtest "--output=3Dsender --output=3Drecipients" +>> notmuch search --output=3Dsender --output=3Drecipients '*' >OUTPUT +>> cat <EXPECTED +>> -Fran=C3=A7ois Boulogne +>> +=3D?iso-8859-1?q?Fran=3DE7ois?=3D Boulogne +>> Allan McRae +>> -Discussion about the Arch User Repository (AUR) +>> +"Discussion about the Arch User Repository (AUR)" +>> Olivier Berger +>> olivier.berger@it-sudparis.eu +>> Chris Wilson +>> --=20 +>> 1.7.10.4 +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch