David Bremner [Wed, 5 Jan 2022 01:06:04 +0000 (21:06 -0400)]
test/emacs: add known broken test for hidden tags
Gregor Zattler observed that tags could be unintentionally hidden in
the "All tags" view, and Tomi Ollia worked out [2] that the issue was tags
that only occured on excluded messages. This test reproduces that bug.
David Bremner [Tue, 18 Jan 2022 13:39:05 +0000 (09:39 -0400)]
test/emacs: known broken test for reply with extra headers set.
Although it makes sense for the extra headers to be added to the copy
of the message headers included in the sexp/json, it is a bit
surprising for them to show in the new message constructed for the
reply, especially when, as here, they are always missing/empty.
David Bremner [Sat, 1 Jan 2022 12:01:34 +0000 (08:01 -0400)]
CLI: stash pointer to database in sprinter structs
We already use an allocated (and presumably open) database as a talloc
context. Keeping the pointer in the allocated struct will allow us to
e.g. interrogate the configuration in a sprinter function without
threading the database all the way through the various levels of function.
David Bremner [Sun, 26 Dec 2021 12:24:10 +0000 (08:24 -0400)]
cli/new: only ignore .notmuch at top level
Since the bug was first reported in [1], notmuch has gained the
ability to have the database located outside the mail root, hence this
this change differs slightly from Jani's proposed solution [2] in not
using notmuch_database_get_path, but rather the already retrieved
mail_root.
David Bremner [Sun, 26 Dec 2021 12:24:09 +0000 (08:24 -0400)]
test: add known broken test for ignoring non-toplevel .notmuch
In [1] Rob observed that notmuch new ignored directories called
.notmuch everywhere in the tree, where they should only (and now, with
split configs, at most) be ignored at the top level. Add a test to
demonstrate the problem.
David Bremner [Sat, 25 Dec 2021 13:33:05 +0000 (09:33 -0400)]
lib/open: no default mail root in split configurations
If we know the configuration is split, but there is no mail root
defined, this indicates a (lack of) configuration error. Currently
this can only arise in XDG configurations.
David Bremner [Sat, 25 Dec 2021 13:33:02 +0000 (09:33 -0400)]
lib/open: use db struct as talloc ctx for choose_database_path
The extra talloc struct "local" was left over from before the notmuch
struct was allocated earlier. Having the notmuch struct available in
this function will allow more flexibility to track the configuration
variations (e.g. split vs. non-split).
David Bremner [Sat, 11 Dec 2021 12:49:12 +0000 (08:49 -0400)]
test/libconfig: add two tests for the config = "" case
If notmuch_database_open_with_config finds a database, but that
database is not in a legacy, non-split configuration, then it
currently incorrectly deduces the mail root and returns SUCCESS. Add
to two tests to demonstrate this bug.
David Bremner [Tue, 11 Jan 2022 23:52:30 +0000 (19:52 -0400)]
test/gpgsm: use --with-colons when calculating fingerprint.
As stressed by the gpg documentation, the non-'with-colons' output
format is subject to change, and indeed it did in 2.3.x (x<=3). This
should make the the test suite more robust against such changes.
jao [Mon, 10 Jan 2022 03:05:23 +0000 (03:05 +0000)]
emacs: make header line in notmuch-show buffers optional
New notmuch-show-header-line customizable boolean to allow inhibiting
a header line in notmuch-show-mode buffers (for instance, because one
prefers to just include Subject in notmuch-message-headers).
David Bremner [Sat, 8 Jan 2022 21:21:43 +0000 (17:21 -0400)]
bindings/python-cffi: search for config by default
The previous (pre-0.34.2) constructor searched for a config file but
only if the database path was not specified, and only to retrieve
database.path. Neither of the available options (CONFIG.SEARCH or
CONFIG.NONE) matches this semantics exactly, but CONFIG.SEARCH causes
less breakage for people who relied on the old behaviour to set their
database.path [1]. Since it also seems like the friendlier option in
the long run, this commit switches to CONFIG.SEARCH as default.
This requires a certain amount of updating the pytest tests, but most
users will actually have a config file, unlike the test environment.
Cédric Hannotier [Thu, 16 Dec 2021 17:40:53 +0000 (18:40 +0100)]
completion: use mail_root for path completion in bash/zsh
Since mail store and database directory can be different,
path and folder completions must use the directory given by
database.mail_root, not by database.path.
David Bremner [Sat, 1 Jan 2022 14:36:43 +0000 (10:36 -0400)]
bindings/python-cffi: add matched property to message objects
Existing users of the legacy python bindings use
message.get_flags(Message.FLAG.MATCH) to determine which messages in a
thread matched. Since the bindings don't provide get_flags anymore,
they should provide a property analogous to the existing "excluded"
property.
David Bremner [Fri, 24 Dec 2021 18:29:05 +0000 (14:29 -0400)]
build: move {C,CXX}FLAGS to the end of FINAL_{C,CXX}FLAGS
In addition to avoiding problems with user specified include paths
picking up an installed version of notmuch.h, this should also enable
users to override more options (in particular they could override
warning options since the last one takes effect).
David Bremner [Fri, 24 Dec 2021 18:29:03 +0000 (14:29 -0400)]
build: move LDFLAGS after notmuch libraries.
In [1] Ryan Schmidt reported a problem on macports [2] with notmuch
finding an existing installed version of libnotmuch during the build
when the user specified LDFLAGS including the libnotmuch install
directory.
This change should prevent that.
LDFLAGS also occurs in FINAL_LIBNOTMUCH_LDFLAGS. The only built
library linked to that is util/libtnotmuch_util.a, and that passed as
explicit (relative) path, and is thus not affected by -L.
David Bremner [Sat, 25 Dec 2021 23:31:12 +0000 (19:31 -0400)]
emacs: update coolj-line-prefix-regexp to make space optional
Jani reported that lines prefixed with '>' (as opposed to '> ') are
not highlighted properly [1]. David E responded with a updated regex
[2]. This change implements David E's suggestion.
David Bremner [Thu, 23 Dec 2021 01:44:45 +0000 (21:44 -0400)]
configure: calculate NOTMUCH_BUILDDIR, write to Makefile.config
This will correct the current use of an undefined variable when
setting LD_LIBRARY_PATH in doc/Makefile.local
It is tempting to try to replace the use of test/export-dirs.sh, but
this is not as simple as it looks, as NOTMUCH_BUILDDIR is used to
locate sh.config, so probably cannot also sensibly be used to define
it.
David Bremner [Sat, 25 Dec 2021 21:22:56 +0000 (17:22 -0400)]
lib/open: do not consider .notmuch alone as an existing database.
It makes perfect sense for users to want to pre-create .notmuch,
e.g. to install hooks, so we should handle the case of a .notmuch
directory without an actual xapian database more gracefully.
David Bremner [Sat, 25 Dec 2021 21:22:55 +0000 (17:22 -0400)]
test/new: add known broken test for missing xapian directory.
`notmuch new' should go ahead and create the xapian database if it is
missing, even in the case where the parent .notmuch (or equivalent)
directory exists.
David Bremner [Sun, 26 Dec 2021 16:20:44 +0000 (12:20 -0400)]
test: test folder renames
In [1] Mark Walters reported a problem with messages being removed
from the database when the parent directory was renamed. Jani Nikula
proposed [2] these tests but observed
This test is not suitable for merging since it's not deterministic.
After applying Jani's patch [3], the tests now pass deterministically,
and could usefully act as regression tests.
David Bremner [Fri, 24 Dec 2021 16:20:31 +0000 (12:20 -0400)]
doc: add dep. on stamp file for rebuilding gzipped man pages.
In [1] Daniel observed that the gzipped man pages were only being
rebuild every second time when building with `make -j4'. This may be
caused by a race condition between sphinx-build rebuilding the roff
files and the recipe to gzip them. This commit sequentializes these
two steps by making the stamp file a prerequisite for (all of) the
gzip files.
Kyle Meyer [Sun, 5 Dec 2021 20:48:36 +0000 (15:48 -0500)]
emacs/tree: fix docstrings for author faces
The docstrings for notmuch-tree-match-author-face and
notmuch-tree-no-match-author-face incorrectly match the docstring of
notmuch-tree-match-date-face.
David Bremner [Sun, 5 Dec 2021 14:40:07 +0000 (10:40 -0400)]
test/emacs: mark one test as fixed in newer emacs.
The remaining problem in this test is fixed upstream in Emacs
28. While most people are using earlier versions of emacs, the test
still provides some documentation of a known bug.
David Bremner [Sat, 30 Oct 2021 20:48:55 +0000 (17:48 -0300)]
python-cffi: introduce stamp file
Although the rebuild does not take long, it is a bit noisy, so assume
if it succeeds once, it doesn't need to re-invoke setup.py until the
shared library is rebuilt. This is a partial fix for [1].
David Bremner [Sat, 30 Oct 2021 20:48:54 +0000 (17:48 -0300)]
ruby: don't use a directory as a target.
The directory is (neccesarily) not updated by the build, so it keeps
trying to build. The proposed fix is to use the name of the dynamic
library containing the extension. This is a partial fix for the
rebuilding reported at [1].
David Bremner [Sat, 23 Oct 2021 17:05:24 +0000 (14:05 -0300)]
emacs: don't add space to tag completion candidates.
Apparently this messes up various third party completion
frameworks. This change does mean that users will have to hit space
after completing a tag change in order to enter another change.
As a bonus, remove the call to #'delete, since
completing-read-multiple already promises to remove empty strings.
David Bremner [Mon, 25 Oct 2021 01:15:14 +0000 (22:15 -0300)]
test/count: replace use of gdb with a LD_PRELOAD shim
There is a certain amount of boilerplate to pass the call on the
original function, so abstract it out as a C preprocessor macro, plus
some extra includes in notmuch-test.h
David Bremner [Thu, 30 Sep 2021 18:59:54 +0000 (15:59 -0300)]
lib/config: use g_key_file_get_string to read config values
Unlike the previous g_key_file_get_value, this version processes
escape codes for whitespace and \. The remaining two broken tests from
the last commit are because "notmuch config get" treats every value as
a list, and thus the previously introduces stripping of leading
whitespace applies.
David Bremner [Thu, 30 Sep 2021 18:28:34 +0000 (15:28 -0300)]
test: known broken tests for escape characters in config files.
glib generates the following escape characters with their usual
meanings: \n, \t, \r, and \\, along with \s for _leading_
spaces. Currently notmuch fails to unescape these on reading the
config files. These tests demonstrate this bug; the one new test that
passes is because apparently glib only escapes tabs at the beginning
of a key.
David Bremner [Thu, 30 Sep 2021 17:17:48 +0000 (14:17 -0300)]
config: ignore leading/trailing spaces in ';'-delimited lists
In [1] Ciprian observed that it was easy for users to mistakenly
introduce leading and trailing space to new.tags when editing a
notmuch config file. This commit strips spaces on either side of the
';' delimiter when splitting.
In principle it would be possible to support tags (or other config
values) with leading or trailing spaces by processing '\s' escapes in
the input string. Currently such processing is not done.
David Bremner [Mon, 13 Sep 2021 01:03:50 +0000 (22:03 -0300)]
emacs: run notmuch-search-hook lazily
In message id:YT3ueuZHKW931NW3@localhost, Fabio Natali isolated a
visual glitch caused by running notmuch-search-hook too early. This
change moves the running of that hook to
notmuch-search-process-filter, which ensures there is some output in
the buffer before running the hook. Since n-s-p-f can be called many
times for a given buffer, add a buffer local flag to make sure it is
only run once per buffer.
David Bremner [Sat, 30 Oct 2021 16:22:35 +0000 (13:22 -0300)]
python-cffi: switch to notmuch_database_{open,create}_with_config
Since release 0.32, libnotmuch provides searching for database and
configuration paths. This commit changes the python module notmuch2 to
use those facilities.
This fixes the bug reported in [1], along with a couple of the
deprecation warnings in the python bindings.
Database.default_path is deprecated, since it no longer faithfully
reflects what libnotmuch is doing, and it is also no longer used in
the bindings themselves.
This commit choose the default of config=CONFIG.EMPTY (equivalent to
passing "" to notmuch_database_open_with_config). This makes the
change upward compatible API-wise (at least as far as the test suite
verifies), but changing the default to CONFIG.SEARCH would probably be
more convenient for bindings users.
David Bremner [Thu, 28 Oct 2021 01:34:19 +0000 (22:34 -0300)]
lib/config: don't overwrite database.path if the caller passed it
If the user passed a path, and we opened it, then we consider that
definitive definition of "database.path". This makes libnotmuch
respond more gracefully to certain erroneous combinations of
NOTMUCH_CONFIG settings and config file contents.
David Bremner [Thu, 28 Oct 2021 01:34:17 +0000 (22:34 -0300)]
test: add known broken test for conflict with database parameter
This is arguably user error: having configuration file with bad
settings in it (and/or having a bad NOTMUCH_CONFIG environment
variable). On the other hand returning a different path than was
actually opened is definitely a bug.
David Bremner [Sat, 30 Oct 2021 18:49:20 +0000 (15:49 -0300)]
rename built_with.sexpr_query to built_with.sexp_queries
It is confusing to use two different names (sexp vs sexpr) when
compared with the command line option --query=sexp and (furthermore)
singular vs plural when compared with the man page title.
David Bremner [Mon, 11 Oct 2021 11:19:21 +0000 (08:19 -0300)]
emacs: add minimal docstring for notmuch-unthreaded
The missing docstring causes a blank in the notmuch-help display
[1]. Since the function is a simple wrapper for notmuch-tree, it seems
fair to forward the reader there for more detailed information.
David Bremner [Sat, 23 Oct 2021 13:22:37 +0000 (10:22 -0300)]
lib/load_config: document expectations for db on error, add tests
This is a bit different than n_d_{open,create}_with_config, since
there are several non-zero status codes where we do want to return a
non-NULL database structure.
David Bremner [Sat, 23 Oct 2021 13:22:36 +0000 (10:22 -0300)]
lib/create: fix memory leak, ensure *database=NULL on error
This code previously relied on _finish_open to free the notmuch struct
on errors (except for the case of database == NULL, which was a
potential double free). When we removed those frees from _finish_open,
we introduced a (small) memory leak.
In this commit, fix the memory leak, and harmonize the on-error
behaviour with n_d_open_with_config.
David Bremner [Sat, 23 Oct 2021 13:22:34 +0000 (10:22 -0300)]
lib/open: fix potential double-free, ensure *database=NULL on error
During refactoring for 0.32, the code that set notmuch=NULL on various
errors was moved into _finish_open. This meant that the the code which
relied on that to set *database to NULL on error was no longer
correct. It also introduced a potential double free, since the notmuch
struct was deallocated inside _finish_open (via n_d_destroy).
In this commit we revert to "allocator frees", and leave any cleanup
to the caller of _finish_open. This allows us to get back the
behaviour of setting *database to NULL with a small change. Other
callers of _finish_open will need free notmuch on errors.
David Bremner [Sat, 23 Oct 2021 13:22:33 +0000 (10:22 -0300)]
test: add two known broken tests for missing config files
The documentation claims that the database will be set to NULL in this
case, but it is currently not happening. Based on a reproducer [1]
from Austin Ray.