]> git.notmuchmail.org Git - notmuch/log
notmuch
14 years agoAvoid reading a byte just before our allocated buffer.
Carl Worth [Fri, 16 Oct 2009 20:38:43 +0000 (13:38 -0700)]
Avoid reading a byte just before our allocated buffer.

When looking for a trailing ':' to introduce a quotation we peek at
the last character before a newline. But for blank lines, that's not
where we want to look. And when the first line in our buffer is a
blank line, we're underrunning our buffer. The fix is easy---just
bail early on blank lines since they have no terms anyway.

Thanks to valgrind for pointing out this error.

14 years agoGenerate random thread IDs instead of using an arbitrary Message-ID.
Carl Worth [Fri, 16 Oct 2009 20:33:39 +0000 (13:33 -0700)]
Generate random thread IDs instead of using an arbitrary Message-ID.

Previously, we used as the thread-id the message-id of the first
message in the thread that we happened to find. In fact, this is a
totally arbitrary identifier, so it might as well be random. And an
advantage of actually using a random identifier is that we now have
fixed-length thead identifiers, (and the way is open to even allow
abbreviated identifiers like git does---though we're less likely to
show these identifiers to actual users).

14 years agoChange progress report to show "instantaneous" rate. Also print total time.
Carl Worth [Thu, 15 Oct 2009 16:04:31 +0000 (09:04 -0700)]
Change progress report to show "instantaneous" rate. Also print total time.

Instead of always showing the overall rate, we wait until the end
to show that. Then, on incremental updates we show the rate over the
last increment. This makes it much easier to actually watch what's
happening, (and it's easy to see the efect of xapian's internal
10,000 document flush).

14 years agoProtect against missing message id while indexing files
Keith Packard [Thu, 15 Oct 2009 04:46:54 +0000 (21:46 -0700)]
Protect against missing message id while indexing files

14 years agoWalk address groups and parse each address separately
Keith Packard [Thu, 15 Oct 2009 04:17:39 +0000 (21:17 -0700)]
Walk address groups and parse each address separately

Signed-off-by: Keith Packard <keithp@keithp.com>
14 years agoReduce the verbosity of the progress indicator.
Carl Worth [Thu, 15 Oct 2009 00:26:28 +0000 (17:26 -0700)]
Reduce the verbosity of the progress indicator.

It's fast enough that we can wait for 1000 messages before updating.

14 years agoAdd support for message-part mime parts.
Carl Worth [Thu, 15 Oct 2009 00:25:20 +0000 (17:25 -0700)]
Add support for message-part mime parts.

We could (and probably should) reparse and index all the headers from
the embedded message, but I'm not choosing to do that now---I'm just
indexing the body of the embedded message.

14 years agoAvoid segfault on message with no subject.
Carl Worth [Thu, 15 Oct 2009 00:24:28 +0000 (17:24 -0700)]
Avoid segfault on message with no subject.

It's fun how turning a program loose on 500,000 messages will find
lots of littel corner cases.

14 years agoAdd some sort of progress indicator.
Carl Worth [Thu, 15 Oct 2009 00:10:14 +0000 (17:10 -0700)]
Add some sort of progress indicator.

It's nice to let the user know that something is happening.

14 years agoAvoid complaints about messages with empty mime parts.
Carl Worth [Thu, 15 Oct 2009 00:09:56 +0000 (17:09 -0700)]
Avoid complaints about messages with empty mime parts.

14 years agoAvoid complaints about empty address lists.
Carl Worth [Thu, 15 Oct 2009 00:09:30 +0000 (17:09 -0700)]
Avoid complaints about empty address lists.

14 years agoDocument the little details separating the sup and notmuch indexes.
Carl Worth [Wed, 14 Oct 2009 23:49:26 +0000 (16:49 -0700)]
Document the little details separating the sup and notmuch indexes.

As can be seen here, there are not a lot of differences. I've verified
this by using sup-sync to import a month of mail from the sup mailing
list, and comparing the database term-by-term, value-by-value, and
data-by-data with that created by notmuch. There are no differences
other than those documented here.

14 years agoAvoid trimming initial whitespace while looking for signatures.
Carl Worth [Wed, 14 Oct 2009 23:38:21 +0000 (16:38 -0700)]
Avoid trimming initial whitespace while looking for signatures.

I ran into a message with an indented stack trace that my indexer
was mistaking for a signature.

14 years agoIndex an attachment's filename extension as well.
Carl Worth [Wed, 14 Oct 2009 23:35:03 +0000 (16:35 -0700)]
Index an attachment's filename extension as well.

I hadn't realized that sup used a special term for this. But there
you go.

14 years agoIndex the filename of any attachment.
Carl Worth [Wed, 14 Oct 2009 23:28:07 +0000 (16:28 -0700)]
Index the filename of any attachment.

14 years ago[sup-compat] Don't index mime parts with content-disposition of attachment
Carl Worth [Wed, 14 Oct 2009 23:20:45 +0000 (16:20 -0700)]
[sup-compat] Don't index mime parts with content-disposition of attachment

Here's another change which I'm making for sup compatibility against
my better judgment. It seems that sup never indexes content from
mime parts with content-disposition of attachment. But these
attachments are often very indexable, (for example, the first one
I encountered was a small shell script).

So I'll have to think a bit about whether or not I want to revert
this commit. To do this properly we would really want to distinguish
between attachments that are indexable, (such as text), and those
that aren't, (such as binaries). I know the mime-type alone isn't
alwas sufficient here as even this little plaintext shell script
was attached as octet-stream.

And if we wanted to get really fancy we could run things like antiword
to generate text from non-text attachments and index their output.

14 years agoAdd label "attachment" when an attachment is seen.
Carl Worth [Wed, 14 Oct 2009 23:18:17 +0000 (16:18 -0700)]
Add label "attachment" when an attachment is seen.

14 years agoSplit thread_id value on commas before inserting into hash.
Carl Worth [Wed, 14 Oct 2009 23:04:25 +0000 (16:04 -0700)]
Split thread_id value on commas before inserting into hash.

One thread_id value may have multiple thread IDs in it so we need
to separate them out before inserting into our hash.

14 years agoAdd missing null terminator before using byte-array contents as string.
Carl Worth [Wed, 14 Oct 2009 22:55:07 +0000 (15:55 -0700)]
Add missing null terminator before using byte-array contents as string.

Thanks to valgrind for spotting this one.

14 years agonotmuch-index-message: Add explicit support for multipart mime.
Carl Worth [Wed, 14 Oct 2009 22:33:16 +0000 (15:33 -0700)]
notmuch-index-message: Add explicit support for multipart mime.

Instead of using the recursive "foreach" method, we implement our
own recursive function. This allows us to ignore the signature
component of a multipart/signed message, (which we certainly
don't need to index).

14 years ago[sup-compat] Don't trim trailing whitespace on line introducing quotation.
Carl Worth [Wed, 14 Oct 2009 21:06:06 +0000 (14:06 -0700)]
[sup-compat] Don't trim trailing whitespace on line introducing quotation.

Ignoring this whitespace seems like a good idea to me, but it's
interfering with my comparisons with sup since sup doesn't do this.

This might be a commit worth dropping in the future since it exists
only for pedantic consistency with sup and not for any reason of its
own.

14 years agonotmuch-index-message: Fix handling of thread_id terms.
Carl Worth [Wed, 14 Oct 2009 21:00:10 +0000 (14:00 -0700)]
notmuch-index-message: Fix handling of thread_id terms.

We now emit one term per thread_id, rather than the comma-separated
super-term we were doing previously.

14 years agonotmuch-index-message: Use local-part of email addres in lieu of name.
Carl Worth [Wed, 14 Oct 2009 20:46:01 +0000 (13:46 -0700)]
notmuch-index-message: Use local-part of email addres in lieu of name.

If there's no name given, take the portion of the email addres
before the '@' sign.

One step closer to matching sup's terms in the database.

14 years agoUse gmime's own reference-parsing code.
Carl Worth [Wed, 14 Oct 2009 20:30:33 +0000 (13:30 -0700)]
Use gmime's own reference-parsing code.

Here's another instance where I "knew" gmime must have support for
some functionality, but not finding it, I rolled my own. Now that
I found g_mime_references_decode I'm glad to drop my ugly code.

14 years agonotmuch-index-message: Correctly parse and index encoded mime parts.
Carl Worth [Wed, 14 Oct 2009 19:48:58 +0000 (12:48 -0700)]
notmuch-index-message: Correctly parse and index encoded mime parts.

This cleans up some old code that was very ugly, (separately opening
the mail file and seeking to the end of the headers to parse the
body). I knew gmime must have had support for transparently decoding
mime content, but I just couldn't find it previously.

Note: Multipart and MultipartSigned parts are not handled yet.

Things are quite happy now. The few differences I see with sup are:

1. sup forces email address domains to lowercase, (I don't think I care)

2. sup and notmuch disagree on ordering of multiple thread_id values
   (another thing that's of no concern)

We are still doing one thing wrong when a message belongs to multiple
threads. We've got a nice comma-separated thread-value just like sup,
but then we're also putting in a comma-separated thread-term where
sup does multiple thread terms. That should be an easy fix.

Beyond that, sup and notmuch are still disagreeing on the term lists
for some messages, (I think attachment vs. inline content-disposition
is at least one piece of this). But there are likley still differences
in the heuristics for which chunks of the message body to index. I'll
be looking into this more.

14 years agonotmuch-index-message: Lookup children for thread_id as well.
Carl Worth [Wed, 14 Oct 2009 17:34:05 +0000 (10:34 -0700)]
notmuch-index-message: Lookup children for thread_id as well.

This provides the thread_id linkage for when a child message is
indexed before the parent.

14 years agonotmuch-index-message: Use more meaningful variable names.
Carl Worth [Wed, 14 Oct 2009 16:57:59 +0000 (09:57 -0700)]
notmuch-index-message: Use more meaningful variable names.

The abuse of the generic "value" name was getting very hard to read.

14 years agonotmuch-index-message: Start generating correct thread_id values.
Carl Worth [Wed, 14 Oct 2009 16:54:05 +0000 (09:54 -0700)]
notmuch-index-message: Start generating correct thread_id values.

Currently we're looking up all parents (based on In-reply-to and
References header) and using the list of all thread_id values
from those as our thread_id value. We're missing one step which
sup does which is to also look up any children in the database
that have reference our message ID. So we'll need to do that next.

14 years agoFactor out parsing of reference-header values and pickup In-reply-to.
Carl Worth [Wed, 14 Oct 2009 15:02:27 +0000 (08:02 -0700)]
Factor out parsing of reference-header values and pickup In-reply-to.

This is in preparation for doing a couple of passes over the references,
(one to add terms to the database, and a second to find the thread_id).

We also now parse the In-reply-to header which we were missing before.
We treat it identically to the References header.

14 years agonotmuch-index-message: Ignore more signature patterns.
Carl Worth [Wed, 14 Oct 2009 14:24:28 +0000 (07:24 -0700)]
notmuch-index-message: Ignore more signature patterns.

Getting more sup-compatible all the time.

14 years agonotmuch-index-message: Avoid crashing when a message has no references.
Carl Worth [Wed, 14 Oct 2009 04:13:23 +0000 (21:13 -0700)]
notmuch-index-message: Avoid crashing when a message has no references.

It's obviously an innocent-enough message, and the right thing is
so easy to do.

14 years agonotmuch-index-message: Read message filenames from stdin
Carl Worth [Wed, 14 Oct 2009 04:11:54 +0000 (21:11 -0700)]
notmuch-index-message: Read message filenames from stdin

This allows for indexing an arbitrary number of messages with a
single invocation rather than just a single message on the command
line.

14 years agoMove index_file out from main() into its own function.
Carl Worth [Wed, 14 Oct 2009 03:42:08 +0000 (20:42 -0700)]
Move index_file out from main() into its own function.

This is a step toward having a program that will index many messages
with a single invocation.

14 years agonotmuch-index-message: Index References as well.
Carl Worth [Wed, 14 Oct 2009 01:43:26 +0000 (18:43 -0700)]
notmuch-index-message: Index References as well.

We're basically matching sup now! (As long as one uses sup with my
special notmuch_index.rb file).

14 years agoMinor code re-ordering for clarity.
Carl Worth [Wed, 14 Oct 2009 01:16:43 +0000 (18:16 -0700)]
Minor code re-ordering for clarity.

Pull the "constant" source_id value out from among several calls
that set a value based on the Message ID.

14 years agonotmuch-index-message: Don't index the "re:" prefix in subjects.
Carl Worth [Wed, 14 Oct 2009 00:01:43 +0000 (17:01 -0700)]
notmuch-index-message: Don't index the "re:" prefix in subjects.

Getting closer to sup results all the time.

14 years agonotmuch-index-message: Don't index the line introducing a quote.
Carl Worth [Tue, 13 Oct 2009 23:52:12 +0000 (16:52 -0700)]
notmuch-index-message: Don't index the line introducing a quote.

We identify it based on a trailing ':' on the line before a quote
begins.

At this point the database-dump diff between sup and notmuch is
getting very, very small, (at least for our one test message).

14 years agonotmuch-index-message: Don't index quoted lines and signatures.
Carl Worth [Tue, 13 Oct 2009 23:09:54 +0000 (16:09 -0700)]
notmuch-index-message: Don't index quoted lines and signatures.

At this point, we're achieving a result that is *very* close to
what sup does. The only difference is that we are still indexing
the "excerpts from message ..." line, and we are not yet indexing
references.

14 years agonotmuch-index-message: Separate gen_terms_body into its own function
Carl Worth [Tue, 13 Oct 2009 23:03:01 +0000 (16:03 -0700)]
notmuch-index-message: Separate gen_terms_body into its own function

This one is complex enough to deserve its own treament.

14 years agonotmuch-index-message: Add code to actually create a Xapian index
Carl Worth [Tue, 13 Oct 2009 22:56:16 +0000 (15:56 -0700)]
notmuch-index-message: Add code to actually create a Xapian index

Most of this code is fairly clean and works well. One part is
fairly painful---namely extracting the body of an email message
from libgmime. Currently, I'm just extracting the offset to
the end of the headers, and then separately opening the message.
Surely there's a better way.

Anyway, with that the results are looking very similar to sup-sync
now, (as verified by xapian-dump). The only substantial difference
I'm seeing now is that sup does not seem to index quoted portions
of messages nor signatures. I'm not actually sure whether I want
to follow sup's lead in that or not.

14 years agoRename g_mime_test to notmuch-index-message
Carl Worth [Tue, 13 Oct 2009 20:28:13 +0000 (13:28 -0700)]
Rename g_mime_test to notmuch-index-message

In preparation for actually creating a Xapian index from the
message, (not that we're doing that quite yet).

14 years agoxapian-dump: Add a little mor indentation
Carl Worth [Tue, 13 Oct 2009 20:21:47 +0000 (13:21 -0700)]
xapian-dump: Add a little mor indentation

Just to make it easier to visually identify where one document ends
and the next begins.

14 years agoInclude document data in the dump.
Carl Worth [Tue, 13 Oct 2009 20:18:32 +0000 (13:18 -0700)]
Include document data in the dump.

At the same time, I've started hacking up sup with a new NotmuchIndex
class in the place of the previous XapianIndex class. The new class
stores only the source_info field in the document data, (rather than
a serialized ruby hash with a bunch of data that can be found in the
original message).

Eventually, I plan to replace source_info with a relative filename for
the message, (or even a list of filenames for when multiple messages
in the database share a common message ID).

14 years agoxapian-dump: Add support to unserialize values.
Carl Worth [Tue, 13 Oct 2009 16:36:25 +0000 (09:36 -0700)]
xapian-dump: Add support to unserialize values.

The interface for this is cheesy, (bare integer value numbers on the
command line indicating that unserialization is desired for those
value numbers). But this at least lets us print sup databases with
human-readable output for the date values.

14 years agoAdd .gitignore file to ignore compiled binaries.
Carl Worth [Tue, 13 Oct 2009 15:57:02 +0000 (08:57 -0700)]
Add .gitignore file to ignore compiled binaries.

14 years agoxapian-dump: Add values to the dump as well.
Carl Worth [Tue, 13 Oct 2009 15:50:20 +0000 (08:50 -0700)]
xapian-dump: Add values to the dump as well.

14 years agoxapian-dump: Fix to dump all terms for each document ID.
Carl Worth [Tue, 13 Oct 2009 15:29:59 +0000 (08:29 -0700)]
xapian-dump: Fix to dump all terms for each document ID.

14 years agoxapian-dump: Actually dump document IDs
Carl Worth [Tue, 13 Oct 2009 15:20:36 +0000 (08:20 -0700)]
xapian-dump: Actually dump document IDs

It's not a complete tool yet, but it at least does something now.

14 years agoRemove unused variable.
Carl Worth [Tue, 13 Oct 2009 14:51:11 +0000 (07:51 -0700)]
Remove unused variable.

Compiling with -Wall considered useful.

14 years agoAdd the beginnings of a xapian-dump program.
Carl Worth [Tue, 13 Oct 2009 14:50:04 +0000 (07:50 -0700)]
Add the beginnings of a xapian-dump program.

This will (when it is finished) make a much more reliable way to
ensure that notmuch's sync program behaves identically to sup-sync.
It doesn't actually do anything yet.

14 years agoAdd sup-compatible prefixes and achieve sup-compatible print output
Carl Worth [Tue, 13 Oct 2009 14:23:14 +0000 (07:23 -0700)]
Add sup-compatible prefixes and achieve sup-compatible print output

What I've done here is to instrument sup-sync to print the text
and terms objects it constructs just before indexing a message.
Then I've made my g_mime_test program achieve (nearly) identical
output for an example email message, (just missing the body
text). Next we can start shoving this data into a Xapian index.

14 years agoInitial commit of a test program to form the basis of notmuch.
Carl Worth [Mon, 12 Oct 2009 22:50:02 +0000 (15:50 -0700)]
Initial commit of a test program to form the basis of notmuch.

Basically just playing with some simple code using libgmime to parse
an email message.