unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [Jakub Wilk] Bug#749890: python3-notmuch: missing header in mbox message -> NullPointerError
Date: Fri, 30 May 2014 10:14:46 -0300	[thread overview]
Message-ID: <87k393l86x.fsf@zancas.localnet> (raw)

[-- 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

             reply	other threads:[~2014-05-30 13:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-30 13:14 David Bremner [this message]
2016-03-14 20:54 ` [Jakub Wilk] Bug#749890: python3-notmuch: missing header in mbox message -> NullPointerError Justus Winter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k393l86x.fsf@zancas.localnet \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).