David Bremner [Mon, 17 Jul 2017 11:47:18 +0000 (08:47 -0300)]
util: make g_mime_utils_header_decode_date_unix match prototype
The problem shows up on 32 bit architectures where sizeof(time_t) !=
sizeof(gint64). Upcasting the 32 bit time_t to a 64 bit integer
should hopefully be safe.
David Bremner [Wed, 12 Jul 2017 10:48:18 +0000 (07:48 -0300)]
emacs: change default for notmuch-crypto-process-mime to t
There are some cases like remote usage where this might cause
problems, but those users can easily customize the variable. The
inconvenience seems to be outweighed by the security benefit for most
users.
config: deprecate/drop crypto.gpg_path under gmime 2.6/3.0
gmime 3.0 no longer offers a means to set the path for gpg.
Users can set $PATH anyway if they want to pick a
differently-installed gpg (e.g. /usr/local/bin/gpg), so this isn't
much of a reduction in functionality.
The one main difference is for people who have tried to use "gpg2" to
make use of gpg 2.1, but that isn't usefully co-installable anyway.
The reply-to munging code might behave differently whether there's an
exact match on the strings or not, or whether the string is a raw
addr-spec instead of an name-addr. These tests cover those variations
(i also had to tweak json output further below when this new test was
added).
David Bremner [Fri, 2 Jun 2017 23:57:01 +0000 (20:57 -0300)]
cli: make keyid from fingerprint in gmime 3.0
The "key_id" field seems to used for userid in gmime-3.0, while the
keyid is dropped in the fingerprint field if the full fingerprint is
not available.
We need to rewrite the loop for gmime-3.0; move the loop body to its
own function to avoid code duplication. Keep the common exit via
"goto DONE" to make this pure code movement. It's important to note
that the existing exit path only deallocates the iterator.
David Bremner [Sat, 1 Jul 2017 15:18:43 +0000 (12:18 -0300)]
cli/show: convert keyword options to booleans
There are two keyword options here that impliment boolean options. It
is simpler to use the built-in boolean argument handling, and also
more robust against divergence in parsing boolean and keyword arguments.
David Bremner [Thu, 8 Jun 2017 02:11:47 +0000 (23:11 -0300)]
lib/index: separate state table definition from scanner.
We want to reuse the scanner definition with a different table. This
is mainly code movement, and making the state table part of the filter
struct/class.
Piotr Trojanek [Fri, 16 Jun 2017 22:50:23 +0000 (23:50 +0100)]
fix leaks due to missing invocations of va_end
As the Linux man page states: "Each invocation of va_start() must be
matched by a corresponding invocation of va_end() in the same
function." Detected by cppcheck.
Damien Cassou [Mon, 12 Jun 2017 13:30:10 +0000 (15:30 +0200)]
Add Emacs' imenu support in notmuch-show and notmuch-search
Emacs' major modes can facilitate navigation in their buffers by
supporting Imenu. In such major modes, launching Imenu (M-x imenu)
makes Emacs display a list of items (e.g., function definitions in a
code buffer). Selecting an item from this list moves point to this
item.
This patch adds Imenu support to both notmuch-show and notmuch-search
buffers:
* in notmuch-show, Imenu will present a list of all messages in the
currently visible thread;
* in notmuch-search, Imenu will present a list of all messages in the
search buffer.
David Bremner [Sat, 27 May 2017 16:51:16 +0000 (13:51 -0300)]
test/thread-naming: remove excess escaping from sender address.
This is another case where the behaviour of gmime-2.6 and gmime-3.0
seems to differ. It may be that we prefer the more lax parsing of the
previous version, but that should be tested separately.
David Bremner [Sat, 27 May 2017 16:51:15 +0000 (13:51 -0300)]
cli/reply: fix two memory leaks, document a third
internet_address_list_to_string returns an allocated string, which
needs to be freed with g_free. g_free can handle a NULL argument, so
we follow the usage elsewhere of calling it unconditionally.
The third leak we leave as it would require restructuring of
add_recipients_from_message, and is fixed by later gmime-3.0 porting.
David Bremner [Sat, 27 May 2017 16:51:12 +0000 (13:51 -0300)]
cli/reply: direct all output for text format to gmime stream
Interleaving printfs with writes to the gmime stream worked when the
gmime stream was backed by the FILE *stdout, but that is no longer the
case. Create one stream and pass it into the two functions where
needed, as well well as replacing printfs with g_mime_stream_printf.
David Bremner [Sat, 27 May 2017 16:51:11 +0000 (13:51 -0300)]
util: convenience function to create gmime stream for stdout
It turns out that our use of GMimeStreamPipe has only succeeded
because gmime has been ignoring some seek failures; this will no
longer be the case in gmime 3.0, so we use a GMimeStreamPipe, which
does not assume seekability, wrapped in a buffering stream.
Mark Walters [Sat, 15 Apr 2017 15:49:46 +0000 (16:49 +0100)]
emacs: tree: bugfix: specify --format-version
Previously notmuch tree did not specify the format-version when
calling notmuch. This meant that when the structured output was
slightly changed (in commit 14c60cf168ac3b0f277188c16e6012b7ebdadde7)
stash filename broke. This fixes this breakage by specifying the
format-version.
Jani Nikula [Wed, 10 May 2017 19:42:12 +0000 (22:42 +0300)]
build: visibility=default for library structs is no longer needed
Commit d5523ead90b6 ("Mark some structures in the library interface
with visibility=default attribute.") fixed some mixed visibility
issues with structs. With the symbol default visibility reversed, this
is no longer a problem.
Jani Nikula [Wed, 10 May 2017 19:42:11 +0000 (22:42 +0300)]
build: switch to hiding libnotmuch symbols by default
The dynamic generation of the linker version script for libnotmuch
exports has grown rather complicated.
Reverse the visibility control by hiding symbols by default using
-fvisibility=hidden, and explicitly exporting symbols in notmuch.h
using #pragma GCC visibility. (We could also use __attribute__
((visibility ("default"))) for each exported function, but the pragma
is more convenient.)
The above is not quite enough alone, as it would "leak" a number of
weak symbols from Xapian and C++ standard library. Combine it with a
small static version script that filters out everything except the
notmuch_* symbols that we explicitly exposed, and the C++ RTTI
typeinfo symbols for exception handling.
Finally, as the symbol hiding test can no longer look at the generated
symbol table, switch the test to parse the functions from notmuch.h.
Jani Nikula [Wed, 10 May 2017 19:42:10 +0000 (22:42 +0300)]
compat: don't include compat.h from the feature test source
The feature test code should test the build environment, and none of
the compat code should interfere with that. Don't include compat.h
from the feature test source. There should be no functional changes
here, but this is just the right thing to do.
Jani Nikula [Wed, 10 May 2017 19:42:09 +0000 (22:42 +0300)]
build: do not export compat functions from lib
Commits 9db214527213 ("lib/gen-version-script.h: add getline and
getdelim to notmuch.sym if needed") and 3242e29e57ac ("build: add
canonicalize_file_name to symbols exported from libnotmuch.so")
started exporting compat functions from libnotmuch so that the cli
could use them. But we shouldn't export such functions from the
library. They are not part of our ABI. Instead, the cli should include
its own copies of the compat functions.
David Bremner [Wed, 8 Mar 2017 02:32:26 +0000 (22:32 -0400)]
lib: Add regexp expansion for for tags and paths
From a UI perspective this looks similar to what was already provided
for from, subject, and mid, but the implementation is quite
different. It uses the database's list of terms to construct a term
based query equivalent to the passed regular expression.
David Bremner [Wed, 22 Mar 2017 11:23:00 +0000 (08:23 -0300)]
test: add known broken test for indexing html
'quite' on IRC reported that notmuch new was grinding to a halt during
initial indexing, and we eventually narrowed the problem down to some
html parts with large embedded images. These cause the number of terms
added to the Xapian database to explode (the first 400 messages
generated 4.6M unique terms), and of course the resulting terms are
not much use for searching.
The second test is sanity check for any "improved" indexing of HTML.
Tomi Ollila [Sat, 8 Apr 2017 19:00:17 +0000 (22:00 +0300)]
Makefile.local: have all files in release tarball be owned by root
The tar content `git archive` creates (reproducibly) have owner and
group set to 'root'. (GNU) tar writes user ids to the added file
`version` by default. The contents of tar archive looks better and
more consistent when owner and group in all files are the same.
While at it, split this long command line to multiple lines.
Tomi Ollila [Sat, 8 Apr 2017 19:23:32 +0000 (22:23 +0300)]
configure: Be more verbose when compiler sanity checks fail
When configure could not get past initial compiler sanity check
the user was left with no explanation why this happened (usually
the reason is that compilers are not installed).
By printing the executed command line and re-executing it without
output redirection user gets better information how to proceed
(or ask for help) to resolve this problem.
The shell builtin 'printf' is used to print the executed command
line to ensure verbatim output.
David Bremner [Tue, 11 Apr 2017 02:25:39 +0000 (23:25 -0300)]
test: add 'lkml' corpus
These 210 messages are in several long threads, which is good for
testing our threading code, and may be useful just as a larger test
corpus in the future.