]> git.notmuchmail.org Git - notmuch/commit
Add support (and tests) for messages with really long message IDs.
authorCarl Worth <cworth@cworth.org>
Fri, 4 Jun 2010 19:39:36 +0000 (12:39 -0700)
committerCarl Worth <cworth@cworth.org>
Fri, 4 Jun 2010 20:35:07 +0000 (13:35 -0700)
commit7b78eb4af6e87532795d09bd82152002ab4a74b1
treeeb2ccea430a8162698787489dce2c4703f9b0f55
parent77ab73834325f2b2a8870204af60e116d4209f12
Add support (and tests) for messages with really long message IDs.

Scott Henson reported an internal error that occurred when he tried to
add a message that referenced another message with a message ID well
over 300 characters in length. The bug here was running into a Xapian
limit for the length of metadata key names, (which is even more
restrictive than the Xapian limit for the length of terms).

We fix this by noticing long message ID values and instead using a
message ID of the form "notmuch-sha1-<sha1_sum_of_message_id>". That
is, we use SHA1 to generate a compressed, (but still unique), version
of the message ID.

We add support to the test suite to exercise this fix. The tests add a
message referencing the long message ID, then add the message with the
long message ID, then finally add another message referencing the long
ID. Each of these tests exercise different code paths where the
special handling is implemented.

A final test ensures that all three messages are stitched together
into a single thread---guaranteeing that the three code paths all act
consistently.
lib/database.cc
lib/notmuch-private.h
test/notmuch-test