[PATCH 1/2] Ensure that "notmuch reply" succeeds during testing.

classic Classic list List threaded Threaded
12 messages Options
Daniel Kahn Gillmor Daniel Kahn Gillmor
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH 1/2] Ensure that "notmuch reply" succeeds during testing.

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 <[hidden email]>"' \
     '[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 <[hidden email]>
 Subject: Re: notmuch-reply-test
 To: Sender <[hidden email]>
@@ -26,7 +26,7 @@ add_message '[from]="Sender <[hidden email]>"' \
     '[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 <[hidden email]>
 Subject: Re: notmuch-reply-test
 To: Sender <[hidden email]>, Someone Else <[hidden email]>
@@ -44,7 +44,7 @@ add_message '[from]="Sender <[hidden email]>"' \
     '[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 <[hidden email]>
 Subject: Re: notmuch-reply-test
 To: Sender <[hidden email]>
@@ -62,7 +62,7 @@ add_message '[from]="Sender <[hidden email]>"' \
     '[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 <[hidden email]>
 Subject: Re: notmuch-reply-test
 To: Sender <[hidden email]>
@@ -80,7 +80,7 @@ add_message '[from]="Sender <[hidden email]>"' \
             '[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 <[hidden email]>
 Subject: Re: notmuch-reply-test
 To: Sender <[hidden email]>, [hidden email]
@@ -98,7 +98,7 @@ add_message '[from]="Sender <[hidden email]>"' \
     '[body]="support for reply-to"' \
     '[reply-to]="Sender <[hidden email]>"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
 test_expect_equal "$output" "From: Notmuch Test Suite <[hidden email]>
 Subject: Re: notmuch-reply-test
 To: Sender <[hidden email]>
@@ -116,7 +116,7 @@ add_message '[from]="Sender <[hidden email]>"' \
     '[body]="Un-munging Reply-To"' \
     '[reply-to]="Evil Munging List <[hidden email]>"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
 test_expect_equal "$output" "From: Notmuch Test Suite <[hidden email]>
 Subject: Re: notmuch-reply-test
 To: Sender <[hidden email]>, Some List <[hidden email]>
@@ -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 <[hidden email]>
 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 <[hidden email]>"' \
     '[body]="From guessing"' \
     '[header]="Envelope-To: [hidden email]"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
 test_expect_equal "$output" "From: Notmuch Test Suite <[hidden email]>
 Subject: Re: From guessing
 To: Sender <[hidden email]>, Recipient <[hidden email]>
@@ -167,7 +167,7 @@ add_message '[from]="Sender <[hidden email]>"' \
     '[body]="From guessing"' \
     '[header]="X-Original-To: [hidden email]"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
 test_expect_equal "$output" "From: Notmuch Test Suite <[hidden email]>
 Subject: Re: From guessing
 To: Sender <[hidden email]>, Recipient <[hidden email]>
@@ -185,7 +185,7 @@ add_message '[from]="Sender <[hidden email]>"' \
     '[body]="From guessing"' \
     '[header]="Delivered-To: [hidden email]"'
 
-output=$(notmuch reply id:${gen_msg_id})
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
 test_expect_equal "$output" "From: Notmuch Test Suite <[hidden email]>
 Subject: Re: From guessing
 To: Sender <[hidden email]>, Recipient <[hidden email]>
@@ -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 <[hidden email]>
 Subject: Re: =?iso-8859-1?b?4N/n?=
@@ -216,7 +216,7 @@ On Tue, 05 Jan 2010 15:43:56 -0000, ☃ <[hidden email]> 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:[hidden email])
+output=$(notmuch reply id:[hidden email] || echo failed)
 test_expect_equal "$output" "From: Notmuch Test Suite <[hidden email]>
 Subject: Re: wowsers!
 To: Alice <[hidden email]>, Daniel <[hidden email]>
--
2.13.2

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Daniel Kahn Gillmor Daniel Kahn Gillmor
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH 2/2] Add additional munged reply-to tests

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 <[hidden email]> wrote:
 > Un-munging Reply-To"
 
+test_begin_subtest "Un-munging Reply-To With Exact Match"
+add_message '[from]="Sender <[hidden email]>"' \
+    '[to]="Some List <[hidden email]>"' \
+     [subject]=notmuch-reply-test \
+    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+    '[body]="Un-munging Reply-To"' \
+    '[reply-to]="Some List <[hidden email]>"'
+
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
+test_expect_equal "$output" "From: Notmuch Test Suite <[hidden email]>
+Subject: Re: notmuch-reply-test
+To: Sender <[hidden email]>, Some List <[hidden email]>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Sender <[hidden email]> wrote:
+> Un-munging Reply-To"
+
+test_begin_subtest "Un-munging Reply-To With Raw addr-spec"
+add_message '[from]="Sender <[hidden email]>"' \
+    '[to]="Some List <[hidden email]>"' \
+     [subject]=notmuch-reply-test \
+    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+    '[body]="Un-munging Reply-To"' \
+    '[reply-to]="[hidden email]"'
+
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
+test_expect_equal "$output" "From: Notmuch Test Suite <[hidden email]>
+Subject: Re: notmuch-reply-test
+To: Sender <[hidden email]>, Some List <[hidden email]>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Sender <[hidden email]> 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 <[hidden email]>",
--
2.13.2

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Daniel Kahn Gillmor Daniel Kahn Gillmor
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH 2/2] Add additional munged reply-to tests

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 <[hidden email]> 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 <[hidden email]> 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

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (847 bytes) Download Attachment
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH 1/2] Ensure that "notmuch reply" succeeds during testing.

In reply to this post by Daniel Kahn Gillmor
Daniel Kahn Gillmor <[hidden email]> 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 <[hidden email]>"' \
>      '[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



_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Daniel Kahn Gillmor Daniel Kahn Gillmor
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH 1/2] Ensure that "notmuch reply" succeeds during testing.

On Fri 2017-07-14 11:42:43 -0300, David Bremner wrote:
> Daniel Kahn Gillmor <[hidden email]> 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

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (847 bytes) Download Attachment
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH 1/2] Ensure that "notmuch reply" succeeds during testing.

Daniel Kahn Gillmor <[hidden email]> writes:

> On Fri 2017-07-14 11:42:43 -0300, David Bremner wrote:
>> Daniel Kahn Gillmor <[hidden email]> 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
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Daniel Kahn Gillmor Daniel Kahn Gillmor
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v2 1/2] Ensure that "notmuch reply" succeeds during testing.

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 <[hidden email]>"' \
     '[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 <[hidden email]>
 Subject: Re: notmuch-reply-test
 To: Sender <[hidden email]>
@@ -17,7 +17,8 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <[hidden email]> wrote:
-> basic reply test"
+> basic reply test
+OK"
 
 test_begin_subtest "Multiple recipients"
 add_message '[from]="Sender <[hidden email]>"' \
@@ -26,7 +27,7 @@ add_message '[from]="Sender <[hidden email]>"' \
     '[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 <[hidden email]>
 Subject: Re: notmuch-reply-test
 To: Sender <[hidden email]>, Someone Else <[hidden email]>
@@ -34,7 +35,8 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <[hidden email]> wrote:
-> Multiple recipients"
+> Multiple recipients
+OK"
 
 test_begin_subtest "Reply with CC"
 add_message '[from]="Sender <[hidden email]>"' \
@@ -44,7 +46,7 @@ add_message '[from]="Sender <[hidden email]>"' \
     '[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 <[hidden email]>
 Subject: Re: notmuch-reply-test
 To: Sender <[hidden email]>
@@ -53,7 +55,8 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <[hidden email]> wrote:
-> reply with CC"
+> reply with CC
+OK"
 
 test_begin_subtest "Reply from alternate address"
 add_message '[from]="Sender <[hidden email]>"' \
@@ -62,7 +65,7 @@ add_message '[from]="Sender <[hidden email]>"' \
     '[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 <[hidden email]>
 Subject: Re: notmuch-reply-test
 To: Sender <[hidden email]>
@@ -70,7 +73,8 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <[hidden email]> wrote:
-> reply from alternate address"
+> reply from alternate address
+OK"
 
 test_begin_subtest "Reply from address in named group list"
 add_message '[from]="Sender <[hidden email]>"' \
@@ -80,7 +84,7 @@ add_message '[from]="Sender <[hidden email]>"' \
             '[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 <[hidden email]>
 Subject: Re: notmuch-reply-test
 To: Sender <[hidden email]>, [hidden email]
@@ -88,7 +92,8 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <[hidden email]> 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 <[hidden email]>"' \
@@ -98,7 +103,7 @@ add_message '[from]="Sender <[hidden email]>"' \
     '[body]="support for reply-to"' \
     '[reply-to]="Sender <[hidden email]>"'
 
-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 <[hidden email]>
 Subject: Re: notmuch-reply-test
 To: Sender <[hidden email]>
@@ -106,7 +111,8 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <[hidden email]> wrote:
-> support for reply-to"
+> support for reply-to
+OK"
 
 test_begin_subtest "Un-munging Reply-To"
 add_message '[from]="Sender <[hidden email]>"' \
@@ -116,7 +122,7 @@ add_message '[from]="Sender <[hidden email]>"' \
     '[body]="Un-munging Reply-To"' \
     '[reply-to]="Evil Munging List <[hidden email]>"'
 
-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 <[hidden email]>
 Subject: Re: notmuch-reply-test
 To: Sender <[hidden email]>, Some List <[hidden email]>
@@ -124,13 +130,14 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <[hidden email]> 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 <[hidden email]>
 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 <[hidden email]> wrote:
-> 200-byte header"
+> 200-byte header
+OK"
 
 test_begin_subtest "From guessing: Envelope-To"
 add_message '[from]="Sender <[hidden email]>"' \
@@ -149,7 +157,7 @@ add_message '[from]="Sender <[hidden email]>"' \
     '[body]="From guessing"' \
     '[header]="Envelope-To: [hidden email]"'
 
-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 <[hidden email]>
 Subject: Re: From guessing
 To: Sender <[hidden email]>, Recipient <[hidden email]>
@@ -157,7 +165,8 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <[hidden email]> wrote:
-> From guessing"
+> From guessing
+OK"
 
 test_begin_subtest "From guessing: X-Original-To"
 add_message '[from]="Sender <[hidden email]>"' \
@@ -167,7 +176,7 @@ add_message '[from]="Sender <[hidden email]>"' \
     '[body]="From guessing"' \
     '[header]="X-Original-To: [hidden email]"'
 
-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 <[hidden email]>
 Subject: Re: From guessing
 To: Sender <[hidden email]>, Recipient <[hidden email]>
@@ -175,7 +184,8 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <[hidden email]> wrote:
-> From guessing"
+> From guessing
+OK"
 
 test_begin_subtest "From guessing: Delivered-To"
 add_message '[from]="Sender <[hidden email]>"' \
@@ -185,7 +195,7 @@ add_message '[from]="Sender <[hidden email]>"' \
     '[body]="From guessing"' \
     '[header]="Delivered-To: [hidden email]"'
 
-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 <[hidden email]>
 Subject: Re: From guessing
 To: Sender <[hidden email]>, Recipient <[hidden email]>
@@ -193,7 +203,8 @@ In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <[hidden email]> 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 <[hidden email]>
 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, ☃ <[hidden email]> 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 <[hidden email]>"
     }
+  },
+  "success": "OK"
 }'
 
 test_begin_subtest "Reply to a message with multiple Cc headers"
 add_email_corpus broken
-output=$(notmuch reply id:[hidden email])
+output=$(notmuch reply id:[hidden email] 2>&1 && echo OK)
 test_expect_equal "$output" "From: Notmuch Test Suite <[hidden email]>
 Subject: Re: wowsers!
 To: Alice <[hidden email]>, Daniel <[hidden email]>
@@ -264,6 +278,7 @@ In-Reply-To: <[hidden email]>
 References: <[hidden email]>
 
 On Thu, 16 Jun 2016 22:14:41 -0400, Alice <[hidden email]> wrote:
-> Note the Cc: and cc: headers."
+> Note the Cc: and cc: headers.
+OK"
 
 test_done
--
2.13.2

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Daniel Kahn Gillmor Daniel Kahn Gillmor
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v2 2/2] Add additional munged reply-to tests

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 <[hidden email]> wrote:
 > Un-munging Reply-To
 OK"
 
+test_begin_subtest "Un-munging Reply-To With Exact Match"
+add_message '[from]="Sender <[hidden email]>"' \
+    '[to]="Some List <[hidden email]>"' \
+     [subject]=notmuch-reply-test \
+    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+    '[body]="Un-munging Reply-To"' \
+    '[reply-to]="Some List <[hidden email]>"'
+
+output=$(notmuch reply id:${gen_msg_id} 2>&1 && echo OK)
+test_expect_equal "$output" "From: Notmuch Test Suite <[hidden email]>
+Subject: Re: notmuch-reply-test
+To: Sender <[hidden email]>, Some List <[hidden email]>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Sender <[hidden email]> wrote:
+> Un-munging Reply-To
+OK"
+
+test_begin_subtest "Un-munging Reply-To With Raw addr-spec"
+add_message '[from]="Sender <[hidden email]>"' \
+    '[to]="Some List <[hidden email]>"' \
+     [subject]=notmuch-reply-test \
+    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+    '[body]="Un-munging Reply-To"' \
+    '[reply-to]="[hidden email]"'
+
+output=$(notmuch reply id:${gen_msg_id} 2>&1 && echo OK)
+test_expect_equal "$output" "From: Notmuch Test Suite <[hidden email]>
+Subject: Re: notmuch-reply-test
+To: Sender <[hidden email]>, Some List <[hidden email]>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Sender <[hidden email]> 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 <[hidden email]>",
--
2.13.2

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Daniel Kahn Gillmor Daniel Kahn Gillmor
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH] Avoid crashes in "notmuch reply" with gmime 3.0 when reply-to == sender

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

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Daniel Kahn Gillmor Daniel Kahn Gillmor
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] Avoid crashes in "notmuch reply" with gmime 3.0 when reply-to == sender

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

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (847 bytes) Download Attachment
Daniel Kahn Gillmor Daniel Kahn Gillmor
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] Avoid crashes in "notmuch reply" with gmime 3.0 when reply-to == sender

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

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (847 bytes) Download Attachment
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] Avoid crashes in "notmuch reply" with gmime 3.0 when reply-to == sender

Daniel Kahn Gillmor <[hidden email]> 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:[hidden email]

        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:[hidden email]

       I'll comment in that thread about that patch.


       
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Loading...