notmuch
3 years agofix wrong printf formatting of signed/unsigned integers
Piotr Trojanek [Fri, 16 Jun 2017 22:50:25 +0000 (23:50 +0100)]
fix wrong printf formatting of signed/unsigned integers

3 years agoremove ineffective assignments
Piotr Trojanek [Fri, 16 Jun 2017 22:50:24 +0000 (23:50 +0100)]
remove ineffective assignments

Detected by cppcheck.

3 years agofix leaks due to missing invocations of va_end
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.

3 years agominor whitespace cleanups
Piotr Trojanek [Fri, 16 Jun 2017 22:50:22 +0000 (23:50 +0100)]
minor whitespace cleanups

3 years agoAdd Emacs' imenu support in notmuch-show and notmuch-search
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.

3 years agoMerge branch 'release'
David Bremner [Thu, 1 Jun 2017 10:54:38 +0000 (07:54 -0300)]
Merge branch 'release'

3 years agofixup! NEWS: news for 0.24.2 0.24.2 debian/0.24.2-1
David Bremner [Thu, 1 Jun 2017 10:32:10 +0000 (07:32 -0300)]
fixup! NEWS: news for 0.24.2

3 years agodebian: changelog for 0.24.2-1
David Bremner [Thu, 1 Jun 2017 10:25:56 +0000 (07:25 -0300)]
debian: changelog for 0.24.2-1

3 years agoNEWS: news for 0.24.2
David Bremner [Thu, 1 Jun 2017 10:19:46 +0000 (07:19 -0300)]
NEWS: news for 0.24.2

3 years agoversion: bump to 0.24.2
David Bremner [Thu, 1 Jun 2017 10:13:00 +0000 (07:13 -0300)]
version: bump to 0.24.2

3 years agocli/dump: don't include tags when not asked for
David Bremner [Mon, 8 May 2017 01:44:23 +0000 (22:44 -0300)]
cli/dump: don't include tags when not asked for

Add in the analogous test for tags that is given for properties a few
lines below.

3 years agotest: add known broken test --include=properties
David Bremner [Mon, 8 May 2017 01:44:22 +0000 (22:44 -0300)]
test: add known broken test --include=properties

Reported in [1], --include=properties currently implies
--include=tags, but it should not.

[1] id:87y3u8vjbo.fsf@tethera.net

3 years agotest: define GMime version dependant breakage
David Bremner [Sat, 27 May 2017 16:51:18 +0000 (13:51 -0300)]
test: define GMime version dependant breakage

We have some tests where the gmime 3 behaviour seems like a bug fix,
others where it's less clear, so we allow both possibilities.

3 years agoconfigure: add optional support for gmime-3.0
David Bremner [Sat, 27 May 2017 16:51:17 +0000 (13:51 -0300)]
configure: add optional support for gmime-3.0

This is only the changes to make configure work; it won't compile with
gmime-3.0 yet.

3 years agotest/thread-naming: remove excess escaping from sender address.
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.

3 years agocli/reply: fix two memory leaks, document a third
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.

3 years agoperf-test: add memory test for reply
David Bremner [Sat, 27 May 2017 16:51:14 +0000 (13:51 -0300)]
perf-test: add memory test for reply

Looking at the code for notmuch-reply, there seems to be several gmime
related memory leaks. This test is supposed to help eliminate those.

3 years agocli/show: use single stream for printf / gmime object output
David Bremner [Sat, 27 May 2017 16:51:13 +0000 (13:51 -0300)]
cli/show: use single stream for printf / gmime object output

This is again motivated by the need to transition away from
GMimeStreamFile for output to stdout.

format_part_mbox is left alone for now, as this cannot be mixed in
with output using gmime object output.

3 years agocli/reply: direct all output for text format to gmime stream
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.

3 years agoutil: convenience function to create gmime stream for stdout
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.

3 years agoemacs: with prefix argument, notmuch-show-stash-date stashes timestamp
Tomi Ollila [Sat, 8 Apr 2017 18:33:43 +0000 (21:33 +0300)]
emacs: with prefix argument, notmuch-show-stash-date stashes timestamp

Using timestamp of a message is useful in many Xapian queries.

3 years agoexit lingering gpg agents at the end of relevant tests
Tomi Ollila [Tue, 23 May 2017 18:54:25 +0000 (21:54 +0300)]
exit lingering gpg agents at the end of relevant tests

Since gnupg 2.1.20, gpg-agent no longer shut itself down when
$GNUPGHOME directory is removed.

Add exit hooks to the test modules which execute `gpgconf --kill all`

Add exit hooks to execute `gpgconf --kill all` in the modules that
create $GNUPGHOME for gpg to work with.

3 years agotest-lib.sh: add "atexit" functionality
Tomi Ollila [Tue, 23 May 2017 18:54:24 +0000 (21:54 +0300)]
test-lib.sh: add "atexit" functionality

New function at_exit_function registers given function to be called
at script termination.

Functions so registered are called in the reverse order of their
registration; no arguments are passed.

Function is called only once; re-adding with function name already
registered will remove previous registration.

New function rm_exit_function can be used to remove registration.

Modules (and possibly test-lib.sh functions) in future commits will
register such functions.

3 years agoMerge branch 'release'
David Bremner [Sat, 13 May 2017 11:51:10 +0000 (08:51 -0300)]
Merge branch 'release'

Emacs bug fix from Mark

3 years agoemacs: tree: bugfix: specify --format-version
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.

3 years agobuild: visibility=default for library structs is no longer needed
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.

3 years agobuild: switch to hiding libnotmuch symbols by default
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.

3 years agocompat: don't include compat.h from the feature test source
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.

3 years agobuild: do not export compat functions from lib
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.

3 years agolib: Add regexp expansion for for tags and paths
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.

3 years agolib: Add regexp searching for mid: prefix
David Bremner [Wed, 15 Feb 2017 12:58:28 +0000 (08:58 -0400)]
lib: Add regexp searching for mid: prefix

The bulk of the change is passing in the field options to the regexp
field processor, so that we can properly handle the
fallback (non-regexp case).

3 years agotest: add known broken test for indexing html
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.

3 years agoReplace index(3) with strchr(3)
Fredrik Fornwall [Thu, 6 Apr 2017 23:06:20 +0000 (01:06 +0200)]
Replace index(3) with strchr(3)

The index(3) function has been deprecated in POSIX since 2001 and
removed in 2008, and most code in notmuch already calls strchr(3).

This fixes a compilation error on Android whose libc does not have
index(3).

3 years agoemacs/notmuch.el: don't use 'function' as variable name.
David Bremner [Sat, 8 Apr 2017 17:03:29 +0000 (14:03 -0300)]
emacs/notmuch.el: don't use 'function' as variable name.

In principle this should work, but at least in some pre-release
versions of emacs26, this causes problems inside lexical let [1].

[1]: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26406

3 years agoMakefile.local: have all files in release tarball be owned by root
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.

3 years agoconfigure: Be more verbose when compiler sanity checks fail
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.

3 years agotest: add 'lkml' corpus
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.

3 years agotest: remove debugging "output"
David Bremner [Wed, 5 Apr 2017 00:36:30 +0000 (21:36 -0300)]
test: remove debugging "output"

3 years agotest: standardize argument order to test_expect_equal_file
David Bremner [Wed, 5 Apr 2017 00:36:29 +0000 (21:36 -0300)]
test: standardize argument order to test_expect_equal_file

It is annoying to debug failing tests when the interpretation of the
diffs is reversed for some tests.

3 years agoMerge branch 'release'
David Bremner [Sat, 1 Apr 2017 12:36:34 +0000 (09:36 -0300)]
Merge branch 'release'

Final 0.24.1 release

3 years agoNEWS: set release date 0.24.1 debian/0.24.1-1
David Bremner [Sat, 1 Apr 2017 12:29:38 +0000 (09:29 -0300)]
NEWS: set release date

3 years agoMerge branch 'debian' into release
David Bremner [Sat, 1 Apr 2017 12:20:44 +0000 (09:20 -0300)]
Merge branch 'debian' into release

Merge in changelog stanza from debian upload targeted at stretch

3 years agodebian: finalize changelog for 0.24.1-1
David Bremner [Sat, 1 Apr 2017 12:18:56 +0000 (09:18 -0300)]
debian: finalize changelog for 0.24.1-1

3 years agoNEWS: note dump header fix
David Bremner [Sat, 1 Apr 2017 12:15:30 +0000 (09:15 -0300)]
NEWS: note dump header fix

3 years agocli/dump: bump dump format version to 3
David Bremner [Fri, 31 Mar 2017 10:55:17 +0000 (07:55 -0300)]
cli/dump: bump dump format version to 3

No changes to the format of the body, but the header format was
fixed, and version 2 headers probably shouldn't be relied on.

3 years agocli/dump: fix bug in dump header
David Bremner [Tue, 28 Mar 2017 11:09:03 +0000 (08:09 -0300)]
cli/dump: fix bug in dump header

Fix copy paste error.

3 years agotest: add known broken test for dump header
David Bremner [Tue, 28 Mar 2017 11:09:02 +0000 (08:09 -0300)]
test: add known broken test for dump header

Apparently nobody uses the list of "what was included in the dump"

3 years agotest: add known broken test for dump header
David Bremner [Tue, 28 Mar 2017 11:09:02 +0000 (08:09 -0300)]
test: add known broken test for dump header

Apparently nobody uses the list of "what was included in the dump"

3 years agoMerge branch 'release'
David Bremner [Wed, 29 Mar 2017 23:58:34 +0000 (20:58 -0300)]
Merge branch 'release'

Another regexp search fix.

3 years agoNEWS: initial NEWS changes for 0.24.1
David Bremner [Sat, 25 Mar 2017 14:35:28 +0000 (11:35 -0300)]
NEWS: initial NEWS changes for 0.24.1

Also add a missed note to the 0.24 release notes.

3 years agolib: handle empty string in regexp field processors
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.

3 years agotest: add known broken test for null from: and subject: query
David Bremner [Fri, 24 Mar 2017 22:52:50 +0000 (19:52 -0300)]
test: add known broken test for null from: and subject: query

These queries currently fail with field processors enabled because the
code expects a non-empty string.

3 years agoconfigure: change default bash completion location to /usr/share
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.

3 years agoMerge branch 'release'
David Bremner [Sat, 25 Mar 2017 14:51:03 +0000 (11:51 -0300)]
Merge branch 'release'

wildcard search fixes, plus release busywork

3 years agodebian: start changelog for 0.24.1-1
David Bremner [Sat, 25 Mar 2017 14:22:55 +0000 (11:22 -0300)]
debian: start changelog for 0.24.1-1

3 years agoversion: bump to 0.24.1
David Bremner [Sat, 25 Mar 2017 14:20:56 +0000 (11:20 -0300)]
version: bump to 0.24.1

The release is not yet finalized, but start the busywork needed.

3 years agotests: add compatibility layer
Mikhail [Thu, 9 Mar 2017 13:32:43 +0000 (09:32 -0400)]
tests: add compatibility layer

Make test-lib-common.sh load test-lib-<$PLATFORM>.sh to create
additional shim for platform specifics.

Use test-lib-FREEBSD.sh to call GNU utilities instead of native ones.

- amended by db following Tomi's suggestions

3 years agolib: only trigger phrase processing for regexp fields when needed
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.

3 years agotest: add known broken tests wildcard search in from and subject
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.

3 years agodebian rename libnotmuch4 to libnotmuch5
David Bremner [Wed, 22 Mar 2017 12:00:20 +0000 (09:00 -0300)]
debian rename libnotmuch4 to libnotmuch5

follow the SONAME bump

3 years agopython: bump SOVERSION to 5
David Bremner [Wed, 22 Mar 2017 12:19:02 +0000 (09:19 -0300)]
python: bump SOVERSION to 5

Otherwise hilarity ensues when the python bindings try to use the new
API against the old shared library.

3 years agolib: make notmuch_query_add_tag_exclude return a status value
David Bremner [Sat, 18 Feb 2017 15:08:04 +0000 (11:08 -0400)]
lib: make notmuch_query_add_tag_exclude return a status value

Since this is an ABI breaking change, but we already bumped the SONAME
for the next release

3 years agolib: replace deprecated n_q_count_threads with status returning version
David Bremner [Sun, 26 Feb 2017 21:21:35 +0000 (17:21 -0400)]
lib: replace deprecated n_q_count_threads 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.

3 years agolib: replace deprecated n_q_count_messages with status returning version
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

3 years agolib: replace deprecated n_q_search_messages with status returning version
David Bremner [Sun, 26 Feb 2017 21:21:32 +0000 (17:21 -0400)]
lib: replace deprecated n_q_search_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.

3 years agolib: replace n_query_search_threads with status returning version
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.

3 years agolib: bump SONAME to libnotmuch5
David Bremner [Sun, 26 Feb 2017 21:21:30 +0000 (17:21 -0400)]
lib: bump SONAME to libnotmuch5

We plan a sequence of ABI breaking changes. Put the SONAME change in a
separate commit to make reordering easier.

3 years agodebian: changelog stanza for 0.23.7-2 debian/0.23.7-2
David Bremner [Sun, 19 Mar 2017 12:39:06 +0000 (09:39 -0300)]
debian: changelog stanza for 0.23.7-2

3 years agolib/message.cc: fix Coverity finding (use after free)
Tomi Ollila [Fri, 17 Mar 2017 22:28:48 +0000 (00:28 +0200)]
lib/message.cc: fix Coverity finding (use after free)

The object where pointer to `data` was received was deleted before
it was used in _notmuch_string_list_append().

Relevant Coverity messages follow:

3: extract
Assigning: data = std::__cxx11::string(message->doc.()).c_str(),
which extracts wrapped state from temporary of type std::__cxx11::string.

4: dtor_free
The internal representation of temporary of type std::__cxx11::string
is freed by its destructor.

5: use after free:
Wrapper object use after free (WRAPPER_ESCAPE)
Using internal representation of destroyed object local data.

(cherry picked from commit 06adc276682d1d5f73d78df2e898ad4191eb4499)

3 years agorename libutil.a to libnotmuch_util.a
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.

3 years agoMerge branch 'release'
David Bremner [Sun, 19 Mar 2017 00:02:42 +0000 (21:02 -0300)]
Merge branch 'release'

Merge in memory fixes

3 years agolib/message.cc: fix Coverity finding (use after free)
Tomi Ollila [Fri, 17 Mar 2017 22:28:48 +0000 (00:28 +0200)]
lib/message.cc: fix Coverity finding (use after free)

The object where pointer to `data` was received was deleted before
it was used in _notmuch_string_list_append().

Relevant Coverity messages follow:

3: extract
Assigning: data = std::__cxx11::string(message->doc.()).c_str(),
which extracts wrapped state from temporary of type std::__cxx11::string.

4: dtor_free
The internal representation of temporary of type std::__cxx11::string
is freed by its destructor.

5: use after free:
Wrapper object use after free (WRAPPER_ESCAPE)
Using internal representation of destroyed object local data.

3 years agocli/show: unref crlf filter.
David Bremner [Sat, 18 Mar 2017 17:46:42 +0000 (14:46 -0300)]
cli/show: unref crlf filter.

Mimic the handling of the other filter g_objects. This cleans up a
fair sized memory leak.

3 years agocli/show: fix usage of g_mime_content_type_to_string
David Bremner [Sat, 18 Mar 2017 17:33:50 +0000 (14:33 -0300)]
cli/show: fix usage of g_mime_content_type_to_string

It returns an "allocated string", which needs to be freed.

3 years agocli/show: fix some memory leaks in format_part_text
David Bremner [Sat, 18 Mar 2017 17:07:45 +0000 (14:07 -0300)]
cli/show: fix some memory leaks in format_part_text

Mimic Jeff Stedfast's changes to format_headers_sprinter, clean up use
of internet_address_list_to_string and
g_mime_message_get_date_as_string.

3 years agofix memory leaks in notmuch-show.c:format_headers_sprinter()
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.

3 years agoperf-test/mem: add simple memory tests for notmuch search
David Bremner [Sat, 18 Mar 2017 19:35:51 +0000 (16:35 -0300)]
perf-test/mem: add simple memory tests for notmuch search

Just copy and replace from the show tests. Currently these show no
major leaks.

3 years agoperf-test: add simple memory tests for notmuch-show
David Bremner [Sat, 18 Mar 2017 16:40:25 +0000 (13:40 -0300)]
perf-test: add simple memory tests for notmuch-show

These are probably too slow to run with the full corpus

3 years agoperf-test: use 'eval' in memory_run
David Bremner [Sat, 18 Mar 2017 16:34:32 +0000 (13:34 -0300)]
perf-test: use 'eval' in memory_run

This allows the use of redirection in the tests

3 years agotest-databases: use wget or curl to download test databases
Tomi Ollila [Sun, 12 Mar 2017 12:59:33 +0000 (14:59 +0200)]
test-databases: use wget or curl to download test databases

Often Linux systems are shipped with wget(1) by default (and no curl).

Many BSDs, macOS, and e.g. some Linux minimal/container images
comes with curl(1) (and no wget).

Attempting to download with curl if wget is not available increases
the likelihood for this to succeed.

3 years agolib: clamp return value of g_mime_utils_header_decode_date to >=0
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.

3 years agolib: add known broken test for parsing bad dates.
David Bremner [Sun, 12 Mar 2017 12:51:00 +0000 (09:51 -0300)]
lib: add known broken test for parsing bad dates.

This reproduces the symptoms of bug report
id:20150422065630.6330.90536@hoothoot

3 years agoemacs: use epg-gpg-program
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.

3 years agoMerge branch 'release'
David Bremner [Mon, 13 Mar 2017 01:43:11 +0000 (22:43 -0300)]
Merge branch 'release'

final 0.24 release

3 years agobuild: replace remaining uses of SHA1_FILE 0.24
David Bremner [Mon, 13 Mar 2017 01:31:16 +0000 (22:31 -0300)]
build: replace remaining uses of SHA1_FILE

oops. If only there was some editor facility that allowed replacing
all instances of a string.

3 years agodebian: changelog stanza for 0.24-1
David Bremner [Mon, 13 Mar 2017 01:15:05 +0000 (22:15 -0300)]
debian: changelog stanza for 0.24-1

3 years agoNEWS: set release date
David Bremner [Mon, 13 Mar 2017 01:10:36 +0000 (22:10 -0300)]
NEWS: set release date

3 years agoversion: bump to 0.24
David Bremner [Mon, 13 Mar 2017 01:08:54 +0000 (22:08 -0300)]
version: bump to 0.24

3 years agofix out of tree tests
Tomi Ollila [Sun, 12 Mar 2017 11:59:14 +0000 (13:59 +0200)]
fix out of tree tests

Use $NOTMUCH_SRCDIR/ instead of $TEST_DIRECTORY/../ (in those 2 places)
where reference to source directory instead of build directory is
required.

3 years agofix out of tree build
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).

3 years agoconfigure: add ${NOTMUCH_SRCDIR} -- absolute path to notmuch source
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.

3 years agolib/database: reduce try block scope to things that really need it
Jani Nikula [Sat, 17 Dec 2016 16:26:54 +0000 (18:26 +0200)]
lib/database: reduce try block scope to things that really need it

No need to maintain the pure C stuff within a try block, it's arguably
confusing. This also reduces indent for a bunch of code. No functional
changes.

3 years agotest: atomicity.py: improve exit probability on failure
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.

3 years agosupport make goals after initial {'', dist, data}clean goal(s)
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.

3 years agocli: do not initialize zero values with designated initializers
Jani Nikula [Fri, 6 Jan 2017 20:14:50 +0000 (22:14 +0200)]
cli: do not initialize zero values with designated initializers

Let the language initialize defaults to zero when some values are
initialized to non-zero values. No functional changes.

3 years agocli: simplify mime node walk
Jani Nikula [Fri, 6 Jan 2017 20:14:49 +0000 (22:14 +0200)]
cli: simplify mime node walk

The function is more straighforward to read when it's clear that the
only non-NULL return is at one place. No functional changes.

3 years agocli/show: move formatter structs closer to where they're needed
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.

3 years agocli/show: group --entire-thread option handling into one place
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.

3 years agocli/show: rename format_sel to simply format
Jani Nikula [Fri, 6 Jan 2017 20:14:46 +0000 (22:14 +0200)]
cli/show: rename format_sel to simply format

Now that the format pointer is a temporary variable, and named
formatter, shorten format_sel to format. No functional changes.

3 years agocli/show: use a table for choosing the formatter
Jani Nikula [Fri, 6 Jan 2017 20:14:45 +0000 (22:14 +0200)]
cli/show: use a table for choosing the formatter

Continue detangling format pointer and format selection variables. No
functional changes.