Phil Carmody [Mon, 15 Jun 2015 11:54:58 +0000 (14:54 +0300)]
director: explicitly mark _disconnect() helper static to match proto
No functional change, compiler would not have exported the symbol, this
just shuts up sparse.
Timo Sirainen [Mon, 15 Jun 2015 11:51:46 +0000 (14:51 +0300)]
fs-metawrap: If written file unexpectedly shrinks, return error instead of assert-crash.
This shouldn't be happening, but we can't fully control it so an error is
better.
Phil Carmody [Mon, 15 Jun 2015 11:31:19 +0000 (14:31 +0300)]
lib-test: test_expect_error_string() to match a single known message
This gives us very fine control over what is acceptable as an expected warning.
Alas you have to do it for each message individually.
Phil Carmody [Mon, 15 Jun 2015 11:31:19 +0000 (14:31 +0300)]
lib-test: let tests invoke i_warning/i_error behaviour
Error-handling paths should be testable too. Permit a test case to register
that a known number of warnings/errors are to be expected, and to verify
that those warnings did occur afterwards. Too many messages will fail the
test exactly as it did in the past, they're unexpected messages. However,
too few messages will also cause the test case to fail.
Phil Carmody [Mon, 15 Jun 2015 11:31:19 +0000 (14:31 +0300)]
lib-test: flush test-assert failure messages
Diagnostic output to stderr may overtake these stdout logs if the streams
are combined by the shell or on the console. fflush() might help realign
them.
Phil Carmody [Mon, 15 Jun 2015 11:25:07 +0000 (14:25 +0300)]
lib: array - permit array_swap with uninitialised arrays
Before initialisation, all fields are blank, so the element_size field
is not the actual size, and the i_assert would fire.
Timo Sirainen [Thu, 11 Jun 2015 16:21:16 +0000 (19:21 +0300)]
lib-index: Avoid writing tail offset update to transaction log if it's not necessary.
This should avoid extra writes that do nothing but update the tail offset.
mdbox's map requires this behavior, so disable it for it. For others it
might cause the next sync to read more data unnecessarily, but it should be
worth the extra cost of write most of the times.
Timo Sirainen [Wed, 10 Jun 2015 17:29:35 +0000 (20:29 +0300)]
lmtp: Fixed assert-crash on anvil lookup failures.
If anvil_client_query() fails, it immediately calls the callback and returns
NULL. So we need to increase anvil_queries even before calling
anvil_client_query()
Timo Sirainen [Tue, 9 Jun 2015 16:32:09 +0000 (19:32 +0300)]
dict-sql: Don't try to optimize finding a matching map by using the previous match.
In some setups multiple maps can match and it's important that the matching
is done in the same order always, otherwise the results could become
somewhat random.
Timo Sirainen [Wed, 3 Jun 2015 20:56:32 +0000 (23:56 +0300)]
fts: Added "doveadm fts lookup" command.
This is mainly useful for debugging lib-fts. It doesn't perform any of the
lib-fts tokenization / filtering so you can do raw lookups.
Timo Sirainen [Wed, 3 Jun 2015 19:30:05 +0000 (22:30 +0300)]
indexer: Improved handling multiple indexing requests to the same mailbox.
If a request arrives for a mailbox that we were already indexes, the
previous code simply sent the indexing request to the existing worker
process. This could have caused a lot of requests to be buffered to the same
mailbox if the indexing took a long time, which could have taken a while to
process even though they weren't really doing anything indexing work.
The new code instead just keeps track in memory that when the earlier
indexing is finished, it's done again once to finish any pending changes.
Teemu Huovila [Wed, 3 Jun 2015 13:47:25 +0000 (16:47 +0300)]
lib-lda: Fixed crash in mail_deliver_get_log_var_expand_table().
Discovered by clang static analyzer. This caused crashes with older versions
of Pigeonhole.
Timo Sirainen [Tue, 2 Jun 2015 21:46:23 +0000 (00:46 +0300)]
lib-fts: fts-filter API changed to have a non-pointer vfuncs variable.
The main benefit being that the fts-filter implementations can save a few
lines of code.
Timo Sirainen [Tue, 2 Jun 2015 18:56:03 +0000 (21:56 +0300)]
lib-fts: Added string_t *token to struct fts_filter
This makes the work a bit easier for simple filters that don't need any
state but want to use a string_t.
Timo Sirainen [Tue, 2 Jun 2015 16:52:15 +0000 (19:52 +0300)]
fts: Error logging fix.
1) We were logging the error after it was already freed from data stack.
2) We were logging uninitialized error string when fts indexing was the one
that failed.
Phil Carmody [Mon, 1 Jun 2015 19:08:43 +0000 (22:08 +0300)]
lib: API change - have uni_utf8_get_char*() return _char_bytes
Often the two functions are called in close proximity (both ways round). As
_get_char*() calls _char_bytes() early on the success path, we may as well
return that value to the caller for immediate use.
The callers which call _char_bytes() first are simply rejecting the truncated
case quickly - all other invalid cases still call both functions, and all
other valid cases (which should be the fast path) likewise call both.
Phil Carmody [Mon, 1 Jun 2015 19:08:27 +0000 (22:08 +0300)]
fts-solr: laxer check of uni_utf8_get_char_n() return value
If uni_utf8_get_char*() were changed to return the number of bytes in the
character on success, then all we care about is it being > 0 (i.e. not
error, not truncated).
Phil Carmody [Mon, 1 Jun 2015 19:07:44 +0000 (22:07 +0300)]
lib: test-unichar - test invalid utf8 encodings
Chop trailing characters off valid encodings, and watch them fail.
(There's no need to do this on most of the test characters, as they're
truncated to the same byte sequence - only do 1 in 64.)
Phil Carmody [Mon, 1 Jun 2015 19:06:44 +0000 (22:06 +0300)]
lib: test-unichar - streamline the unichars test
It's doing 2 kinds of tests, split them into separate test cases.
And the first part has started to get expensive, so just make sure
all code paths are tested by skipping most values. Only 3 from each
set of 64 (lowest 6 bits) are tested.
Timo Sirainen [Mon, 1 Jun 2015 18:58:30 +0000 (21:58 +0300)]
lib-fts: tokenizers - Fixed removal of trailing character in truncated tokens.
If the token is truncated, we don't want to remove the trailing character
since it's not actually there.
Also we don't want to remove trailing apostrophes from a truncated word,
because they're not actually at the end of the (untruncated) token there.
This doesn't make a big difference, but it's slightly more correct.
Timo Sirainen [Mon, 1 Jun 2015 18:35:39 +0000 (21:35 +0300)]
lib-fts: simple tokenizer minor cleanup - removed unnecessary token length > 0 check
fts_tokenizer_generic_simple_current_token() will check it in any case.
Timo Sirainen [Mon, 1 Jun 2015 18:27:09 +0000 (21:27 +0300)]
lib-fts: simple tokenizer cleanup - make prev_letter updating more explicit.
It was now hidden inside one of the functions, which didn't make the
prev_letter very consistent when a word break was found. It didn't actually
matter what the prev_letter was at that point, but now the behavior is more
consistent.
Teemu Huovila [Mon, 1 Jun 2015 15:35:58 +0000 (18:35 +0300)]
lib-fts: Change TR29 tokenizer to break at full stop (and others).
Diverge from the TR29 rules and always break at MidNumLet letters.
This fixes tokenizing first.last@domain.tld email addresses.
Timo Sirainen [Fri, 29 May 2015 18:39:33 +0000 (21:39 +0300)]
auth: Added %{passdb:field} and %{userdb:field} variables
The field expands to either the passdb or userdb extra field.
You can also use %{passdb:field:defaultvalue} where if field doesn't exist,
it's expanded to defaultvalue. Note that an empty value means that the field
still exists and it's not expanded to defaultvalue.