aboutsummaryrefslogtreecommitdiff
path: root/test/T590-libconfig.sh
AgeCommit message (Collapse)Author
2026-02-16lib/config: add config keys for git-remote-notmuch.David Bremner
The precise function will be explained in a future update to notmuch-config(1).
2024-07-26config: allow custom separators in author listsLars Kotthoff
Allow distinguishing between commas separating authors and separating first and last names. Amended by db: reformat NEWS entry and commit message. Tweaked whitespace in lib/thread.cc.
2023-04-02lib: add config key INDEX_AS_TEXTDavid Bremner
Higher level processing as a list of regular expressions and documentation will follow.
2022-01-18lib/config: add known config key "show.extra_headers"David Bremner
Used in a following commit to enable including extra headers beyond the default in structured output.
2022-01-15lib/open: no default mail root in split configurationsDavid Bremner
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-15test/libconfig: add two tests for the config = "" caseDavid Bremner
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-15test/libconfig: save and restore config fileDavid Bremner
Currently the config file is unusable for further tests requiring a valid database path.
2021-12-04test: move system includes to notmuch-test.hDavid Bremner
This removes some redudant includes, and will also make it easier to introduce "#define _GNU_SOURCE", which must come before all system includes.
2021-12-04config: ignore leading/trailing spaces in ';'-delimited listsDavid Bremner
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. [1]: id:CA+Tk8fzjPLaEd3vL1f9ebk_bF_RV8PDTLzDupraTkCLCpJAmCg@mail.gmail.com
2021-12-04test: known broken tests for leading/trailing ws in configDavid Bremner
These tests duplicate the bug/misfeature reported in id:CA+Tk8fzjPLaEd3vL1f9ebk_bF_RV8PDTLzDupraTkCLCpJAmCg@mail.gmail.com
2021-12-03lib/config: don't overwrite database.path if the caller passed itDavid Bremner
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.
2021-12-03test: add known broken test for conflict with database parameterDavid Bremner
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.
2021-12-03test/libconfig: use 'export' for remaining sets of NOTMUCH_CONFIGDavid Bremner
It makes the tests easier to understand if we always use export for environment variables.
2021-10-30lib/load_config: deallocate / NULL database on fatal errorDavid Bremner
This fixes a potential memory leak, and makes the behaviour of notmuch_database_load_config (somewhat) consistent with n_d_{open,create} with config.
2021-10-30lib/load_config: document expectations for db on error, add testsDavid Bremner
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-30lib/create: fix memory leak, ensure *database=NULL on errorDavid Bremner
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-30lib/create: document expectations for db on error, add testsDavid Bremner
It seems sensible to harmonize the behaviour with n_d_open_with_config. In this commit we just assert the desired behaviour.
2021-10-30lib/open: fix potential double-free, ensure *database=NULL on errorDavid Bremner
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-30test: add two known broken tests for missing config filesDavid Bremner
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-27test/libconfig: use 'export' when restoring NOTMUCH_CONFIGDavid Bremner
This is required when NOTMUCH_CONFIG has been unset, and is harmless otherwise.
2021-09-10lib: use 'localhost' rather than fqdn for default mail address.David Bremner
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-06-27lib/config: add NOTMUCH_CONFIG_AUTOCOMMITDavid Bremner
This will be used to control how often atomic transactions are committed.
2021-06-21test/libconfig: make indexing more consistentDavid Bremner
The other tests have converted to two digit decimal, the commit does the same to the remaining test that was printing out indices in hex.
2021-05-22test: replace notmuch_passwd_sanitize() with _libconfig_sanitize()Tomi Ollila
notmuch_passwd_sanitize() in test-lib.sh is too generic, it cannot work in many cases... The more specific version _libconfig_sanitize() replaces it in T590-libconfig.sh and the code that uses it is modified to output the keys (ascending numbers printed in hex) so the sanitizer knows what to sanitize in which lines... "@" + fqdn -> "@FQDN" replacement is used as fqdn could -- in theory -- be substring of 'USERNAME'. 'user -> 'USER_FULL_NAME replacement to work in cases where user is empty -- as only first ' is replaced that works as expected. In addition to ".(none)" now also ".localdomain" is filtered from USERNAME@FQDN. /dev/fd/{n} is not defined in posix, but it is portable enough (if it weren't it is easy to fix -- now code looks clearer).
2021-05-15lib/open: restore default database path of $HOME/mailDavid Bremner
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-03-27CLI/config: migrate notmuch_config_open to new configDavid Bremner
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-27lib/config: set default for primary user emailDavid Bremner
This is mainly copying code from the CLI into the lib. The CLI copy will be deleted in a later commit.
2021-03-27lib/config: set defaults for user full nameDavid Bremner
This just copies code from from the CLI into the library. New test infrastructure is needed because apparently we have never tested this code path.
2021-03-27lib/config: add config_pairs iteratorsDavid Bremner
The layer of shims here seems a bit wasteful compared to just calling the corresponding string map functions directly, but it allows control over the API (calling with notmuch_database_t *) and flexibility for future changes.
2021-03-27lib/config: add notmuch_config_get_values_stringDavid Bremner
This is to support the less common (at least in the notmuch codebase) case of accessing a ;-delimited list config value with an arbitrary string key.
2021-03-27lib: provide notmuch_database_load_configDavid Bremner
This is mainly targetted at notmuch-config.c, or similar applications that don't necessarily need both a configuration file and a database to exist.
2021-03-20lib/config: add configuration variable for backup directoryDavid Bremner
Like the hook directory, we primarily need a way to communicate this directory between various components, but we may as well let the user configure it. Most of the diff is generalizing choose_hook_dir to work for both backup and hook directories.
2021-03-20lib/open: support XDG_DATA_HOME as a fallback database location.David Bremner
This changes some error reporting, either intentionally by reporting the highest level missing directory, or by side effect from looking in XDG locations when given null database location.
2021-03-20lib: support splitting mail from database location.David Bremner
Introduce a new configuration value for the mail root, and use it to locate mail messages in preference to the database.path (which previously implied the mail messages were also in this location. Initially only a subset of the CLI is tested in a split configuration. Further changes will be needed for the remainder of the CLI to work in split configurations.
2021-03-19lib/open: support NOTMUCH_DATABASE environment variableDavid Bremner
The additional code is trivial, but making sure we get the priority of various options correct takes a few tests.
2021-02-06lib/open: set HOOK_DIR on openDavid Bremner
This is a simple two step path search. Most error checking is deferred until running the hooks.
2021-02-06lib/config: add HOOK_DIRDavid Bremner
The hook directory configuration needs to be kept in synch with the other configuration information, so add scaffolding to support this at database opening time.
2021-02-06lib/config: add NOTMUCH_CONFIG_NEW_IGNOREDavid Bremner
This will be needed by (at least) the conversion of notmuch-new.c to the new config framework
2021-02-06lib/config: make values iterators restartableDavid Bremner
This is relatively cheap, and makes it easier to transform existing code which uses arrays of pointers to store configuration lists.
2021-02-06lib/config: add config values iteratorDavid Bremner
This is intended to avoid duplicating the string splitting and traversal code for all clients of the config API.
2021-02-06lib/open: load default values for known configuration keys.David Bremner
This emulates the behaviour of notmuch_config_open defined in the CLI, in that it fills in default values if they are not otherwise defined.
2021-02-06lib/config: add notmuch_config_key_{get,set}David Bremner
By using an enum we can have better error detection than copy pasting key strings around. The question of what layer this belongs in is a bit tricky. Historically most of the keys are defined by the CLI. On the other hand features like excludes are supported in the library/bindings, and it makes sense to configure them from the library as well. The somewhat long prefix for notmuch_config_t is to avoid collisions with the existing usage in notmuch-client.h.
2021-02-06lib/open: add support for config profiles and default locationsDavid Bremner
Fill in the remainder of the documented functionality for n_d_open_with_config with respect to config file location. Similar searching default locations of the database file still needs to be added.
2021-02-06lib: add stub for notmuch_database_open_with_configDavid Bremner
Initially document the intended API and copy the code from notmuch_database_open_verbose. Most of the documented functionality is not there yet.
2020-12-20test: use keys with group 'test' in T590-libconfigDavid Bremner
In a future commit we want to interoperate better with glib KeyFiles, which need groups for all keys.
2020-08-03test: regression test for traversing config list with closed dbDavid Bremner
Also mention error return in API docs
2020-08-03test: regression test for n_d_get_config_list on closed db.David Bremner
Exception is caught.
2017-10-20test: use $(dirname "$0") for sourcing test-lib.shJani Nikula
Don't assume the tests are always run from within the source tree.
2017-04-01cli/dump: bump dump format version to 3David Bremner
No changes to the format of the body, but the header format was fixed, and version 2 headers probably shouldn't be relied on.
2016-06-13test: factor out some boilerplate from C testsDavid Bremner
The trick of having a common header file doesn't work to share between test scripts, so make an include file in the test directory. The use of #include <notmuch-test.h> looks slightly pretentious, but the include file is not actually in the current (temporary) directory.