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.
David Bremner [Fri, 24 Mar 2017 22:52:51 +0000 (19:52 -0300)]
lib: handle empty string in regexp field processors
The non-field processor behaviour is is convert the corresponding
queries into a search for the unprefixed terms. This yields pretty
surprising results so I decided to generate a query that would match
the terms (i.e. none with that prefix) generated for an empty header.
David Bremner [Sun, 12 Mar 2017 17:24:52 +0000 (14:24 -0300)]
configure: change default bash completion location to /usr/share
At least Fedora and Debian now use
/usr/share/bash-completion/completions now. Apparently
/etc/bash_completion.d will be phased out at some point in the future.
David Bremner [Sat, 18 Mar 2017 02:23:51 +0000 (23:23 -0300)]
lib: only trigger phrase processing for regexp fields when needed
The argument is that if the string passed to the field processor has
no spaces, then the added quotes won't have any benefit except for
disabling wildcards. But disabling wildcards doesn't seem very useful
in the normal Xapian query parser, since they're stripped before
generating terms anyway. It does mean that the query 'from:"foo*"' will
not be precisely equivalent to 'from:foo' as it is for the non
field-processor version.
David Bremner [Fri, 17 Mar 2017 12:17:48 +0000 (09:17 -0300)]
test: add known broken tests wildcard search in from and subject
This was broken by the addition of regexp searching. The detection of
wildcards is not currently done in the recursive call to parse_query,
because of quoting issues.
David Bremner [Sun, 26 Feb 2017 21:21:34 +0000 (17:21 -0400)]
lib: replace deprecated n_q_count_messages with status returning version
This function was deprecated in notmuch 0.21. We re-use the name for
a status returning version, and deprecate the _st name. One or two
remaining uses of the (removed) non-status returning version fixed at
the same time
David Bremner [Sun, 26 Feb 2017 21:21:31 +0000 (17:21 -0400)]
lib: replace n_query_search_threads with status returning version
This function was deprecated in notmuch 0.21. We finally remove the
deprecated API, and rename the status returning version to the simpler
name. The status returning is kept as a deprecated alias.
David Bremner [Tue, 14 Mar 2017 11:10:07 +0000 (08:10 -0300)]
rename libutil.a to libnotmuch_util.a
Apparently some systems (MacOS?) have a system library called libutil
and the name conflict causes problems. Since this library is quite
notmuch specific, rename it to something less generic.
Jeffrey Stedfast [Thu, 16 Mar 2017 16:53:47 +0000 (16:53 +0000)]
fix memory leaks in notmuch-show.c:format_headers_sprinter()
Internet_address_list_to_string() and
g_mime_message_get_date_as_string() return allocated string buffers
and not const, so from what I can tell from taking a look at the
sprinter-sexp.c’s sexp_string() function, the code leaks the
recipients_string as well as the date string.
David Bremner [Sun, 12 Mar 2017 12:51:01 +0000 (09:51 -0300)]
lib: clamp return value of g_mime_utils_header_decode_date to >=0
For reasons not completely understood at this time, gmime (as of
2.6.22) is returning a date before 1900 on bad date input. Since this
confuses some other software, we clamp such dates to 0,
i.e. 1970-01-01.
John Byrnes [Sun, 12 Mar 2017 19:26:16 +0000 (21:26 +0200)]
emacs: use epg-gpg-program
Adjusted notmuch-crypto gpg call-process function to respect
the GPG program set by the EasyPG epg-gpg-program variable.
This is to correct a problem observed on NixOS where only gpg2 is
installed by default. The Notmuch Emacs frontend fails when trying to
access someone's key to verify their signature when it cannot find the
GPG binary.
Tomi Ollila [Sun, 12 Mar 2017 11:59:13 +0000 (13:59 +0200)]
fix out of tree build
In addition to use ${srcdir} and deliver ${NOTMUCH_SRCDIR} where needed,
source from ruby bindings had to be copied to the out-of-tree target
directory -- if the source files in source directory were referenced
in build and there were also built object files there, those could have
been considered as target files (and then not found when attempting
to create bindings/ruby/notmuch.so).
Tomi Ollila [Sun, 12 Mar 2017 11:59:12 +0000 (13:59 +0200)]
configure: add ${NOTMUCH_SRCDIR} -- absolute path to notmuch source
The ${srcdir} -- usually relative path to notmuch source -- works fine
in current ./configure and all makefiles. To have simple access to
notmuch source in tests and out of tree builds holding absolute path to
the source directory is useful.
Tomi Ollila [Wed, 4 Jan 2017 14:53:47 +0000 (16:53 +0200)]
test: atomicity.py: improve exit probability on failure
Some gdb python exceptions on some os environments (e.g. macOS
Sierra, non-codesigned gdb) do not make gdb exit (but to drop down
to nonexistent command line?).
Mitigate this chance by explict SystemExit on all exceptions.
The contents of output file 'gdb.out' is unchanged.
Tomi Ollila [Mon, 16 Jan 2017 18:04:48 +0000 (20:04 +0200)]
support make goals after initial {'', dist, data}clean goal(s)
Now make goal combinations starting with *clean goals,
ending with *clean coals, and having non-*clean goals in between
should work. What does not expected to work are
non-*clean - *clean - *non-clean goal combinations.
Also, if first goals are *clean goals, re-creation of Makefile.config
is inhibited when Makefile.config exists and ./configure is newer.
Jani Nikula [Fri, 6 Jan 2017 20:14:48 +0000 (22:14 +0200)]
cli/show: move formatter structs closer to where they're needed
The formatter structs are only needed for the formatter array
initialization. Move them closer to use. This also lets us drop some
forward declarations. No functional changes.
Jani Nikula [Fri, 6 Jan 2017 20:14:47 +0000 (22:14 +0200)]
cli/show: group --entire-thread option handling into one place
The --entire-thread option handling is split around, making the logic
harder to follow than necessary. Put it in one place. While at it,
make the true/false values match notmuch_bool_t values for
simplicity. No functional changes.
Jani Nikula [Fri, 6 Jan 2017 20:14:44 +0000 (22:14 +0200)]
cli/show: consistently use format_sel for checking the format
The mixed use of the format pointer and the format selection variables
is confusing. Add more clarity by using format_sel alone. No
functional changes.
Jani Nikula [Fri, 6 Jan 2017 20:14:43 +0000 (22:14 +0200)]
cli/show: remove unused raw member from show parameters struct
The raw member has been unused since b1130bc71c02 ("show: Convert raw
format to the new self-recursive style, properly support interior
parts"). Good riddance. No functional changes.
Jani Nikula [Fri, 6 Jan 2017 20:14:42 +0000 (22:14 +0200)]
cli/show: detangle overloading of params.part for single message display
The use of params.part has become rather convoluted in notmuch
show. Add another variable for selecting single message display to
make the code easier to read. No functional changes.
Tomi Ollila [Sun, 5 Mar 2017 21:03:27 +0000 (23:03 +0200)]
configure: removed $zlib_(cflags|ldflags) from compat code build
When pkg-config does not find configure, a compat version of the
zlib.pc is created. In creation of that configure attempted to
read values of $zlib_cflags and $zlib_ldflags. In the usual case
those were undefined, and with `set -a` now in the beginning of
configure, configure broke.
Even if $zlib_cflags and $zlib_ldflags had values which were used
to create zlib.pc, the values were overwritten (with static content)
a few lines later in next pkg-config --cflags and --libs run. These
values would not be different and probably useless -- the following
boild would probably fail.
But instead of using those, CPATH and LIBRARY_PATH environment
variables can be used successfully (both while configuring and
building).
Jani Nikula [Sun, 26 Feb 2017 13:43:01 +0000 (15:43 +0200)]
test: require test_begin_subtest before test_expect_code
Unify the subtests by requiring test_begin_subtest before
test_expect_code. (Similar change for test_expect_success has already
been done.)
This increases clarity in the test scripts by having a separate line
for the start of the subtest with the heading, and makes it possible
to simplify the test infrastructure by making all subtests similar.
Jani Nikula [Sun, 26 Feb 2017 13:43:00 +0000 (15:43 +0200)]
test: require test_begin_subtest before test_expect_success
Unify the subtests by requiring test_begin_subtest before
test_expect_success. (Similar change for test_expect_code will
follow.)
This increases clarity in the test scripts by having a separate line
for the start of the subtest with the heading, and makes it possible
to simplify the test infrastructure by making all subtests similar.
Jani Nikula [Sun, 26 Feb 2017 13:42:59 +0000 (15:42 +0200)]
test: drop the implicit prereq check mechanism from test_expect_*
The only place where we use the implicit prereq check is T000-basic.sh
where we check that it works. It's an added complication that we don't
use. Remove it.
The test_have_prereq function can still be used for the same effect in
subtests that use test_begin_subtest. For now, this will make it
impossible to have prereqs in one-line subtests that don't require
test_begin_subtest. This will be fixed in follow-up work.