Commit graph

7131 commits

Author SHA1 Message Date
David Bremner
053a390370 test: known broken tests for trailing / in path search (infix)
In [1], David Edmondson observed that the trailing / added by many
completion mechanisms causes path searches to silently fail.  This
test reproduces that bug for both `path:' and `folder:' searches.

[1]: id:cunoasuolcv.fsf@gargravarr.hh.sledj.net
2022-01-27 07:48:27 -04:00
David Bremner
0756105832 test: sanitize generated message files names
It is fragile to encode the generated names into tests, as it makes
tests break when e.g. new tests are added.  There is a possibility
that this will hide certain failures; in that case meaningful filenames
should be chosen for the generated messages.
2022-01-27 07:48:27 -04:00
David Bremner
0a32741fce lib/parse-sexp: handle lastmod queries.
This particular choice of converting strings to integers requires C++11.
2022-01-26 07:41:02 -04:00
David Bremner
341016c8ec test/sexpr-search: add known broken tests for lastmod queries
These are loosely modelled on the tests just above for date ranges,
since the error conditions are similar. Some ideas also borrowed from
T570-revision-tracking.
2022-01-26 07:41:02 -04:00
David Bremner
77ab961a1d lib/parse-sexp: support actual date queries.
The default argument processing overlaps somewhat with what is already
done in _notmuch_date_strings_to_query, but we can give more specific
error messages for the s-expression context.

The extra generality of _sexp_parse_range will be useful when we
implement additional range prefixes (at least 'lastmod' is needed).
2022-01-26 07:41:02 -04:00
David Bremner
bf3cc5eed2 lib/date: factor out date range parsing.
This will allow re-using the same logic in the s-expression parser.
2022-01-26 07:41:02 -04:00
David Bremner
303f207a54 lib/parse-sexp: support zero argument date queries
These are not too practical, although they may simplify some user
query generation code. Mainly this adds a new prefix keyword to the
parser.
2022-01-26 07:41:02 -04:00
David Bremner
e02bf15a4f test/search: add known broken tests for 'date' prefix
This is documented, but apparently not implemented. Add tests for
planned supported syntax and error messages.
2022-01-26 07:41:02 -04:00
David Bremner
da302e1cba emacs: use cached encoded copy for fcc
This fixes the bug reported by dkg in [1]. The movement of the call to
n-m-setup-message-for-saving is so the cleanup of Fcc headers happens
in the encoded version (otherwise Fcc headers may be saved to disk).

[1]: id:87k1zm225v.fsf@fifthhorseman.net
2022-01-26 07:22:09 -04:00
David Bremner
8179c3d114 test/emacs: known broken test for matching fcc and sent message
Based on the method outlined by Daniel Kahn Gillmor in
id:87k1zm225v.fsf@fifthhorseman.net.  With a delay of 0.2 seconds the
test becomes flaky on my machine. With a 1 second delay it fails
consistently for more than 1600 iterations.
2022-01-26 07:22:09 -04:00
David Bremner
b559240bb1 test: define test_expect_equal_message_body
This is a relatively simple sed invocation, but rather than write a
comment everywhere, give it a descriptive name.
2022-01-26 07:22:09 -04:00
David Bremner
c8d292e25b test/emacs: match mml settings in emacs_{fcc,deliver}_message
This will allow the sending of signed messages via smtp in the test
suite.
2022-01-26 07:22:09 -04:00
David Bremner
3bf6487359 doc: document new option show.extra_headers
Increase discoverability by cross referencing from the notmuch-show
manual entry to the notmuch-config manual entry.
2022-01-25 07:51:48 -04:00
David Bremner
88633bc7a7 CLI/setup: special case single item lists
This matches the heuristic used by "notmuch config set" to decide if
something is a list.

This change fixes the bug reported at [1].

[1]: id:6O3LTUhoXlrnkPWCtPJCP4cagU7mFVEdyTpcC_37BoSzStlARXDBa7oczy6hB0jyjGjBQvgj_jFV58cw0aNx-jUg1h1O-FQ7820k68C0X4M=@protonmail.com
2022-01-24 09:32:39 -04:00
David Bremner
82e1279790 test/setup: add known broken test for single items
In [1] Ian observed that notmuch setup was inconsistent with notmuch
config set when adding single items, namely adding an unneeded
semi-colon at the end. This test replicates that bug.

[1]: id:6O3LTUhoXlrnkPWCtPJCP4cagU7mFVEdyTpcC_37BoSzStlARXDBa7oczy6hB0jyjGjBQvgj_jFV58cw0aNx-jUg1h1O-FQ7820k68C0X4M=@protonmail.com
2022-01-24 09:31:00 -04:00
jao
15207652a1 emacs: customizable names for search buffers
Customizable names for buffers presenting search results, via two
custom variables (notmuch-search-buffer-name-format and
notmuch-saved-search-buffer-name-format), defaulting to values
currently used for plain searches and including too tree and
unthreaded search buffers.

Amended by db: spelling fix.
2022-01-23 20:47:49 -04:00
David Bremner
21cce961b9 emacs: define, use option :disable-excludes for n-h-query-counts
Initially only use in notmuch-hello-insert-alltags. This is a more
narrow resolution of [1], which (unlike [2]) does not disable exclude
processing for regular saved searches.

[1]: id:87wox1vovj.fsf@len.workgroup
[2]: id:20220105010606.2034601-2-david@tethera.net
2022-01-23 14:27:06 -04:00
David Bremner
68640fd967 Revert "emacs: use --exclude=false when checking for empty searches"
Revert commit 8370e3cfe2, and remark the
corresponding test as broken. Also update the expected output of the
broken test to show excludes active in the user defined saved searches.
2022-01-23 14:21:46 -04:00
David Bremner
2786aa4d54 lib/database: delete stemmer on destroy
Commit [0] left the stemmer object accessible, but did not add
de-allocation code to notmuch_database_destroy. This commit corrects
that oversight.

Leak originally reported by Austin Ray [1].

[0]: 3202e0d1fe
[1]: id:20220105224538.m36lnjn7rf3ieonc@athena
2022-01-22 21:14:29 -04:00
David Bremner
df7c5acd75 lib/config: move g_key_File_get_string before continue
In [1] Austin Ray reported some memory leaks in
notmuch_database_open. One of those leaks is caused by jumping to the
next key without freeing val. This change avoids that leak.

[1]: id:20220105224538.m36lnjn7rf3ieonc@athena
2022-01-22 21:14:29 -04:00
David Bremner
8dab460a08 test: add known broken test for memory leaks in open
This duplicates the memory leaks reported in [1]

[1]: id:20220105224538.m36lnjn7rf3ieonc@athena
2022-01-22 21:14:29 -04:00
David Bremner
5620dc142e configure: check for ASAN support
This will allow conditionally running tests that use the address sanitizer.
2022-01-22 21:14:29 -04:00
David Bremner
cc180507b0 emacs: use --exclude=false when counting total messages
Even if a user excludes a large fraction of their messages, they still
nonetheless exist and are searchable.
2022-01-20 15:32:21 -04:00
David Bremner
8370e3cfe2 emacs: use --exclude=false when checking for empty searches
In particular tags that only occur on otherwise excluded messages do
not show up in "All tags" without this change. The reported numbers
_do_ take excludes into account, so it is possible that
searches (e.g. the aformentioned tags) will show up with a count of
zero.
2022-01-20 15:31:36 -04:00
David Bremner
704aa76f5d 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.

[1]: id:87wox1vovj.fsf@len.workgroup
[2]: id:m28t9faaim.fsf@guru.guru-group.fi
2022-01-20 15:31:29 -04:00
David Bremner
87d5a5a8aa CLI: print extra headers only for non-replies
If in the future we decide to output extra headers for replies, this
should be controlled by a separate configuration option.
2022-01-18 21:26:45 -04:00
David Bremner
2d036dbc3b 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.
2022-01-18 21:09:56 -04:00
David Bremner
c5cf92aa35 CLI: print extra headers in structured output
This is based on a patch from Johan Parin [1], which is in turn
responding to a bug report / feature requiest from Jan Malkhovski.

The update to the structured output documented in schemata is intended
to be upward compatible, so the format version stays the same

[1]: id:20191116162723.18343-1-johan.parin@gmail.com
[2]: id:87h8sdemnr.fsf@oxij.org
2022-01-18 08:11:06 -04:00
David Bremner
79936ac93e lib/config: add known config key "show.extra_headers"
Used in a following commit to enable including extra headers beyond
the default in structured output.
2022-01-18 08:09:14 -04:00
David Bremner
417d202e64 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.
2022-01-18 08:08:22 -04:00
David Bremner
78e6cf12c0 test: fix deprecation warning in symbol-test
Reduce the amount of noise in the build log.
2022-01-16 15:37:14 -04:00
David Bremner
6472dbf4b7 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.

[1]: id:87mwhifu9a.fsf@trouble.defaultvalue.org
[2]: id:87ios5v59p.fsf@nikula.org
2022-01-16 10:52:13 -04:00
David Bremner
fd6d50b38f 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.

[1]: id:87mwhifu9a.fsf@trouble.defaultvalue.org
2022-01-16 10:47:16 -04:00
David Bremner
fad2e7540b 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.
2022-01-15 15:59:39 -04:00
David Bremner
64212c7b91 lib/config: make sure the config map exists when loading defaults
We should not rely on one of the other "_notmuch_config_load_*"
functions being called before this one.
2022-01-15 15:59:27 -04:00
David Bremner
63b4c46983 lib/open: use notmuch->params to track split status
Persisting this status will allow us to use the information in other
compilation units, in particular when setting configuration defaults.
2022-01-15 15:53:31 -04:00
David Bremner
fd0edeb561 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).
2022-01-15 15:51:33 -04:00
David Bremner
237f803fdb 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.
2022-01-15 15:49:14 -04:00
David Bremner
c62ebcfea9 test/libconfig: save and restore config file
Currently the config file is unusable for further tests requiring a
valid database path.
2022-01-15 15:49:00 -04:00
LdBeth
c7c422ded2 emacs/notmuch-tag.el: add xmlns attribute to svg icons
emacs-mac that compiled with OS X system API for image display
support cannot correctly render svg without xmlns parameter [1].

[1]: id:tencent_127AA231767438AC66FEE4DDB4BBF51DF909@qq.com
2022-01-14 17:12:41 -04:00
David Bremner
f9d8f9c6ba Merge remote-tracking branch 'origin/release' 2022-01-12 13:25:29 -04:00
David Bremner
114b985ba7 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.
2022-01-12 13:22:51 -04:00
Michael J Gruber
21e206e8b9 configure: Ignore more options that Fedora spec macros expect
Signed-off-by: Michael J Gruber <git@grubix.eu>
2022-01-11 15:28:08 -04:00
jao
332b3b639e 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).
2022-01-10 08:03:40 -04:00
David Bremner
63d3b2b5cf notmuch 0.34.3 release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEkiyHYXwaY0SiY6fqA0U5G1WqFSEFAmHbOcMACgkQA0U5G1Wq
 FSEGVA//Vjgripk0eRDIUZrdL/knjDXybbHVz06r+gx+9Rh1b+3MJ8t+VAjeX7OO
 iJns7ZysKgMsQSYFCFk9fTl5m3ECzZFmzY7lmRU2tU6Hz9lUwotN70e+zGBgFE6J
 sGji4YOCrUnpmgb0j0joRD565m74Bi2Z8Pj+qRvo4RcQY5JxczyDtkSnLb9UDo/e
 FNZ4bTlwJL13Jeu8F6BtnCFPxvpac3qlzLIlG327Fz4cFwQ+QoxQIq5i8pnOu3B2
 HBEyOZAgIuONbV/RH/nwt7QmT45Dne1wP/UqocHkiu3yKvsCRLZC0vsejw8/dZ+D
 GQUfJT9EL1AIJa6OvUyF5UtnPMRKgACG2nt5U8M02ubheAAEgUS/FIIm1kgxkqYU
 5dDKHwU12YHDW2/nwOSRBFDV6TSCkskXr9Thr884KCobyPPnhWkN+pKAfyDhwPMc
 MrnMyId3fPrJRPMxoQ7Z8TJV8l/Wd6FIlFowfzk+s6hfV2qgOUZJ2Btrfk8596Sy
 np8usullbhFagYQ1+JX3AvVxLYvtFKmxO/qG6TcBmjBui5ABz7wtizfgwDx5eVJr
 GpzJUKFUKAmZW+15nm3oNdEwFOjdvRouKc03Qv5eCU6wSaOtd9efgntDPcso8ycW
 Us13KJIhwmwDJdaqnlmG5TdlJY9qjFu/VGHt4+I1GNQuswXRIo8=
 =hQCB
 -----END PGP SIGNATURE-----

Merge tag '0.34.3'

notmuch 0.34.3 release
2022-01-09 19:34:58 -04:00
David Bremner
51c287ead8 doc: add 2022 to copyright years. 2022-01-09 15:35:52 -04:00
David Bremner
a226b7a29b version: bump to 0.34.3 2022-01-09 15:35:12 -04:00
David Bremner
ad147c0205 debian: changelog for 0.34.3-1 2022-01-09 15:31:03 -04:00
David Bremner
9e62a0beaa NEWS: add NEWS for 0.34.3 2022-01-09 15:29:05 -04:00
David Bremner
8b737af28b 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.

[1]: id:87fsqijx7u.fsf@metapensiero.it
2022-01-09 15:16:51 -04:00