Commit graph

6716 commits

Author SHA1 Message Date
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
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
David Bremner
fa1fb288e6 debian: add changelog for 0.32~rc2-1 2021-04-28 07:06:31 -03:00
David Bremner
bc58b5ad0d version: bump to 0.32~rc2 2021-04-28 07:04:57 -03:00
David Bremner
02e3fe4943 NEWS: fix typo
Spellcheckers, is that like spellchess?
2021-04-28 07:01:53 -03:00
David Bremner
aae0d6b9c4 NEWS: summarize changes to emacs interface.
This my attempt at a summary based on git log.

Amended: with suggestions from id:87wnsmkf12.fsf@bernoul.li
2021-04-28 07:00:00 -03:00
David Bremner
f35dadfb76 NEWS: mention file deletion speedups
It seems a bit silly to have two NEWS entries for one commit, but
there are two potiential audiences.
2021-04-26 20:53:01 -03:00
Felipe Contreras
8af4cd160a vim: fix Mail 2.8.0 warning
Passing an unparsed header field to Mail::Field.new is deprecated and will be removed in Mail 2.8.0. Use Mail::Field.parse instead.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-04-26 20:06:13 -03:00
David Bremner
00487fa901 test: hide message from moreutils parallel.
The argument --version confuses moreutils parallel, but this is OK,
because its confusing does not include printing "GNU"
2021-04-26 09:00:11 -03:00
Tobias Backer Dirks
f2b5ad28e2 test: check for GNU parallel with --version options
The lastest versions of GNU parallel no longer make mention of GNU
within their help output. This causes the test script to mistakenly use
the moreutils parallel execution. In order to fix this, while
maintaining compatibility with previous versions of GNU parallel,
--version should be used.

Signed-off-by: Tobias Backer Dirks <omgitsaheadcrab@gmail.com>
2021-04-24 20:06:41 -03:00
David Bremner
f8463d7374 debian: bump changelog version 2021-04-24 12:46:32 -03:00
David Bremner
07a8130483 version: bump to 0.32~rc1 2021-04-24 12:26:09 -03:00
David Bremner
9f8458a998 debian: add xapian-tools for tests
xapian-metadata is used by some of the new tests.
2021-04-24 12:17:59 -03:00
David Bremner
5f80e106d6 lib/config: remove early free in _get_email_from_passwd_file
This (obvious) bug was caused by cut&pasting the code from
notmuch-config.c into the library and adding on a return at the end.
2021-04-24 12:11:45 -03:00
David Bremner
27a2c2c80d test: replace notmuch_passwd_sanitize with python version
Apparently the -f option to hostname is not portable, and in fact it
does not seem to always behave reasonably in e.g. a chroot.

Python code originally due to Tomi [1], modified by yours truly.

[1]: id:m2lf9fbkug.fsf@guru.guru-group.fi
2021-04-24 12:11:22 -03:00
David Bremner
c008176ade debian: update d/libnotmuch5
This corresponds to libnotmuch 5.3. It should be backward compatible
because it only adds symbols.
2021-04-24 08:55:45 -03:00
David Bremner
6caf8c25d4 debian: start changelog for 0.32~rc0-1 2021-04-24 08:49:44 -03:00
David Bremner
2e6a40ea8c update version to 0.32~rc0 2021-04-24 08:45:54 -03:00
Đoàn Trần Công Danh
441a327051 compat: rename {,notmuch_}canonicalize_file_name
When compat canonicalize_file_name was introduced, it was limited to
C code only because it was used by C code only during that time.

>From 5ec6fd4d, (lib/open: check for split configuration when creating
database., 2021-02-16), lib/open.cc, which is C++, relies on the
existent of canonicalize_file_name.

However, we can't blindly enable canonicalize_file_name for C++ code,
because different implementation has different additional signature for
C++ and users can arbitrarily add -DHAVE_CANONICALIZE_FILE_NAME=0 to
{C,CXX}FLAGS.

Let's move our implementation into a util library.

Helped-by: Tomi Ollila <tomi.ollila@iki.fi>
Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
2021-04-24 08:07:00 -03:00
Felipe Contreras
62f03b6ab8 ruby: fix ruby 3.1 warnings
init.c:214:5: warning: ‘rb_cData’ is deprecated: by: rb_cObject.  Will be removed in 3.1. [-Wdeprecated-declarations]

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-04-18 21:42:43 -03:00
David Bremner
084e60d54a lib/n_d_index_file: check return value from _n_m_add_filename
Ignoring this return value seems like a bad idea in general, and in
particular it has been hiding one or more bugs related to handling
long directory names.
2021-04-18 10:02:20 -03:00
Đoàn Trần Công Danh
828a004921 test-lib: unset XDG_CONFIG_HOME
lib/open.cc:_load_key_file will only open xdg-config files in
$XDG_CONFIG_HOME if it's defined, $HOME/.config will be considered if
and only if XDG_CONFIG_HOME not defined.

Let's unset said variable before running the test.
2021-04-18 10:00:10 -03:00
David Bremner
9ad19e4454 lib: directly traverse postlists in _n_message_delete
This is intended to fix the slow behaviour of "notmuch new" (and possibly
"notmuch reindex") when large numbers of files are deleted.

The underlying issue [1] seems to be the Xapian glass backend spending
a large amount of time in db.has_positions when running queries with
large-ish amounts of unflushed changes.

This commit removes two uses of Xapian queries [2], and replaces them with
an approximation of what Xapian would do after optimizing the
queries. This avoids the calls to has_positions (which are in any case
un-needed because we are only using boolean terms here).

[1] Thanks to "andres" on IRC for narrowing down the performance
bottleneck.

[2] Thanks to Olly Betts of Xapian fame for talking me a through a fix
that does not require people to update Xapian.
2021-04-18 09:50:36 -03:00
David Bremner
8a64f725df perf-tests: add test for removing files.
Without the proposed fix for deletion performance [1], this test is
probably unreasonably slow compared to others at the same
small/medium/large scale.

[1]: id:20210414021627.1236560-3-david@tethera.net
2021-04-18 09:50:26 -03:00
David Bremner
5248f55d5f test: put shim at end of LD_PRELOAD path
Certain tools like the address-sanitizer fail if they are not the
first LD_PRELOADed library. It does not seem to matter for our shims,
as long as they are loaded before libnotmuch.
2021-04-16 09:06:39 -03:00
David Bremner
3734c76d12 NEWS: user visible config related changes for 0.32 2021-04-10 09:49:37 -03:00
David Bremner
1459217e17 CLI: rename notmuch_config_t to notmuch_conffile_t
The name is a compromise between keeping function names from getting
too long, and avoiding confusion with the newer notmuch_config library
API. Try to make clear that the residual functionality is only about
updating configuration files.
2021-04-06 21:32:36 -03:00
David Bremner
1c747a501c CLI: drop notmuch_config_t from subcommand interface.
At this point it is unused in all subcommands.
2021-04-06 21:32:36 -03:00
David Bremner
ec4b7efbe4 CLI/config: remove calls to notmuch_config_open from top level
This will allow simplifying the subcommand interface.

Change the internal API to notmuch_config_open to not tie it to the
implementation of subcommands in notmuch.c.

It also fixes a previously broken test, since notmuch_config_open does
not understand the notion of the empty string as a config file name.
2021-04-06 21:32:36 -03:00
David Bremner
77d4b26d3e CLI/config: support set/get with split configuration
There are two small code changes. The main one is to retrieve the
possibly updated config file name found during the database opening
call. The second change is to allow empty config file names, as
a (currently broken) way of specifying that configuration should only
be taken from the database.
2021-03-27 09:26:14 -03:00
David Bremner
f5d4349921 lib: provide notmuch_config_path
Since the library searches in several locations for a config file, the
caller does not know which of these is chosen in the usual case of
passing NULL as a config file. This changes provides an API for the
caller to retrieve the name of the config file chosen. It will be
tested in a following commit.
2021-03-27 09:26:14 -03:00
David Bremner
217f819608 CLI+lib: detect missing database in split configurations.
Eventually we want to do all opening of databases in the top
level (main function). This means that detection of missing databases
needs to move out of subcommands. It also requires updating the
library to use the new NO_DATABASE status code.
2021-03-27 09:26:14 -03:00
David Bremner
2e39ce6eb5 lib: add NOTMUCH_STATUS_NO_DATABASE
This will allow more precise return values from various open related functions.
2021-03-27 09:26:14 -03:00
David Bremner
dd9112e7d8 CLI/config: default to storing all config in external files
Previously the fact that some configuration options were only stored
in the database (and thus editing the config file had no effect) was a
source of user confusion. This was fixed with the series ending at
d9af0af164.

On the other hand, the underlying partition of config options into
those stored by default in the database and those stored in the config
file remained. This is also confusing, since now some invocations of
"notmuch config set" modify the config file, and others silently
modify the database instead.

With this commit, it is up to the user to decide which configuration
to modify. A new "--database" option is provided for notmuch config to
enable modifying the configuration information in the database;
otherwise the default is to update an external config file.
2021-03-27 09:26:14 -03:00
David Bremner
7f6aae4f64 CLI/config: drop cached data from notmuch_config_t
The idea is to preserve notmuch_config_t as a thin wrapper for GKeyFile.
2021-03-27 09:26:14 -03:00
David Bremner
eb542106b6 CLI/config: drop obsolete notmuch_config_get_*
These are no longer used, replaced by notmuch_config_get.
2021-03-27 09:26:14 -03:00
David Bremner
8d5b8753cf CLI/notmuch: switch notmuch_command to notmuch_config_get
The goal at this point is to remove the dependence on
notmuch_config_get_* without breaking any existing functionality. This
is a step towards removing notmuch_config_get_* in a future commit.
2021-03-27 09:26:14 -03:00
David Bremner
f055e94562 CLI/config: use notmuch_database_reopen
This allows `notmuch config` to use the common configuration
information carried by the notmuch_database_t opened at the top level.
2021-03-27 09:26:14 -03:00
David Bremner
b76da87d29 CLI/config: migrate notmuch_config_open to new config
notmuch_config_open will be preserved in the medium term for use by
the commands that are manipulating the config file directly (config
and setup)
2021-03-27 09:26:14 -03:00
David Bremner
3787fe6c84 CLI/config: switch "notmuch config list" to merged config
Use the database opened at the top level rather than opening another
notmuch_database_t.

Test output changes because keys are now listed in alphabetical order,
and because a missing database is no longer an error.
2021-03-27 09:26:14 -03:00
David Bremner
34f734e26b CLI/setup: switch to new configuration framework
Most of the changes are the elimination of notmuch_config_t accessor
use. We also migrate some of the diagnostics to the top level where we
are opening the files in question.
2021-03-27 09:26:14 -03:00
David Bremner
ee0e1cfb17 test/setup: check file output instead of notmuch config list
This allows verification of comments added to new / updated config
file.
2021-03-27 09:26:14 -03:00
David Bremner
ecb91d056c CLI/config: use merged config for "config get"
This commit starts the conversion of notmuch-config.c
functionality (as opposed to just interface) to the new config
framework.

The change to T030-config is because of the move of the
canonicalization database paths from the notmuch_config_t accessor to
the internal function _choose_database_path.
2021-03-27 09:26:14 -03:00