unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/2] Ensure that "notmuch reply" succeeds during testing.
@ 2017-07-14 13:09 Daniel Kahn Gillmor
  2017-07-14 13:09 ` [PATCH 2/2] Add additional munged reply-to tests Daniel Kahn Gillmor
  2017-07-14 14:42 ` [PATCH 1/2] Ensure that "notmuch reply" succeeds during testing David Bremner
  0 siblings, 2 replies; 12+ messages in thread
From: Daniel Kahn Gillmor @ 2017-07-14 13:09 UTC (permalink / raw)
  To: Notmuch Mail

In some (bad!) cases, "notmuch reply" might fail, or might even
segfault.  If this happens, it indicates a bug, and the test suite
should notice it.
---
 test/T220-reply.sh | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/test/T220-reply.sh b/test/T220-reply.sh
index 17741e0d..b12109bf 100755
--- a/test/T220-reply.sh
+++ b/test/T220-reply.sh
@@ -9,7 +9,7 @@ add_message '[from]="Sender <sender@example.com>"' \
 	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
 	    '[body]="basic reply test"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
 Subject: Re: notmuch-reply-test
 To: Sender <sender@example.com>
@@ -26,7 +26,7 @@ add_message '[from]="Sender <sender@example.com>"' \
 	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
 	    '[body]="Multiple recipients"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
 Subject: Re: notmuch-reply-test
 To: Sender <sender@example.com>, Someone Else <someone@example.com>
@@ -44,7 +44,7 @@ add_message '[from]="Sender <sender@example.com>"' \
 	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
 	    '[body]="reply with CC"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
 Subject: Re: notmuch-reply-test
 To: Sender <sender@example.com>
@@ -62,7 +62,7 @@ add_message '[from]="Sender <sender@example.com>"' \
 	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
 	    '[body]="reply from alternate address"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
 Subject: Re: notmuch-reply-test
 To: Sender <sender@example.com>
@@ -80,7 +80,7 @@ add_message '[from]="Sender <sender@example.com>"' \
             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
             '[body]="Reply from address in named group list"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
 Subject: Re: notmuch-reply-test
 To: Sender <sender@example.com>, someone@example.com
@@ -98,7 +98,7 @@ add_message '[from]="Sender <sender@example.com>"' \
 	    '[body]="support for reply-to"' \
 	    '[reply-to]="Sender <elsewhere@example.com>"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
 Subject: Re: notmuch-reply-test
 To: Sender <elsewhere@example.com>
@@ -116,7 +116,7 @@ add_message '[from]="Sender <sender@example.com>"' \
 	    '[body]="Un-munging Reply-To"' \
 	    '[reply-to]="Evil Munging List <list@example.com>"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
 Subject: Re: notmuch-reply-test
 To: Sender <sender@example.com>, Some List <list@example.com>
@@ -130,7 +130,7 @@ test_begin_subtest "Message with header of exactly 200 bytes"
 add_message '[subject]="This subject is exactly 200 bytes in length. Other than its length there is not much of note here. Note that the length of 200 bytes includes the Subject: and Re: prefixes with two spaces"' \
 	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
 	    '[body]="200-byte header"'
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
 Subject: Re: This subject is exactly 200 bytes in length. Other than its
  length there is not much of note here. Note that the length of 200 bytes
@@ -149,7 +149,7 @@ add_message '[from]="Sender <sender@example.com>"' \
 	    '[body]="From guessing"' \
 	    '[header]="Envelope-To: test_suite_other@notmuchmail.org"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
 Subject: Re: From guessing
 To: Sender <sender@example.com>, Recipient <recipient@example.com>
@@ -167,7 +167,7 @@ add_message '[from]="Sender <sender@example.com>"' \
 	    '[body]="From guessing"' \
 	    '[header]="X-Original-To: test_suite@otherdomain.org"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@otherdomain.org>
 Subject: Re: From guessing
 To: Sender <sender@example.com>, Recipient <recipient@example.com>
@@ -185,7 +185,7 @@ add_message '[from]="Sender <sender@example.com>"' \
 	    '[body]="From guessing"' \
 	    '[header]="Delivered-To: test_suite_other@notmuchmail.org"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
 Subject: Re: From guessing
 To: Sender <sender@example.com>, Recipient <recipient@example.com>
@@ -204,7 +204,7 @@ add_message '[subject]="=?iso-8859-1?q?=e0=df=e7?="' \
 # GMime happens to change from Q- to B-encoding.  We canonicalize the
 # case of the encoding and charset because different versions of GMime
 # capitalize the encoding differently.
-output=$(notmuch reply id:${gen_msg_id} | perl -pe 's/=\?[^?]+\?[bB]\?/lc($&)/ge')
+output=$( (notmuch reply id:${gen_msg_id} || echo failed) | perl -pe 's/=\?[^?]+\?[bB]\?/lc($&)/ge')
 test_expect_equal "$output" "\
 From: Notmuch Test Suite <test_suite@notmuchmail.org>
 Subject: Re: =?iso-8859-1?b?4N/n?=
@@ -216,7 +216,7 @@ On Tue, 05 Jan 2010 15:43:56 -0000, ☃ <snowman@example.com> wrote:
 > Encoding"
 
 test_begin_subtest "Reply with RFC 2047-encoded headers (JSON)"
-output=$(notmuch reply --format=json id:${gen_msg_id})
+output=$(notmuch reply --format=json id:${gen_msg_id} || echo failed)
 test_expect_equal_json "$output" '
 {
     "original": {
@@ -255,7 +255,7 @@ test_expect_equal_json "$output" '
 
 test_begin_subtest "Reply to a message with multiple Cc headers"
 add_email_corpus broken
-output=$(notmuch reply id:multiple-cc@example.org)
+output=$(notmuch reply id:multiple-cc@example.org || echo failed)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
 Subject: Re: wowsers!
 To: Alice <alice@example.org>, Daniel <daniel@example.org>
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/2] Add additional munged reply-to tests
  2017-07-14 13:09 [PATCH 1/2] Ensure that "notmuch reply" succeeds during testing Daniel Kahn Gillmor
@ 2017-07-14 13:09 ` Daniel Kahn Gillmor
  2017-07-14 13:26   ` Daniel Kahn Gillmor
  2017-07-14 14:42 ` [PATCH 1/2] Ensure that "notmuch reply" succeeds during testing David Bremner
  1 sibling, 1 reply; 12+ messages in thread
From: Daniel Kahn Gillmor @ 2017-07-14 13:09 UTC (permalink / raw)
  To: Notmuch Mail

The reply-to munging code might behave differently whether there's an
exact match on the strings or not, or whether the string is a raw
addr-spec instead of an name-addr.  These tests cover those variations
(i also had to tweak json output further below when this new test was
added).
---
 test/T220-reply.sh | 38 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/test/T220-reply.sh b/test/T220-reply.sh
index b12109bf..7da16583 100755
--- a/test/T220-reply.sh
+++ b/test/T220-reply.sh
@@ -126,6 +126,42 @@ References: <${gen_msg_id}>
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
 > Un-munging Reply-To"
 
+test_begin_subtest "Un-munging Reply-To With Exact Match"
+add_message '[from]="Sender <sender@example.com>"' \
+	    '[to]="Some List <list@example.com>"' \
+	     [subject]=notmuch-reply-test \
+	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+	    '[body]="Un-munging Reply-To"' \
+	    '[reply-to]="Some List <list@example.com>"'
+
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>, Some List <list@example.com>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
+> Un-munging Reply-To"
+
+test_begin_subtest "Un-munging Reply-To With Raw addr-spec"
+add_message '[from]="Sender <sender@example.com>"' \
+	    '[to]="Some List <list@example.com>"' \
+	     [subject]=notmuch-reply-test \
+	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+	    '[body]="Un-munging Reply-To"' \
+	    '[reply-to]="list@example.com"'
+
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>, Some List <list@example.com>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
+> Un-munging Reply-To"
+
 test_begin_subtest "Message with header of exactly 200 bytes"
 add_message '[subject]="This subject is exactly 200 bytes in length. Other than its length there is not much of note here. Note that the length of 200 bytes includes the Subject: and Re: prefixes with two spaces"' \
 	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
@@ -229,7 +265,7 @@ test_expect_equal_json "$output" '
         ],
         "date_relative": "2010-01-05",
         "excluded": false,
-        "filename": ["'${MAIL_DIR}'/msg-012"],
+        "filename": ["'${MAIL_DIR}'/msg-014"],
         "headers": {
             "Date": "Tue, 05 Jan 2010 15:43:56 +0000",
             "From": "\u2603 <snowman@example.com>",
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] Add additional munged reply-to tests
  2017-07-14 13:09 ` [PATCH 2/2] Add additional munged reply-to tests Daniel Kahn Gillmor
@ 2017-07-14 13:26   ` Daniel Kahn Gillmor
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel Kahn Gillmor @ 2017-07-14 13:26 UTC (permalink / raw)
  To: Notmuch Mail

[-- Attachment #1: Type: text/plain, Size: 1915 bytes --]

On Fri 2017-07-14 15:09:12 +0200, Daniel Kahn Gillmor wrote:
> The reply-to munging code might behave differently whether there's an
> exact match on the strings or not, or whether the string is a raw
> addr-spec instead of an name-addr.  These tests cover those
> variations.

This pair of patches should be safe and clean to apply.  When they're
applied, though, the gmime 3.0 series no longer passes the test suite
due to these failures:

----------
T220-reply: Testing "notmuch reply" in several variations
 PASS   Basic reply
 PASS   Multiple recipients
 PASS   Reply with CC
 PASS   Reply from alternate address
 PASS   Reply from address in named group list
 PASS   Support for Reply-To
 FAIL   Un-munging Reply-To
	--- T220-reply.7.expected	2017-07-14 13:24:32.203184911 +0000
	+++ T220-reply.7.output	2017-07-14 13:24:32.203184911 +0000
	@@ -6,3 +6,4 @@
	 
	 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
	 > Un-munging Reply-To
	+failed
 FAIL   Un-munging Reply-To With Exact Match
	--- T220-reply.8.expected	2017-07-14 13:24:32.243185095 +0000
	+++ T220-reply.8.output	2017-07-14 13:24:32.243185095 +0000
	@@ -6,3 +6,4 @@
	 
	 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
	 > Un-munging Reply-To
	+failed
 PASS   Un-munging Reply-To With Raw addr-spec
 PASS   Message with header of exactly 200 bytes
 PASS   From guessing: Envelope-To
 PASS   From guessing: X-Original-To
 PASS   From guessing: Delivered-To
 PASS   Reply with RFC 2047-encoded headers
 PASS   Reply with RFC 2047-encoded headers (JSON)
 PASS   Reply to a message with multiple Cc headers
----------

I think this is due to "notmuch reply" crashing on those first two tests
with a segmentation fault.

i think this implicates the reply-to munging code, which i don't
understand, but would welcome help on debugging.

            --dkg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] Ensure that "notmuch reply" succeeds during testing.
  2017-07-14 13:09 [PATCH 1/2] Ensure that "notmuch reply" succeeds during testing Daniel Kahn Gillmor
  2017-07-14 13:09 ` [PATCH 2/2] Add additional munged reply-to tests Daniel Kahn Gillmor
@ 2017-07-14 14:42 ` David Bremner
  2017-07-14 17:08   ` Daniel Kahn Gillmor
  1 sibling, 1 reply; 12+ messages in thread
From: David Bremner @ 2017-07-14 14:42 UTC (permalink / raw)
  To: Daniel Kahn Gillmor, Notmuch Mail

Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:

> In some (bad!) cases, "notmuch reply" might fail, or might even
> segfault.  If this happens, it indicates a bug, and the test suite
> should notice it.
> ---
>  test/T220-reply.sh | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/test/T220-reply.sh b/test/T220-reply.sh
> index 17741e0d..b12109bf 100755
> --- a/test/T220-reply.sh
> +++ b/test/T220-reply.sh
> @@ -9,7 +9,7 @@ add_message '[from]="Sender <sender@example.com>"' \
>  	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
>  	    '[body]="basic reply test"'
>  
> -output=$(notmuch reply id:${gen_msg_id})
> +output=$(notmuch reply id:${gen_msg_id} || echo failed)

I wonder if we're going to touch this code if we should DTRT™ and switch
to redirecting stdin and stderr to a file. Then when we have failures we
will at least have a little bit more information, especially in user bug
reports.

d

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] Ensure that "notmuch reply" succeeds during testing.
  2017-07-14 14:42 ` [PATCH 1/2] Ensure that "notmuch reply" succeeds during testing David Bremner
@ 2017-07-14 17:08   ` Daniel Kahn Gillmor
  2017-07-14 18:04     ` David Bremner
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Kahn Gillmor @ 2017-07-14 17:08 UTC (permalink / raw)
  To: David Bremner, Notmuch Mail

[-- Attachment #1: Type: text/plain, Size: 816 bytes --]

On Fri 2017-07-14 11:42:43 -0300, David Bremner wrote:
> Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:
>> -output=$(notmuch reply id:${gen_msg_id})
>> +output=$(notmuch reply id:${gen_msg_id} || echo failed)
>
> I wonder if we're going to touch this code if we should DTRT™ and switch
> to redirecting stdin and stderr to a file. Then when we have failures we
> will at least have a little bit more information, especially in user bug
> reports.

redirecting stdin as well?  i'm not sure what you'd do with stdin.
makes sense for for stderr, though i don't know the test suite well
enough to instrument it The Right Way™.  I'm happy to be pointed to an
example, though.

I like this idea generally, but i hope it won't block a specific
improvement, which i think this is.

        --dkg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] Ensure that "notmuch reply" succeeds during testing.
  2017-07-14 17:08   ` Daniel Kahn Gillmor
@ 2017-07-14 18:04     ` David Bremner
  2017-07-14 20:14       ` [PATCH v2 " Daniel Kahn Gillmor
  0 siblings, 1 reply; 12+ messages in thread
From: David Bremner @ 2017-07-14 18:04 UTC (permalink / raw)
  To: Daniel Kahn Gillmor, Notmuch Mail

Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:

> On Fri 2017-07-14 11:42:43 -0300, David Bremner wrote:
>> Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:
>>> -output=$(notmuch reply id:${gen_msg_id})
>>> +output=$(notmuch reply id:${gen_msg_id} || echo failed)
>>
>> I wonder if we're going to touch this code if we should DTRT™ and switch
>> to redirecting stdin and stderr to a file. Then when we have failures we
>> will at least have a little bit more information, especially in user bug
>> reports.
>
> redirecting stdin as well?  i'm not sure what you'd do with stdin.
> makes sense for for stderr, though i don't know the test suite well
> enough to instrument it The Right Way™.  I'm happy to be pointed to an
> example, though.

err. stdout.

I guess I was thinking something like the test "List all items" in
T030-config.sh.

Alternatively, it's simpler to add 2>&1 (see e.g. T050-new.sh) inside
the $().

Maybe something like (untested)

output=$(notmuch reply  id:${gen_msg_id} 2>&1 && echo OK)

to have postive confirmation of the exit value, as well as any stderr
output.

d

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 1/2] Ensure that "notmuch reply" succeeds during testing.
  2017-07-14 18:04     ` David Bremner
@ 2017-07-14 20:14       ` Daniel Kahn Gillmor
  2017-07-14 20:14         ` [PATCH v2 2/2] Add additional munged reply-to tests Daniel Kahn Gillmor
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Kahn Gillmor @ 2017-07-14 20:14 UTC (permalink / raw)
  To: Notmuch Mail

In some (bad!) cases, "notmuch reply" might fail, or might even
segfault.  If this happens, it indicates a bug, and the test suite
should notice it.
---
 test/T220-reply.sh | 71 +++++++++++++++++++++++++++++++++---------------------
 1 file changed, 43 insertions(+), 28 deletions(-)

diff --git a/test/T220-reply.sh b/test/T220-reply.sh
index 17741e0d..c29a900f 100755
--- a/test/T220-reply.sh
+++ b/test/T220-reply.sh
@@ -9,7 +9,7 @@ add_message '[from]="Sender <sender@example.com>"' \
 	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
 	    '[body]="basic reply test"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} 2>&1 && echo OK)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
 Subject: Re: notmuch-reply-test
 To: Sender <sender@example.com>
@@ -17,7 +17,8 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
-> basic reply test"
+> basic reply test
+OK"
 
 test_begin_subtest "Multiple recipients"
 add_message '[from]="Sender <sender@example.com>"' \
@@ -26,7 +27,7 @@ add_message '[from]="Sender <sender@example.com>"' \
 	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
 	    '[body]="Multiple recipients"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} 2>&1 && echo OK)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
 Subject: Re: notmuch-reply-test
 To: Sender <sender@example.com>, Someone Else <someone@example.com>
@@ -34,7 +35,8 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
-> Multiple recipients"
+> Multiple recipients
+OK"
 
 test_begin_subtest "Reply with CC"
 add_message '[from]="Sender <sender@example.com>"' \
@@ -44,7 +46,7 @@ add_message '[from]="Sender <sender@example.com>"' \
 	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
 	    '[body]="reply with CC"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} 2>&1 && echo OK)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
 Subject: Re: notmuch-reply-test
 To: Sender <sender@example.com>
@@ -53,7 +55,8 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
-> reply with CC"
+> reply with CC
+OK"
 
 test_begin_subtest "Reply from alternate address"
 add_message '[from]="Sender <sender@example.com>"' \
@@ -62,7 +65,7 @@ add_message '[from]="Sender <sender@example.com>"' \
 	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
 	    '[body]="reply from alternate address"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} 2>&1 && echo OK)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
 Subject: Re: notmuch-reply-test
 To: Sender <sender@example.com>
@@ -70,7 +73,8 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
-> reply from alternate address"
+> reply from alternate address
+OK"
 
 test_begin_subtest "Reply from address in named group list"
 add_message '[from]="Sender <sender@example.com>"' \
@@ -80,7 +84,7 @@ add_message '[from]="Sender <sender@example.com>"' \
             '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
             '[body]="Reply from address in named group list"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} 2>&1 && echo OK)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
 Subject: Re: notmuch-reply-test
 To: Sender <sender@example.com>, someone@example.com
@@ -88,7 +92,8 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
-> Reply from address in named group list"
+> Reply from address in named group list
+OK"
 
 test_begin_subtest "Support for Reply-To"
 add_message '[from]="Sender <sender@example.com>"' \
@@ -98,7 +103,7 @@ add_message '[from]="Sender <sender@example.com>"' \
 	    '[body]="support for reply-to"' \
 	    '[reply-to]="Sender <elsewhere@example.com>"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} 2>&1 && echo OK)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
 Subject: Re: notmuch-reply-test
 To: Sender <elsewhere@example.com>
@@ -106,7 +111,8 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
-> support for reply-to"
+> support for reply-to
+OK"
 
 test_begin_subtest "Un-munging Reply-To"
 add_message '[from]="Sender <sender@example.com>"' \
@@ -116,7 +122,7 @@ add_message '[from]="Sender <sender@example.com>"' \
 	    '[body]="Un-munging Reply-To"' \
 	    '[reply-to]="Evil Munging List <list@example.com>"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} 2>&1 && echo OK)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
 Subject: Re: notmuch-reply-test
 To: Sender <sender@example.com>, Some List <list@example.com>
@@ -124,13 +130,14 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
-> Un-munging Reply-To"
+> Un-munging Reply-To
+OK"
 
 test_begin_subtest "Message with header of exactly 200 bytes"
 add_message '[subject]="This subject is exactly 200 bytes in length. Other than its length there is not much of note here. Note that the length of 200 bytes includes the Subject: and Re: prefixes with two spaces"' \
 	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
 	    '[body]="200-byte header"'
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} 2>&1 && echo OK)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
 Subject: Re: This subject is exactly 200 bytes in length. Other than its
  length there is not much of note here. Note that the length of 200 bytes
@@ -139,7 +146,8 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
-> 200-byte header"
+> 200-byte header
+OK"
 
 test_begin_subtest "From guessing: Envelope-To"
 add_message '[from]="Sender <sender@example.com>"' \
@@ -149,7 +157,7 @@ add_message '[from]="Sender <sender@example.com>"' \
 	    '[body]="From guessing"' \
 	    '[header]="Envelope-To: test_suite_other@notmuchmail.org"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} 2>&1 && echo OK)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
 Subject: Re: From guessing
 To: Sender <sender@example.com>, Recipient <recipient@example.com>
@@ -157,7 +165,8 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
-> From guessing"
+> From guessing
+OK"
 
 test_begin_subtest "From guessing: X-Original-To"
 add_message '[from]="Sender <sender@example.com>"' \
@@ -167,7 +176,7 @@ add_message '[from]="Sender <sender@example.com>"' \
 	    '[body]="From guessing"' \
 	    '[header]="X-Original-To: test_suite@otherdomain.org"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} 2>&1 && echo OK)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@otherdomain.org>
 Subject: Re: From guessing
 To: Sender <sender@example.com>, Recipient <recipient@example.com>
@@ -175,7 +184,8 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
-> From guessing"
+> From guessing
+OK"
 
 test_begin_subtest "From guessing: Delivered-To"
 add_message '[from]="Sender <sender@example.com>"' \
@@ -185,7 +195,7 @@ add_message '[from]="Sender <sender@example.com>"' \
 	    '[body]="From guessing"' \
 	    '[header]="Delivered-To: test_suite_other@notmuchmail.org"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} 2>&1 && echo OK)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
 Subject: Re: From guessing
 To: Sender <sender@example.com>, Recipient <recipient@example.com>
@@ -193,7 +203,8 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
-> From guessing"
+> From guessing
+OK"
 
 test_begin_subtest "Reply with RFC 2047-encoded headers"
 add_message '[subject]="=?iso-8859-1?q?=e0=df=e7?="' \
@@ -204,7 +215,7 @@ add_message '[subject]="=?iso-8859-1?q?=e0=df=e7?="' \
 # GMime happens to change from Q- to B-encoding.  We canonicalize the
 # case of the encoding and charset because different versions of GMime
 # capitalize the encoding differently.
-output=$(notmuch reply id:${gen_msg_id} | perl -pe 's/=\?[^?]+\?[bB]\?/lc($&)/ge')
+output=$( (notmuch reply id:${gen_msg_id} 2>&1 && echo OK) | perl -pe 's/=\?[^?]+\?[bB]\?/lc($&)/ge')
 test_expect_equal "$output" "\
 From: Notmuch Test Suite <test_suite@notmuchmail.org>
 Subject: Re: =?iso-8859-1?b?4N/n?=
@@ -213,12 +224,13 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, ☃ <snowman@example.com> wrote:
-> Encoding"
+> Encoding
+OK"
 
 test_begin_subtest "Reply with RFC 2047-encoded headers (JSON)"
-output=$(notmuch reply --format=json id:${gen_msg_id})
+output=$(echo '{"answer":' && notmuch reply --format=json id:${gen_msg_id} 2>&1 && echo ', "success": "OK"}')
 test_expect_equal_json "$output" '
-{
+{  "answer": {
     "original": {
         "body": [
             {
@@ -251,11 +263,13 @@ test_expect_equal_json "$output" '
         "Subject": "Re: \u00e0\u00df\u00e7",
         "To": "\u2603 <snowman@example.com>"
     }
+  },
+  "success": "OK"
 }'
 
 test_begin_subtest "Reply to a message with multiple Cc headers"
 add_email_corpus broken
-output=$(notmuch reply id:multiple-cc@example.org)
+output=$(notmuch reply id:multiple-cc@example.org 2>&1 && echo OK)
 test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
 Subject: Re: wowsers!
 To: Alice <alice@example.org>, Daniel <daniel@example.org>
@@ -264,6 +278,7 @@ In-Reply-To: <multiple-cc@example.org>
 References: <multiple-cc@example.org>
 
 On Thu, 16 Jun 2016 22:14:41 -0400, Alice <alice@example.org> wrote:
-> Note the Cc: and cc: headers."
+> Note the Cc: and cc: headers.
+OK"
 
 test_done
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 2/2] Add additional munged reply-to tests
  2017-07-14 20:14       ` [PATCH v2 " Daniel Kahn Gillmor
@ 2017-07-14 20:14         ` Daniel Kahn Gillmor
  2017-07-14 22:03           ` [PATCH] Avoid crashes in "notmuch reply" with gmime 3.0 when reply-to == sender Daniel Kahn Gillmor
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Kahn Gillmor @ 2017-07-14 20:14 UTC (permalink / raw)
  To: Notmuch Mail

The reply-to munging code might behave differently whether there's an
exact match on the strings or not, or whether the string is a raw
addr-spec instead of an name-addr.  These tests cover those variations
(i also had to tweak json output further below when this new test was
added).
---
 test/T220-reply.sh | 40 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/test/T220-reply.sh b/test/T220-reply.sh
index c29a900f..4fb67ffb 100755
--- a/test/T220-reply.sh
+++ b/test/T220-reply.sh
@@ -133,6 +133,44 @@ On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
 > Un-munging Reply-To
 OK"
 
+test_begin_subtest "Un-munging Reply-To With Exact Match"
+add_message '[from]="Sender <sender@example.com>"' \
+	    '[to]="Some List <list@example.com>"' \
+	     [subject]=notmuch-reply-test \
+	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+	    '[body]="Un-munging Reply-To"' \
+	    '[reply-to]="Some List <list@example.com>"'
+
+output=$(notmuch reply id:${gen_msg_id} 2>&1 && echo OK)
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>, Some List <list@example.com>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
+> Un-munging Reply-To
+OK"
+
+test_begin_subtest "Un-munging Reply-To With Raw addr-spec"
+add_message '[from]="Sender <sender@example.com>"' \
+	    '[to]="Some List <list@example.com>"' \
+	     [subject]=notmuch-reply-test \
+	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+	    '[body]="Un-munging Reply-To"' \
+	    '[reply-to]="list@example.com"'
+
+output=$(notmuch reply id:${gen_msg_id} 2>&1 && echo OK)
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>, Some List <list@example.com>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
+> Un-munging Reply-To
+OK"
+
 test_begin_subtest "Message with header of exactly 200 bytes"
 add_message '[subject]="This subject is exactly 200 bytes in length. Other than its length there is not much of note here. Note that the length of 200 bytes includes the Subject: and Re: prefixes with two spaces"' \
 	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
@@ -241,7 +279,7 @@ test_expect_equal_json "$output" '
         ],
         "date_relative": "2010-01-05",
         "excluded": false,
-        "filename": ["'${MAIL_DIR}'/msg-012"],
+        "filename": ["'${MAIL_DIR}'/msg-014"],
         "headers": {
             "Date": "Tue, 05 Jan 2010 15:43:56 +0000",
             "From": "\u2603 <snowman@example.com>",
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] Avoid crashes in "notmuch reply" with gmime 3.0 when reply-to == sender
  2017-07-14 20:14         ` [PATCH v2 2/2] Add additional munged reply-to tests Daniel Kahn Gillmor
@ 2017-07-14 22:03           ` Daniel Kahn Gillmor
  2017-07-14 22:13             ` Daniel Kahn Gillmor
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Kahn Gillmor @ 2017-07-14 22:03 UTC (permalink / raw)
  To: Notmuch Mail

Bremner found this fix.  I'm just documenting it for posterity :)
---
 notmuch-reply.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/notmuch-reply.c b/notmuch-reply.c
index bb6b99fa..4f3f3859 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -286,7 +286,7 @@ static InternetAddressList *get_sender(GMimeMessage *message)
 	if (! reply_to_header_is_redundant (message, reply_to_list))
 	    return reply_to_list;
 
-	g_object_unref (G_OBJECT (reply_to_list));
+	g_mime_2_6_unref (G_OBJECT (reply_to_list));
     }
 
     return g_mime_message_get_from (message);
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] Avoid crashes in "notmuch reply" with gmime 3.0 when reply-to == sender
  2017-07-14 22:03           ` [PATCH] Avoid crashes in "notmuch reply" with gmime 3.0 when reply-to == sender Daniel Kahn Gillmor
@ 2017-07-14 22:13             ` Daniel Kahn Gillmor
  2017-07-14 22:53               ` Daniel Kahn Gillmor
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Kahn Gillmor @ 2017-07-14 22:13 UTC (permalink / raw)
  To: Notmuch Mail

[-- Attachment #1: Type: text/plain, Size: 708 bytes --]

On Sat 2017-07-15 00:03:35 +0200, Daniel Kahn Gillmor wrote:
> Bremner found this fix.  I'm just documenting it for posterity :)

With this patch, and the preceding two patches, and my additional
comments in the other gmime 3.0 thread, i think notmuch is ready for
being able to build against gmime 3.0.

I can push a full modified series to the list if folks would prefer to
see it separately.

I'm currently publishing it currently on the gmime 3.0 branch (commit id
aeeded4307162bdc1c745d15cd3ccf5a2140bdf9) at
https://gitlab.com/dkg/notmuch if anyone wants to consider it (i'm
likely to rebase all non-master branches on that repo, though, so please
don't necessarily rely on their stability)

    --dkg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Avoid crashes in "notmuch reply" with gmime 3.0 when reply-to == sender
  2017-07-14 22:13             ` Daniel Kahn Gillmor
@ 2017-07-14 22:53               ` Daniel Kahn Gillmor
  2017-07-15 11:47                 ` David Bremner
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Kahn Gillmor @ 2017-07-14 22:53 UTC (permalink / raw)
  To: Notmuch Mail

[-- Attachment #1: Type: text/plain, Size: 712 bytes --]

On Sat 2017-07-15 00:13:39 +0200, Daniel Kahn Gillmor wrote:
> I'm currently publishing it currently on the gmime 3.0 branch (commit id
> aeeded4307162bdc1c745d15cd3ccf5a2140bdf9) at
> https://gitlab.com/dkg/notmuch if anyone wants to consider it (i'm
> likely to rebase all non-master branches on that repo, though, so please
> don't necessarily rely on their stability)

Sorry: that's the "gmime3.0" branch, and the current commit ID (after a
bit more cleanup) is:  37c4f458b18f29a7ead679912b0982c266030b7c

That's currently a 19-patch series (many of which came from bremner's
gmime 3.0 porting series, with some intervening patches), which i'm
happy to re-post here if it'll help people review.

      --dkg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Avoid crashes in "notmuch reply" with gmime 3.0 when reply-to == sender
  2017-07-14 22:53               ` Daniel Kahn Gillmor
@ 2017-07-15 11:47                 ` David Bremner
  0 siblings, 0 replies; 12+ messages in thread
From: David Bremner @ 2017-07-15 11:47 UTC (permalink / raw)
  To: Daniel Kahn Gillmor, Notmuch Mail

Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:

> On Sat 2017-07-15 00:13:39 +0200, Daniel Kahn Gillmor wrote:
>> I'm currently publishing it currently on the gmime 3.0 branch (commit id
>> aeeded4307162bdc1c745d15cd3ccf5a2140bdf9) at
>> https://gitlab.com/dkg/notmuch if anyone wants to consider it (i'm
>> likely to rebase all non-master branches on that repo, though, so please
>> don't necessarily rely on their stability)
>
> Sorry: that's the "gmime3.0" branch, and the current commit ID (after a
> bit more cleanup) is:  37c4f458b18f29a7ead679912b0982c266030b7c
>
> That's currently a 19-patch series (many of which came from bremner's
> gmime 3.0 porting series, with some intervening patches), which i'm
> happy to re-post here if it'll help people review.
>

I've pushed my own reconstruction of this, which

     - drops one patch of my own series --

        id:20170603174754.16911-11-david@tethera.net

        as discussed before, it's not clear that this will ever be fixed
        in GMime, or that it's a real problem for users.

     - leaves off for now the last patch in your crypto related series

       id:20170714131202.24966-3-dkg@fifthhorseman.net

       I'll comment in that thread about that patch.


       

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-07-15 11:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-14 13:09 [PATCH 1/2] Ensure that "notmuch reply" succeeds during testing Daniel Kahn Gillmor
2017-07-14 13:09 ` [PATCH 2/2] Add additional munged reply-to tests Daniel Kahn Gillmor
2017-07-14 13:26   ` Daniel Kahn Gillmor
2017-07-14 14:42 ` [PATCH 1/2] Ensure that "notmuch reply" succeeds during testing David Bremner
2017-07-14 17:08   ` Daniel Kahn Gillmor
2017-07-14 18:04     ` David Bremner
2017-07-14 20:14       ` [PATCH v2 " Daniel Kahn Gillmor
2017-07-14 20:14         ` [PATCH v2 2/2] Add additional munged reply-to tests Daniel Kahn Gillmor
2017-07-14 22:03           ` [PATCH] Avoid crashes in "notmuch reply" with gmime 3.0 when reply-to == sender Daniel Kahn Gillmor
2017-07-14 22:13             ` Daniel Kahn Gillmor
2017-07-14 22:53               ` Daniel Kahn Gillmor
2017-07-15 11:47                 ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).