unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [Jakub Wilk] Bug#749890: python3-notmuch: missing header in mbox message -> NullPointerError
@ 2014-05-30 13:14 David Bremner
  2016-03-14 20:54 ` Justus Winter
  0 siblings, 1 reply; 2+ messages in thread
From: David Bremner @ 2014-05-30 13:14 UTC (permalink / raw)
  To: notmuch

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


this looks like a bug in the python bindings to me


[-- Attachment #2: Type: message/rfc822, Size: 5928 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 994 bytes --]

Package: python3-notmuch
Version: 0.18-3
Severity: minor

If a message starts with the "From " postmark (i.e., it's in the mbox 
format), and you ask the get_header() method for a non-existent header, 
it raises NullPointerError, instead of returning empty string.

Now, I realize that support for indexing mbox files has been dropped, 
but users might still have them on disk, indexed by an old version of 
notmuch. This is how I discovered this bug.

I've attached my crafted mail archive (which I indexed with wheezy's 
notmuch), and the script that I used for testing:

$ python3 test.py
OK
NullPointerError()


-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.14-1-amd64 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash

Versions of packages python3-notmuch depends on:
ii  libnotmuch3  0.18-3+b1

-- 
Jakub Wilk

[-- Attachment #2.1.2: mail.tar.gz --]
[-- Type: application/gzip, Size: 230 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2.1.3: test.py --]
[-- Type: text/x-python, Size: 394 bytes --]

#!/usr/bin/python3

import notmuch

with notmuch.Database() as db:
    query = db.create_query('')
    for msg in query.search_messages():
        try:
            assert msg.get_header('Subject') == 'Hello world!'
            assert msg.get_header('Does-Not-Exist') == ''
        except Exception as exc:
            print(ascii(exc))
        else:
            print('OK')

# vim:ts=4 sw=4 et

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

end of thread, other threads:[~2016-03-14 20:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-30 13:14 [Jakub Wilk] Bug#749890: python3-notmuch: missing header in mbox message -> NullPointerError David Bremner
2016-03-14 20:54 ` Justus Winter

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).