Re: [Jakub Wilk] Bug#749890: python3-notmuch: missing header in mbox message -> NullPointerError

2016-03-14 Thread Justus Winter
Hi,

Quoting David Bremner (2014-05-30 15:14:46)
> this looks like a bug in the python bindings to me
> 
> 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:

I cannot reproduce this neither with master nor with 0.21-3 from
unstable.

Justus
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[Jakub Wilk] Bug#749890: python3-notmuch: missing header in mbox message -> NullPointerError

2014-05-30 Thread David Bremner

this looks like a bug in the python bindings to me

-- next part --
An embedded message was scrubbed...
From: Jakub Wilk 
Subject: Bug#749890: python3-notmuch: missing header in mbox message -> 
NullPointerError
Date: Fri, 30 May 2014 14:36:09 +0200
Size: 5979
URL: 



[Jakub Wilk] Bug#749890: python3-notmuch: missing header in mbox message -> NullPointerError

2014-05-30 Thread David Bremner

this looks like a bug in the python bindings to me

--- Begin Message ---

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


mail.tar.gz
Description: application/gzip
#!/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
--- End Message ---
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch