Re: [PATCH] lib: Add a new prefix "list" to the search-terms syntax

Subject: Re: [PATCH] lib: Add a new prefix "list" to the search-terms syntax

Date: Tue, 30 Apr 2013 13:52:14 +0400

To: David Bremner


From: Alexey I. Froloff

On Mon, Apr 29, 2013 at 10:12:16PM -0300, David Bremner wrote:
> > +    begin_list_id = strrchr (list_id_header, '<');
> > +    if (!begin_list_id) {
> > +	fprintf (stderr, "Warning: Not indexing mailformed List-Id tag.\n");
> > +	return;
> > +    }
> - I guess this should say "malformed". 
My bad.  English is not my native language ;-)

> - I got about 1800 lines of such messages when indexing 280k
>   messages. That might strike some people as excessive. On the otherhand
>   I guess we need to re-think error reporting overall.
If I understand correctly, this code belongs to library and
should not print anything neither on stderr nor stdout.  OTOH,
surrounding functions do print messages on error, so I just did
as other do.

>   What do you think about printing filename or message-id here its
>   easier to double check that it is not a bug?
Giving Message-Id makes sense.

> > +    void *local = talloc_new (message);
>       we should handle ENOMEM here, I think.
There are 16 talloc_new() calls and ENOMEM is not handled

> > +    /* _notmuch_message_add_term() may return
> > +     * NOTMUCH_PRIVATE_STATUS_TERM_TOO_LONG here.  We can't fix it, but
> > +     * this is not a reason to exit with error... */
> > +    if (_notmuch_message_add_term (message, "list", list_id))
> > +	fprintf (stderr, "Warning: Not indexing List-Id: <%s>\n", list_id);
> This should say why the indexing failed.
There should be strerror-like function, then can give description
for a given status code.

> - We need a couple tests for this code; tests/search should give some
>   hints how to proceed.

> - We need a patch for NEWS, explaining what people need to do take
>   advantage of the new functionality.  I think that adding new prefixes
>   to an existing database is OK, but I'd welcome confirmation.

Regards,    --
Sir Raorn.   ---
signature.asc (application/pgp-signature)