Re: [PATCH] test: add regression test for Subject with newline.

Subject: Re: [PATCH] test: add regression test for Subject with newline.

Date: Mon, 10 Oct 2022 18:24:26 -0300

To: Thibault Polge, notmuch@notmuchmail.org

Cc: Daniel Kahn Gillmor, Jakub Wilk

From: David Bremner


David Bremner <david@tethera.net> writes:

> This tests the issue reported by Thibault in id:87wn9w4xus.fsf@thb.lt
> ---
>
> I could not duplicate the problem here. Maybe it depends on the version of gmime?
> I have 3.2.9 here.

Now that I have gmime 3.2.13 I can confirm your bug (my previously
posted test fails).  It seems the purely a gmime issue (the following
reproducer is thanks to Jakub Wilk; on debian it needs the package
gir1.2-gmime-3.0).

#!/usr/bin/python3

import pathlib
import tempfile

import gi
gi.require_version('GMime', '3.0')
from gi.repository import GMime
GMime.init()

msg = b'''\
Subject: =?UTF-8?B?SGVsbG8=?= =?UTF-8?B?IHdvcmxk?=

.
'''

with tempfile.NamedTemporaryFile() as tmpfile:
    tmpfile.write(msg)
    tmpfile.flush()
    fp = GMime.StreamFile.open(tmpfile.name, 'r')
    parser = GMime.Parser.new_with_stream(fp)
    msg = parser.construct_message()
    subject = msg.subject
    expected = 'Hello world'
    assert subject == expected, f'{subject!r} != {expected!r}'


_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: