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 EE653431FB6 for ; Tue, 7 Aug 2012 18:36:29 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.29 X-Spam-Level: X-Spam-Status: No, score=-2.29 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_MED=-2.3, T_MIME_NO_TEXT=0.01] 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 TrWIL-1YIXB1 for ; Tue, 7 Aug 2012 18:36:29 -0700 (PDT) Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu [131.215.239.19]) by olra.theworths.org (Postfix) with ESMTP id 45E38431FAE for ; Tue, 7 Aug 2012 18:36:29 -0700 (PDT) Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1]) by earth-doxen-postvirus (Postfix) with ESMTP id B5AC966E0105; Tue, 7 Aug 2012 18:36:26 -0700 (PDT) X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new Received: from finestructure.net (m70.ligo.caltech.edu [131.215.115.170]) (Authenticated sender: jrollins) by earth-doxen-submit (Postfix) with ESMTP id CE49666E00B9; Tue, 7 Aug 2012 18:36:22 -0700 (PDT) Received: by finestructure.net (Postfix, from userid 1000) id AFE8D5CF; Tue, 7 Aug 2012 18:36:22 -0700 (PDT) From: Jameson Graef Rollins To: Mark Walters , Ben Gamari , notmuch@notmuchmail.org Subject: Re: [PATCH] sprinters: bugfix when NULL passed for a string. In-Reply-To: <874noe1o0r.fsf@qmul.ac.uk> References: <871ujjuu2z.fsf@gmail.com> <878vdrp4d9.fsf@qmul.ac.uk> <874noe1o0r.fsf@qmul.ac.uk> User-Agent: Notmuch/0.13.2+137~ge34ed71 (http://notmuchmail.org) Emacs/23.4.1 (x86_64-pc-linux-gnu) Date: Tue, 07 Aug 2012 18:36:20 -0700 Message-ID: <871ujijhbf.fsf@servo.finestructure.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" 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: Wed, 08 Aug 2012 01:36:30 -0000 --=-=-= Content-Transfer-Encoding: quoted-printable On Tue, Aug 07 2012, Mark Walters wrote: > The string function in a sprinter may be called with a NULL string > pointer (eg if a header is absent). This causes a segfault. We fix > this by checking for a null pointer in the string functions and update > the sprinter documentation. > > At the moment some output when format=3Dtext is done directly rather than > via an sprinter: in that case a null pointer is passed to printf or > similar and a "(null)" appears in the output. That behaviour is not > changed in this patch. > --- > > This could really do with some tests (it is the second time this type of > bug has occurred). To be considered as a message by notmuch new a file > needs at least one of a From: Subject: or To: header. Thus we should > have three messages each of which just contains that single header (and > nothing else) and check that search and show work as expected.=20 Hey, Mark. Thanks for working on this. I was wondering if we should distinguish between the header being absent, and having a null value. It looks like the idea here is to output an empty string for the value in all of these cases. But should we output the field at all if the actual header isn't there? In other words, I can imagine three scenarios: Header: value Header: --> "Header": "" no header=20=20=20=20=20 At the moment these would be output as: "Header": "value" "Header": "" "Header": "" Where as I could imagine we could instead do: "Header": "value" "Header": "" no output Maybe that would be too complicated or break the output spec to much? If it's too complicated to do the later, then I'm fine with this solution as is. I definitely agree we need tests for this. jamie. --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAEBCAAGBQJQIcKUAAoJEO00zqvie6q8JuMP/3jjlDO/CwzfhiTwSnLdKg+4 89bagfP5LFRvPxyPYCFzHeO2WYSgwYNNusc2RBlivz5eyEPjVUin78dfyw4rIBvl 3pfTnDywJGkmtJ9Tber0E4bl5f3VSCD9jnh/DCJK0k8YAnmy64/0DbKHk8s4GDkq CvB4vHRRukl4Cd6nOIdNcgJwe8/I8U3bbJNLuoXNTSQ0K/jy/BVtpOwS7LAxnM1y rcRSlO386sKFSluWjnEBsp7CNbX8HNw+6OBpPNPcrvLDltiHr6peSN83/ILzU0rS SEMQ47DsYrTEYI0eoDYcOWy+pfi6inz6z3Nba+aCQWofw2Y82wlU5aDMsLLWeJAO DzMedETmVL4XuYR7mRSnV3QKGvBMUKtDD46V2/1nneGxJwV2vqsv1VsYpID4xAjM eXuoRfvAWw+XdM798+BwNwCPKhczy+M2lvGoFTC3gvyR29RiEe+/y7YoRF/MqbwV yvOHTjsDxVtDo0KekKs6ie4hd1f9NIDgA6TZPx4hNryVuESf7OcBQcX4MvjXIuFl ka2siDysnT4ye7sjTNIqdsrNTvUH26TPjSEVgk17R+rOjARt2pX0uhHq0R/3YgwF bJSIlzuESP1P/k5rjB4g988N6OgSOyJGm7AtU+XwgooneVoR35F9nfxng68sDgIl CgaY+RetIAyWxNgjWiDT =/pfS -----END PGP SIGNATURE----- --=-=-=--