Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 17D0A431FBD for ; Fri, 30 May 2014 06:14:54 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 29GFD5HQU5Hx for ; Fri, 30 May 2014 06:14:50 -0700 (PDT) Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 7E808431FAE for ; Fri, 30 May 2014 06:14:50 -0700 (PDT) Received: from remotemail by yantan.tethera.net with local (Exim 4.80) (envelope-from ) id 1WqMe1-0003gl-Kx; Fri, 30 May 2014 10:14:49 -0300 Received: (nullmailer pid 6869 invoked by uid 1000); Fri, 30 May 2014 13:14:46 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [Jakub Wilk] Bug#749890: python3-notmuch: missing header in mbox message -> NullPointerError User-Agent: Notmuch/0.18 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Fri, 30 May 2014 10:14:46 -0300 Message-ID: <87k393l86x.fsf@zancas.localnet> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 May 2014 13:14:54 -0000 --=-=-= Content-Type: text/plain this looks like a bug in the python bindings to me --=-=-= Content-Type: message/rfc822 Content-Disposition: inline Return-path: Envelope-to: david@tethera.net Delivery-date: Fri, 30 May 2014 09:39:12 -0300 Received: from quantz.debian.org ([5.153.231.28]) by yantan.tethera.net with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1WqM5Y-0003YR-FC for david@tethera.net; Fri, 30 May 2014 09:39:12 -0300 Received: from qa by quantz.debian.org with local (Exim 4.80) (envelope-from ) id 1WqM5V-0003Ov-Vh for david@tethera.net; Fri, 30 May 2014 12:39:09 +0000 Received: from buxtehude.debian.org ([140.211.166.26]) from C=NA,ST=NA, L=Ankh Morpork,O=Debian SMTP,OU=Debian SMTP CA,CN=buxtehude.debian.org, EMAIL=hostmaster@buxtehude.debian.org (verified) by quantz.debian.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1WqM5V-0003OV-Gx for notmuch@packages.qa.debian.org; Fri, 30 May 2014 12:39:09 +0000 Received: from debbugs by buxtehude.debian.org with local (Exim 4.80) (envelope-from ) id 1WqM5T-0000k8-4S; Fri, 30 May 2014 12:39:07 +0000 X-Loop: owner@bugs.debian.org Subject: Bug#749890: python3-notmuch: missing header in mbox message -> NullPointerError Reply-To: Jakub Wilk , 749890@bugs.debian.org Resent-From: Jakub Wilk Original-Sender: Jakub Wilk Resent-To: debian-bugs-dist@lists.debian.org Resent-CC: jwilk@debian.org, Carl Worth X-Loop: owner@bugs.debian.org Resent-Date: Fri, 30 May 2014 12:39:02 +0000 Resent-Message-ID: X-Debian-PR-Message: report 749890 X-Debian-PR-Package: python3-notmuch X-Debian-PR-Keywords: X-Debian-PR-Source: notmuch Received: via spool by submit@bugs.debian.org id=B.14014533741926 (code B); Fri, 30 May 2014 12:39:02 +0000 Received: (at submit) by bugs.debian.org; 30 May 2014 12:36:14 +0000 X-Spam-Checker-Version: SpamAssassin 3.3.2-bugs.debian.org_2005_01_02 (2011-06-06) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-17.8 required=4.0 tests=BAYES_00,FOURLA, FROMDEVELOPER,HAS_PACKAGE,RCVD_IN_DNSWL_MED,T_RP_MATCHES_RCVD,X_DEBBUGS_CC, X_DEBBUGS_NO_ACK autolearn=ham version=3.3.2-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 17; hammy, 151; neutral, 76; spammy, 0. spammytokens: hammytokens:0.000-+--HX-Debbugs-No-Ack:please, 0.000-+--H*F:U*jwilk, 0.000-+--H*M:jwilk, 0.000-+--H*r:jwilk, 0.000-+--H*MI:jwilk Received: from master.debian.org ([82.195.75.110]) from C=NA,ST=NA, L=Ankh Morpork,O=Debian SMTP,OU=Debian SMTP CA,CN=master.debian.org, EMAIL=hostmaster@master.debian.org (verified) by buxtehude.debian.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1WqM2g-0000Un-Ea for submit@bugs.debian.org; Fri, 30 May 2014 12:36:14 +0000 Received: from jwilk by master.debian.org with local (Exim 4.80) (envelope-from ) id 1WqM2e-0005im-An for submit@bugs.debian.org; Fri, 30 May 2014 12:36:12 +0000 Date: Fri, 30 May 2014 14:36:09 +0200 From: Jakub Wilk To: Debian Bug Tracking System Message-ID: <20140530123609.GA5727@jwilk.net> X-Reportbug-Version: 6.5.0 User-Agent: Mutt/1.5.23 (2014-03-12) Sender: Jakub Wilk Delivered-To: submit@bugs.debian.org Delivered-To: notmuch@packages.qa.debian.org Precedence: list X-Loop: notmuch@packages.qa.debian.org X-Debian: PTS X-Debian-Package: notmuch X-PTS-Package: notmuch X-PTS-Keyword: bts List-Unsubscribe: Resent-Sender: Debian QA MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="====-=-=" --====-=-= Content-Type: text/plain; format=flowed Content-Disposition: inline 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 --====-=-= Content-Type: application/gzip Content-Disposition: attachment; filename=mail.tar.gz Content-Transfer-Encoding: base64 H4sIAPd3iFMAA+3UTW6DMBCGYdacYnKCjI0dVA4QddNVTkCaqCI1suQQRb19CbsitVk5P+r7bMbI SAwefe7bLiyLvHRUez/V0bxOa2MrZ7Wuam8LNVa1KsRn7mtyOg5tGltJMQ5/vXdtf/5zT6K/zP8j xl3Gb1zOY+Xc7/Mf92bzX3lXyE0O8Z/Pf3PaHvbvQyOv+xCinGMKu0VZ/ni6d4/IZ8r/ts0Z/6v5 N8bM8++cJ/+3sE6xl8O5C58i69TJW/sllYpxjb406sWqcSWXBAAAAAAAAAAAAAAAD+0bvcL6SAAo AAA= --====-=-= Content-Type: text/x-python Content-Disposition: attachment; filename=test.py #!/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 --====-=-=-- --=-=-=--