Commit graph

6860 commits

Author SHA1 Message Date
David Bremner
b3258244c8 lib/open: restore default database path of $HOME/mail
Although this default worked for "notmuch config get", it didn't work
most other places. Restore the previous functionality, with the
wrinkle that XDG locations will shadow $HOME/mail if they exist.

This fixes a bug reported by Jack Kamm in id:87eeefdc8b.fsf@gmail.com
2021-05-15 08:40:05 -03:00
David Bremner
0e8795b28c NEWS: add NEWS for notmuch-{before,after}-tag-hook fixes 2021-05-15 08:38:23 -03:00
Kyle Meyer
319dcfb50e emacs: restore tag-changes and query bindings for tag hooks
notmuch-before-tag-hook and notmuch-after-tag-hook are supposed to
have access to two dynamic variables, tag-changes and query, but these
were lost with the switch to lexical binding in fc4cda07 (emacs: use
lexical-bindings in all libraries, 2021-01-13).

Add a variant of Emacs's dlet (not available until Emacs 28) and use
it in notmuch-tag to expose tag-changes and query to the hooks.
2021-05-15 08:34:28 -03:00
David Bremner
a663783343 test: add known broken tests for notuch-{before,after}-tag-hook
These tests illustrate the bug reported in id:87v97ytd2s.fsf@fastmail.fm
2021-05-15 08:31:00 -03:00
David Bremner
ccd2ef3871 CLI: add missing file notmuch-client-init
This file should have been created in commit 5a8d174f, but wasn't.
2021-05-15 08:14:37 -03:00
David Bremner
121f9ddad3 CLI/notmuch: make immutable tables const
Let the compiler enforce the immutability.
2021-05-14 06:44:00 -03:00
David Bremner
0c6569d97c CLI: make static message strings const
This is both a bit clearer and avoids the possibility of modification.
2021-05-14 06:42:55 -03:00
David Bremner
19983fe554 CLI/config: make immutable tables const
Let the compiler help us catch bugs.
2021-05-14 06:41:51 -03:00
David Bremner
5a8d174f67 CLI: centralize initialization in notmuch_client_init
Initially make sure gmime_filter_reply initialization is
thread-safe (assuming notmuch_client_init is only called once).
For tidyness, also put talloc initialization in the new function.
2021-05-14 06:40:37 -03:00
David Bremner
b1b6798588 lib/message: mark flag2tag as const
This table is intended to be immutable
2021-05-14 06:39:12 -03:00
David Bremner
929386fad9 lib/generate_thread_id: move static buffer to notmuch_database_t
Work towards the goal of concurrent access to different Xapian
databases from the same process.
2021-05-14 06:38:19 -03:00
David Bremner
8410be8e08 lib: make glib initialization thread-safe
In principle this could be done without depending on C++11 features,
but these features should be available since gcc 4.8.1, and this
localized usage is easy to replace if it turns out to be problematic
for portability.
2021-05-13 22:21:57 -03:00
Felipe Contreras
a34d7b4144 ruby: improve general data get helper
There's no need to do Check_Type, Data_Get_Struct calls
rb_data_object_get(), which already does that.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-12 19:13:31 -03:00
Felipe Contreras
2e57ffb860 ruby: improve all Data_Get_Notmuch_* helpers
There's no need to repeat the same code over and over.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-12 19:13:12 -03:00
Felipe Contreras
75738758f9 ruby: add missing Data_Get_Notmuch helpers
Apparently commit 5c9e3855 (ruby: Don't barf if an object is destroyed
more than once, 2010-05-26) missed these two.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-12 19:13:02 -03:00
David Bremner
25da4a1340 Merge branch 'release' 2021-05-12 08:42:28 -03:00
David Bremner
267365b711 NEWS: add note about fix to notmuch_database_reopen 2021-05-12 08:40:13 -03:00
David Bremner
393c92b042 lib/notmuch_database_reopen: reload some database metadata
In some uses of reopen, new documents and threads maybe have been
added, and e.g. compaction may have changed the uuid.
2021-05-12 08:40:04 -03:00
Michael J Gruber
0729c4e81f test: change database from within pre-new hook
Due to the change in the config system, notmuch keeps a notmuch database
open when it would not do so before. Consequently, it can miss changes
to the database which are done from a hook (while notmuch holds the
databse in read only mode). When notmuch itself writes to the database
after that it uses wrong assumptions about the last used doc id etc.

Demonstrate this by triggering an assertion. (This new test succeeds
with notmuch 0.31.4.)

Signed-off-by: Michael J Gruber <git@grubix.eu>
Amended-by: db. Check for both messages
2021-05-12 08:34:34 -03:00
David Bremner
b4a4ed0df9 Merge branch 'release' 2021-05-10 11:36:56 -03:00
David Bremner
5ebbf17242 NEWS: start NEWS for 0.32.1 2021-05-10 11:14:57 -03:00
David Bremner
bfbe2e55f2 doc: document database.backup_dir
Most users will not need to change this, but documenting it helps
preserve the interface.
2021-05-10 11:14:57 -03:00
David Bremner
a7de593f72 doc: document (tersely) the intended behaviour of relative paths. 2021-05-10 11:14:57 -03:00
David Bremner
8bf3311084 test: test explicit configuration of backup directory
Including the relative path that was broken until a recent commit.
2021-05-10 11:13:07 -03:00
David Bremner
891b950219 test: test relative paths for database.hook_dir 2021-05-10 11:13:07 -03:00
David Bremner
1040e7aa07 lib/config: expand relative paths when reading from database
This makes the treatment of relative paths consistent between the
database and config files.
2021-05-10 11:12:58 -03:00
David Bremner
322a492c77 test: add known broken test for relative setting of mail_root
The behaviour should not change depending on where the configuration
is stored.
2021-05-10 11:11:42 -03:00
David Bremner
31098c4ae4 lib/config: canonicalize paths relative to $HOME.
Prior to 0.32, notmuch had the (undocumented) behaviour that it
expanded a relative value of database.path with respect to $HOME. In
0.32 this was special cased for database.path but broken for
database.mail_root, which causes problems for at least notmuch-new
when database.path is set to a relative path.

The change in T030-config.sh reflects a user visible, but hopefully
harmless behaviour change; the expanded form of the paths will now be
printed by notmuch config.
2021-05-10 11:08:18 -03:00
David Bremner
ef0b126619 test: add known broken test for relative database path in new
This test highlights a bug introduced in 0.32. The new split between
path and mail_root does not properly canonicalize relative paths in
the latter.
2021-05-10 11:06:40 -03:00
Felipe Contreras
ac64de450a test: ruby: simplify output comparison
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-05 17:00:37 -03:00
Felipe Contreras
faf5511c3e test: ruby: don't use instance variables
Local variables are perfectly fine.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-05 17:00:16 -03:00
Felipe Contreras
c4b23cf29a test: ruby: use much more standard Ruby idioms
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-05 16:40:15 -03:00
Felipe Contreras
63413a5563 test: ruby: use much more standard puts
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-02 08:12:15 -03:00
Felipe Contreras
2dbc5fdf5a test: ruby: simplify test_ruby()
We always do test_expect_equal_file, so do it in test_ruby() directly.

The only subtest where we don't (get non-existent file) can be easily
modified.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-02 08:12:05 -03:00
Felipe Contreras
9f6bc01824 test: ruby: simplify MAIL_DIR initialization
There's no need to complicate the script passing the MAIL_DIR
environment variable.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-02 08:11:56 -03:00
Felipe Contreras
c1b99d6f94 test: ruby: simplify MAIL_DIR check
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-02 08:11:42 -03:00
Felipe Contreras
a75a9a5aed test: ruby: refactor test_ruby()
There's no point in repeating the same initialization in all the tests.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-02 08:11:17 -03:00
Felipe Contreras
8cbd8e71d0 test: move test_ruby() inside the only client
Not much point in polluting the main library, and also will be useful to
modify it in tandem with the tests.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-02 08:11:04 -03:00
David Bremner
595b61ef47 notmuch 0.32 release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEkiyHYXwaY0SiY6fqA0U5G1WqFSEFAmCOewwACgkQA0U5G1Wq
 FSEtmhAAic/ii2R6wzw1W3vn79a1U+2mZKjt7BhB2hnfZxP+9pJsu2nfuRF3htBk
 7iD8U65X6+IxR2sywAY2C2dlmaFSpph5/6oxd7NqQ0tV0I6Rk1i5c+c3mkg42T+X
 chdsvpCn+m5IVEyOH9HNSIfTlB4NPz4MnK+mN8K6BRRw9O3+LLTtisSe6gxPOX45
 nosicfEcaSeBxcPlx3rDtqxGB8EHsQB3RNITFAWt31p9jpzQMKPk7lTZeF7kp5SH
 w8rN3k/yeGaEdWGiWzymYwIA6tim9imvJBxu5UnV+SwlD+lGViCjtQOk1fMC0WCD
 29BFdRMG5YrBp33nsFX3pgUOVEyGFrWIZPbO9ReOqfc9gpks/5JqcKd6NZ7hMjx/
 I7+It6Cc0KJ6Pmc+w/xz1jK8NeOPcE1YlKZJ+dMjyoBnWixlHW2vOPCSLXXGclBk
 AxZN6kRJxNtoUgX9OLLK8xupqR3PsEeuvku/quYsCEyFrT/A3pr5XaKDkG+EbC4H
 NX/BdURU9gccUdckfXHqCB1PzcQWiVV7wj4xC7XdaqMe2Pb1MR0AOUrwWiU/CboQ
 yza9ryndX05omhQsmnn11xB018oeBAX0iw6T1tb8Vx1CMBJCTC/kPBj3WqY07G3g
 Z9rhLGtIzpFBgSGy3VNGqjfXrWyePSyBcgZGzyjjSQ/mfVUbbDs=
 =zOsP
 -----END PGP SIGNATURE-----

Merge tag '0.32'

notmuch 0.32 release
2021-05-02 07:41:42 -03:00
David Bremner
5fe92332f2 debian: add changelog for 0.32-1 2021-05-02 07:05:44 -03:00
David Bremner
75acdf32fc NEWS: set date for 0.32 release 2021-05-02 07:01:41 -03:00
David Bremner
ff5311b098 version: bump to 0.32 2021-05-02 07:00:15 -03:00
Felipe Contreras
fe9616aef1 test: add external prereqs to many emacs tests
The tests fail otherwise.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-01 21:15:27 -03:00
Felipe Contreras
049a652da7 test: add prereqs check in test_emacs_expect_t
test_emacs may update the external prereqs, in which case we want to
skip the test rather than fail.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-01 21:15:10 -03:00
Felipe Contreras
7579f3ac6b test: fix wrong SKIP messages
When the external prereqs are updated inside the body of the command
(e.g. test_emacs) the message in test_report_skip_ is wrong: it outputs
the body of the command instead of the subtest name.

We need to pass the same argument we pass to test_skip.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-01 21:14:55 -03:00
Felipe Contreras
0b48e65526 test: use correct fqdn in passwd_sanitize()
My fqdn is 'natae.localdomain', however, socket.getfqdn() returns
'localhost'.

To fetch the true fqdn we need socket.getaddrinfo().

For more information see: https://stackoverflow.com/a/11580042/10474

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-01 21:14:37 -03:00
Felipe Contreras
2add9ce722 test: unset NAME environment variable
Otherwise the output from the tests would be different.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-01 21:13:41 -03:00
Felipe Contreras
ff5f141bf2 test: fix passwd_sanitize()
If any of the variables is empty the output is completely messed up,
because replace("", "FOO") puts "FOO" before every single character.

I don't have my full name configured, and this is what I get:

  USER_FULL_NAME=USER_FULL_NAME=USER_FULL_NAME USER_FULL_NAMEsUSER_FULL_NAMEtUSER_FULL_NAMEdUSER_FULL_NAMEoUSER_FULL_NAMEuUSER_FULL_NAMEtUSER_FULL_NAME USER_FULL_NAME=USER_FULL_NAME=USER_FULL_NAME

Let's check for empty strings before doing any replace.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-01 21:13:23 -03:00
David Bremner
6a20478abb perf-test: add option to run perf
Although the generation of perf data is not as slow as valgrind, it
seems simplest to re-use the machinery already there to save the logs
in a timestamped subdirectory.
2021-04-28 08:49:07 -03:00
David Bremner
9e2e723881 notmuch 0.32~rc2 release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEkiyHYXwaY0SiY6fqA0U5G1WqFSEFAmCJNFIACgkQA0U5G1Wq
 FSHvjA/9GyM5/Z6N79BAu2cHJykw055Oj7BzcEfyiDa9qju9R9FzlMq5eYepEkqp
 s6uehZ3yUr2vzMpUlCUjzjDzOrT3rkzWoD8soqA7T0/hWOHsid/NH51hom5n5p1F
 KC4WaUxv1doNVfUCW/zhUmRQKgHMqq+WHkmqi9YD0OFfTZr9c4lgY89nGhQbNEb2
 Bp51TqkgbjCD9eMPFkzyJuM/FSU1JYYT2z69/lSLDjAtTUxDbfFHyW20//fsC4T/
 XjCrWMr/FFucYLp3kPPWT60XbOcygtJmxV+JfezwxGu0i+UD3ZwJ879kKnsYMJ4y
 5mNhSToeOFvBnR5eZMP0YL8PFSdq4tTJmORIBWIsFNeQ8rD4uFOE/Yy84D5AbZ6O
 BztimcCy77TQzmERiEj7H14aNbQekf070yZmICtK8isCbpWiHQRPo3VlOqzAaN94
 1sjMX6SfH480UrhH4+XXYGdpbitm1IRKRoXrj1MIqvxNpMyVl+tMQCyaHGq5wy46
 AFHLPY5YBYzkg1dJRwTyIpUbrfyl/O6zJloyH9z7jN2NJzTGep505GyQCfs/4wA+
 1R5OR3ZKgPXLl9flpp4WysOlbGhGxa5DjG2i59zrWbd2bXVjv80UncF5LGhLcogz
 3Jif42UjrnNPI/kf858QmmW8Gb2CMbR6uBwu50sB8JxwL6BkwUo=
 =FcEw
 -----END PGP SIGNATURE-----

Merge tag '0.32_rc2'

notmuch 0.32~rc2 release
2021-04-28 07:32:44 -03:00