Commit graph

7006 commits

Author SHA1 Message Date
David Bremner
8f0b84789d 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.
2021-10-30 13:49:37 -03:00
David Bremner
2ba50b5230 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.
2021-10-30 13:47:47 -03:00
David Bremner
f3fcdd2dda lib/create: document expectations for db on error, add tests
It seems sensible to harmonize the behaviour with
n_d_open_with_config. In this commit we just assert the desired
behaviour.
2021-10-30 13:45:40 -03:00
David Bremner
74c4ce6d88 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.
2021-10-30 13:43:58 -03:00
David Bremner
a942cb8ee3 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.

[1]: id:20211021190401.imirxau2ewke6e2m@athena
2021-10-30 13:42:16 -03:00
David Bremner
fb02817943 lib: document n_o_w_config can return NOTMUCH_STATUS_NO_CONFIG
This should be treated as fatal by callers, since we didn't succeed in
opening a Xapian database.
2021-10-30 13:41:57 -03:00
David Bremner
d6e4ca6a7a NEWS: fix typo in 0.34 news.
Thanks to jrm on IRC for finding the typo.
2021-10-27 22:06:36 -03:00
David Bremner
e2b842afb1 test/libconfig: use 'export' when restoring NOTMUCH_CONFIG
This is required when NOTMUCH_CONFIG has been unset, and is harmless
otherwise.
2021-10-27 22:05:45 -03:00
David Bremner
f25e48e023 NEWS: set date 2021-10-20 11:25:35 -03:00
David Bremner
95fc947f94 debian: changelog for 0.34 2021-10-20 11:16:03 -03:00
David Bremner
35c625cb97 add NEWS for remaining changes 2021-10-20 10:51:06 -03:00
David Bremner
7b490b4b80 version: bump to 0.34 2021-10-20 10:42:18 -03:00
David Bremner
0cab538778 NEWS: update sexp-query news 2021-10-20 10:42:18 -03:00
Doug Woos
175476d1d1 emacs: fix call to nonexistent notmuch--call-process-shell-command
Looks like a find/replace error in e722b4f4
2021-10-19 08:43:14 -03:00
David Bremner
0f196b5659 debian: add dependency on libsexp-dev
Enable the s-expression query parser in Debian.
2021-10-15 08:52:32 -03:00
David Bremner
603a9992e0 debian: add changelog for 0.34~rc0 2021-10-15 08:51:55 -03:00
David Bremner
40897af1fc INSTALL: document optional dependency on libsfsexp
For now putting it in the apt-get line will cause complaints about
missing packages for too many people.
2021-10-15 08:49:01 -03:00
David Bremner
d3d4c2804a NEWS: stub news for 0.34~rc0
This is mostly to pacify the release checks. NEWS will be filled in
during the release process.
2021-10-15 08:43:29 -03:00
David Bremner
8383b6cb3a lib: bump lib minor version to 5
One new function (and an enum) was added to the API/ABI.
2021-10-15 08:34:39 -03:00
David Bremner
1c932cd5e0 debian: add new function to symbols file 2021-10-15 08:34:09 -03:00
David Bremner
5ad946310d version: bump to 0.34~0
Start release process for 0.34.
2021-10-15 08:28:59 -03:00
David Bremner
bc91954ee0 debian: install notmuch-sexp-queries man page
This was missed in the series that added the sexp-query parser and
docs.
2021-10-12 08:20:09 -03:00
David Bremner
174ec2a28f configure: whitespace cleanup
In order to make it easier to keep the whitespace consistent in the
configure script, use the same style defined in devel/STYLE for
C/C++.

  Specifically, a line should begin with zero or more tabs followed
  by fewer than eight spaces.

Presumably this will be no more difficult for people editing configure
than for people editing the C and C++ code.
2021-10-10 20:58:29 -03:00
David Bremner
a4b1c39331 devel: script for checking a commit (series)
'check-notmuch-commit' is an updated version of a script I have been
using (although not always as consistently as I should) before sending
patches to the list.

Although it requires a bit more tooling, encouraging people to use
check-notmuch-commit might reduce the number of round trips to the
list for style nitpicks.
2021-10-10 20:55:09 -03:00
David Bremner
6e050de4c0 configure: check explicitely for python dev (include) files
As discussed at [1] we have received reports that the implicit check
using cffi.FFI().verify() is not reliable in all environments. Since
we already use pkg-config, and the python dev package should include a
.pc file [2], add an extra check using pkg-config.  On at least
Debian, we have to know which version of python dev files with are
looking for, so calculate that first.

[1]: id:87im1g35ey.fsf@tethera.netid:87im1g35ey.fsf@tethera.net,
[2]: checked on Debian and Fedora
2021-10-09 16:39:06 -03:00
David Bremner
3e2e724d53 notmuch 0.33.2 release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEkiyHYXwaY0SiY6fqA0U5G1WqFSEFAmFVoPUACgkQA0U5G1Wq
 FSGSzg//WY202qUibO6pgFMPvgpYCB5g9Bq2lSzEcJzc2ZqZIH/3WvFSUeHMrInb
 GmHzJ4Q1w00K/wyB8MLYILKJ5/Tikg+O63/YkZMjXx6CDwu9zyNdk3L7TuZjkiOB
 rRiCPlEO7vvzUKedyecpY07DpgCYku1R9eOk032aSZEdOVheXIUUwDcR/cSFhxjO
 9amPls9vjZXKOQjOH8dgbxyZX8JbcTECgwYoFCT1k88NrVXdcGc3ds/ZuJowf2S7
 rIOLCZVuJD0yPGtMUBMHr5bRJ4O6e4NsHLNOgELFid3WXmQ3TzrRBDuJX5rDaaOs
 +0aqFWS57lujZLF+dZbZAYqK9CnQxZct+Au8GJlvvHZUBnS2skTTK8zu4NuGmgh0
 wckeesSXImC/NxHP/HaRNvcmrOUPTWYr3SaNKAbAl6zSjkhgzYxMnTnAFev+7HAc
 TNa50iLfMYaM0lyzD5gzhZZKvk68wwi1bxxhNMmfOF94HTjKOvL1AWxPoQkYUNN8
 07yvxURcZHwng+ufIfr/XsTDleiqSkYRJFtkpyP6+ZoYrIj815qtqQ03lzJTcYRn
 wMv3ipMrLuYMeP8T3Pr0y8DEl2WVPRyybYbN+07SkQLULzmjBhivxn3abSRqOFKm
 zDn6XiY3BMhTOPaslVIxZdP/8k7fA7Ak5qTVkXLZCPMZiV36k0w=
 =mwj4
 -----END PGP SIGNATURE-----

Merge tag '0.33.2'

notmuch 0.33.2 release
2021-09-30 08:58:48 -03:00
David Bremner
3c60a25c6d version: bump to 0.33.2 2021-09-30 08:28:49 -03:00
David Bremner
f32f8113cb debian: changelog for 0.33.2-1 2021-09-30 08:27:37 -03:00
David Bremner
cc2a3dc1d7 NEWS: update for 0.33.2 2021-09-30 08:25:11 -03:00
David Bremner
4760b4470c test/T355-smime: Use key as exported by gpgsm
As reported in id:87h7pxiek3.fsf@tethera.net, the previous version of
the test is flaky. There is some so-far undebugged interaction between
openssl and gpgsm that causes the keys to fail to import. As a
potential workaround, use the key as exported by gpgsm, and eliminate
openssl from this particular pipeline.
2021-09-29 20:04:31 -03:00
jao
81cbffa65f emacs: notmuch-tree: customizable strings for drawing trees
New customizable variable, notmuch-tree-thread-symbols, that allows
tweaking of how trees in a forest are represented.  For instance, one
can now choose to use an hyphen rather than a white space as a prefix,
or replace the character(s) used to draw arrows.

Amended-By: db; delete errant '3'
2021-09-20 20:39:28 -03:00
David Bremner
21e365f51a test/emacs: tests for notmuch-{tree,unthreaded} with bad CWD
These work thanks to the previous wrapping of process creation
primitives.
2021-09-11 11:11:29 -03:00
David Bremner
e722b4f48c emacs: wrap call-process
Provide safe working directory
2021-09-11 11:11:29 -03:00
David Bremner
9fe36d7dc7 test/emacs: test for notmuch-show with nonexistent CWD
Somewhat predictably, the other code path in
notmuch-call-notmuch--helper also needs to be fixed.
2021-09-11 10:30:25 -03:00
David Bremner
eb226437e1 emacs: wrap make-process
Provide a safe working directory.
2021-09-11 10:27:38 -03:00
David Bremner
88224bde62 test/emacs: test for notmuch-search with nonexistent CWD
(At least) notmuch-start-notmuch needs to be updated to set a safe
working directory.
2021-09-11 10:22:24 -03:00
David Bremner
5e5f2122f9 emacs: wrap call-process-region
As with notmuch--process-lines, initial purpose is to provide a safe
binding for default-directory. This is enough to make notmuch-hello
robust against non-existent or corrupt values default-directory, but
probably not other views.
2021-09-11 10:19:27 -03:00
David Bremner
a890241138 emacs: wrap process-lines
Initially just set the working directory, to avoid (the implicit)
call-process crashing when the default-directory points to a
non-existent location.

Use of a macro here is over-engineering for this change, but the same
change needs to be applied to several other process creation
primitives.
2021-09-11 10:16:47 -03:00
David Bremner
06477bce03 test/emacs: run notmuch-hello with a nonexisting default dir
This replicates the problem reported in Debian bug #922536.
2021-09-11 10:13:22 -03:00
David Bremner
59d0d5a489 test/emacs: provide macro test-log-error
Because of the way emacs reports errors, a test form can crash and not
change the main buffer. To work around this, capture both signalled
errors and any other messages.
2021-09-11 10:10:16 -03:00
David Bremner
7556bb7da2 notmuch 0.33.1 release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEkiyHYXwaY0SiY6fqA0U5G1WqFSEFAmE7RAYACgkQA0U5G1Wq
 FSHDHA//Q5SJhT9fD/yi2QOI4zIHvF438WtAGIL+TnYIeY8lDmdYZaRjU9Ub4O3J
 eLxJMhNcOyY35nDEGOOVga33aS8lefI+q/Ozx5sNzSge9PRaha+hGAmY2UrkOm+z
 TQBjFsdnGyWdTmJbkC9VQsaQJWjeKUKM0J4eT/sWFrJfW9vHuGnzrEnpOTQu8xk1
 OWshsYc5AkMnnvUBv0JuCJ4z4HQkTHeMrMKwd+B0/SC4OxPQ/af6FaMkoKanH0Ej
 q661AaZW+WNupynS1nu/O99z5U4BJ1V7nz361degdINfaUh/vmcXgHN7jGeoFtj4
 rTjV/51Jy/5WCbYV+11a0+RMZOEoQZi4ZBai6E6WVHpztkDXXqxHyDnho+A4SYK9
 1G/Rs6lO9FYRLTvdYhJbLH4OZgglPWXFgWJJxGLY+5cM7d86g8LC2pbJGWZ5IbAW
 eB3LRFStaqsBqjx9noxt9BcdxmbEu4o7lCm6y+EdAD04X37MGvv+Mlwsz57EMG9c
 2NCntrc1BUUTb/7mCp6oZn0miPCmYFVLtTj0ZfLAdP89aLJVTn6a36uTv8NqcszR
 ZjBFqGxB9AMU0idTEHnHJ5acNj4bLPwDBPBGYmEWnky/Tn7ZT3XqEDVvOXY2HVwa
 0RkVsgMsUIqUXutXjUYlLcl4YgmgpTsRbVpMZJh0/R4N9spDyWU=
 =P0Xd
 -----END PGP SIGNATURE-----

Merge tag '0.33.1'

notmuch 0.33.1 release
2021-09-10 21:02:10 -03:00
David Bremner
8e59438025 debian: drop debian specific test exclusion
In principle these tests should pass now.
2021-09-10 08:30:24 -03:00
David Bremner
b5c6fdd480 debian: changelog for 0.33.1-1 2021-09-10 08:30:07 -03:00
David Bremner
76ec0b409f NEWS: update for 0.33.1 2021-09-10 08:28:04 -03:00
David Bremner
c6524148fc version: bump to 0.33.1 2021-09-10 08:21:28 -03:00
David Bremner
060ff57642 lib: use 'localhost' rather than fqdn for default mail address.
As discussed in the thread starting at [1], the fully qualified domain
name is a bit tricky to get reproducibly, might reveal information
people prefer to keep private, and somewhat unlikely to provide
reliable mail routing.

The new approach of $current_username@localhost is better for the
first two considerations, and probably at least as good as a test mail
address.

[1]: id:87sfyibqhj.fsf@tethera.net
2021-09-10 08:17:06 -03:00
David Bremner
dc8262bd33 test/emacs: test for functions in notmuch-search-result-format.
Based on the commit message in id:20210221151902.2301690-3-dme@dme.org

Add the function notmuch-test-result-flags to test-lib.el to avoid
repeating it in 3 T*.sh files.
2021-09-08 23:01:02 -03:00
David Edmondson
17bfc25bb3 emacs: Allow functions in notmuch-{tree,unthreaded}-result-format
If the car of an element in notmuch-tree-result-format or
notmuch-unthreaded-result-format is a function, insert the result of
calling the function into the buffer.
2021-09-08 23:00:45 -03:00
David Edmondson
4f4ec48df2 emacs: Allow functions in notmuch-search-result-format
If the car of an element in notmuch-search-result-format is a
function, insert the result of calling the function into the buffer.

This allows a user to generate custom fields in the output of a search
result. For example, with:

(defun -notmuch-result-flags (format-string result)
  (let ((tags-to-letters '(("flagged" . "!")
			   ("unread" . "u")
			   ("mine" . "m")
			   ("sent" . "s")
			   ("replied" . "r")))
	(tags (plist-get result :tags)))

    (format format-string
	    (mapconcat (lambda (t2l)
			 (if (member (car t2l) tags)
			     (cdr t2l)
			   " "))
		       tags-to-letters ""))))

(setq notmuch-search-result-format '((-notmuch-result-flags . "%s ")
				     ("date" . "%12s ")
				     ("count" . "%9s ")
				     ("authors" . "%-30s ")
				     ("subject" . "%s ")
				     ("tags" . "(%s)")))

The first few characters on each line of the search result are used to
show information about some significant tags associated with the
thread.
2021-09-08 22:59:48 -03:00
David Edmondson
071fb57a35 emacs: Use pcase in notmuch-search-insert-field
Rather than lots of string-equal calls, use the pcase macro.
2021-09-08 22:59:25 -03:00