unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jameson Graef Rollins <jrollins@finestructure.net>
To: Mark Walters <markwalters1009@gmail.com>,
	Ben Gamari <bgamari.foss@gmail.com>,
	notmuch@notmuchmail.org
Subject: Re: [PATCH] sprinters: bugfix when NULL passed for a string.
Date: Tue, 07 Aug 2012 18:36:20 -0700	[thread overview]
Message-ID: <871ujijhbf.fsf@servo.finestructure.net> (raw)
In-Reply-To: <874noe1o0r.fsf@qmul.ac.uk>

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

On Tue, Aug 07 2012, Mark Walters <markwalters1009@gmail.com> 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=text 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. 

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     

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.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

  reply	other threads:[~2012-08-08  1:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-07  5:52 Segmentation fault in notmuch search --format=json Ben Gamari
2012-08-07  7:07 ` Mark Walters
2012-08-07  8:08   ` Jameson Graef Rollins
2012-08-07 12:49   ` Austin Clements
2012-08-07 19:48   ` [PATCH] sprinters: bugfix when NULL passed for a string Mark Walters
2012-08-08  1:36     ` Jameson Graef Rollins [this message]
2012-08-08  2:09     ` Austin Clements
2012-08-08  7:31       ` Mark Walters
2012-08-08 16:25         ` Jameson Graef Rollins
  -- strict thread matches above, loose matches on Subject: below --
2012-08-07 21:21 [PATCH] test: Add test for messages with missing headers Austin Clements
2012-08-08  1:28 ` [PATCH v2] " Austin Clements
2012-08-08 21:23   ` [PATCH] sprinters: bugfix when NULL passed for a string Mark Walters
2012-08-08 21:28     ` Austin Clements
2012-08-12 19:51     ` David Bremner

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=871ujijhbf.fsf@servo.finestructure.net \
    --to=jrollins@finestructure.net \
    --cc=bgamari.foss@gmail.com \
    --cc=markwalters1009@gmail.com \
    --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).