Commit graph

6836 commits

Author SHA1 Message Date
David Bremner
e2a3e5fa51 lib: autocommit after some number of completed transactions
This change addresses two known issues with large sets of changes to
the database.  The first is that as reported by Steven Allen [1],
notmuch commits are not "flushed" when they complete, which means that
if there is an open transaction when the database closes (or e.g. the
program crashes) then all changes since the last commit will be
discarded (nothing is irrecoverably lost for "notmuch new", as the
indexing process just restarts next time it is run).  This does not
really "fix" the issue reported in [1]; that seems rather difficult
given how transactions work in Xapian. On the other hand, with the
default settings, this should mean one only loses less than a minutes
worth of work.  The second issue is the occasionally reported "storm"
of disk writes when notmuch finishes. I don't yet have a test for
this, but I think committing as we go should reduce the amount of work
when finalizing the database.

[1]: id:20151025210215.GA3754@stebalien.com
2021-06-27 14:03:00 -03:00
David Bremner
8aabddb043 test: add known broken test for closing with open transaction
The expected output may need adjusting, but what is clear is that
saving none of the changes is not desirable.
2021-06-27 14:01:26 -03:00
David Bremner
2f608d2a94 lib/config: add NOTMUCH_CONFIG_AUTOCOMMIT
This will be used to control how often atomic transactions are
committed.
2021-06-27 13:59:42 -03:00
David Bremner
65f923219e database/close: remove misleading code / comment
Unfortunately, it doesn't make a difference if we call
cancel_transaction or not, all uncommited changes are discarded if
there is an open (unflushed) transaction.
2021-06-27 13:58:17 -03:00
David Bremner
49893c2c61 lib/database: fix style mistake.
The spacing of the declaration was wrong in ea30110.
2021-06-27 13:52:43 -03:00
Protesilaos Stavrou
5cc106b0e3 emacs: use new face for notmuch-jump and related
The minibuffer-prompt face that was used before made it impossible to
differentiate between two distinct UI elements: (i) the prompt's text
which itself cannot be acted upon, (ii) the actionable keys used to
jump to searches/tags.

The use of a named face, notmuch-jump-key, makes it possible for users
or theme developers to apply properties that are specific to each of
those two cases.

In the interest of backward compatibility, the new face inherits from
minibuffer-prompt.
2021-06-27 12:28:54 -03:00
David Bremner
d21e72c9f9 notmuch 0.32.2 release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEkiyHYXwaY0SiY6fqA0U5G1WqFSEFAmDYa+AACgkQA0U5G1Wq
 FSHDpA/+JAZc5RIBs7joGQTBGdiXbTw9dt0LFrnUr1AdckfMje+T5n9H56QFKFHN
 upzSL0S4JtPyW6Up1GhJFZhZxZgRYOj42UbFAuJTCwD+CMhZY5EtRdAi28vug6Vc
 9XtvD+uLE/ogP8X3x7yJtK4aMBQeDwMjvEi5yjO734oOaWYZpjEkbPxMol0T8gJq
 TBhFzrVfUBI5yNX1tRqPOPR+nn/v9/AJVFHvQNRyNEaPewxU761cRF/gtQsFZPkG
 4a5pN6sKTSmMvhiEffJbCtGrEhd+BEI8+pnIZwqlH1bj9bdea/68g48ruh0sicPj
 NP7CRkOH6TwEASGrzi7eMsGv6k1F3INeIawLXN3DP/lJQ5z6Q9cq2WY7vR4a6fyj
 gYWEeepS4dYwH/+hgXRLQ/1HTDbh8Ikm87cGm8cWC3KNSwlPxTGQEueP1kj5DkXa
 ruSXrvM/pIR6CyeBxWZ+/p55SBnH6Rd426mE4b5oHYQvanFu3zxrRcy4bFI4KnzT
 qMGHQ9nxeBTpKP18864HwU1ji4iIjWbWHKXE1cC/Y1UFKXqndh4tk9OvAA9qM8H2
 yBDq+PTyzOyApQBytosn7n5gHg90DlrynnUsNP6v3V/eSB6Z+DsI7UP7uOullul0
 2q+EiId/B8gBrHRKODIPeV5l0Vhgi2eIm0MDlikv0ReR3RRt/DU=
 =1AuX
 -----END PGP SIGNATURE-----

Merge tag '0.32.2'

notmuch 0.32.2 release
2021-06-27 09:34:00 -03:00
David Bremner
af56f3bcdc NEWS: finalize for 0.32.2 2021-06-27 08:56:21 -03:00
David Bremner
41873f3505 debian: changelog for 0.32.2-1 2021-06-26 22:34:30 -03:00
David Bremner
0740ee69fb NEWS: mention fix for memory leak. 2021-06-26 22:26:09 -03:00
Daniel Kahn Gillmor
29d43b7f44 emacs: Prefer email address over User ID when showing valid signature
Most concrete verification steps are likely only taken on the e-mail
address in the first place, and e-mail addresses render more
intelligibly than arbitrary User IDs in the first place.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Amended-by: db, apply dme restructuring suggestions.
2021-06-26 13:34:54 -03:00
Daniel Kahn Gillmor
8c29a5da09 cli/show: produce "email" element in sigstatus
When the certificate that signs a message is known to be valid, GMime
is capable of reporting on the e-mail address embedded in the
certificate.

We pass this information along to the caller of "notmuch show", as
often only the e-mail address of the certificate has actually been
checked/verified.

Furthermore, signature verification should probably at some point
compare the e-mail address of the caller against the sender address of
the message itself.  Having to parse what gmime thinks is a "userid"
to extract an e-mail address seems clunky and unnecessary if gmime
already thinks it knows what the e-mail address is.

See id:878s41ax6t.fsf@fifthhorseman.net for more motivation and discussion.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2021-06-26 13:07:47 -03:00
David Bremner
4b0c6fb2f1 Merge branch 'release' 2021-06-25 09:34:29 -03:00
David Bremner
ea301102ab lib: write talloc report in notmuch_database_destroy
Since most memory allocation is (ultimately) in the talloc context
defined by a notmuch_database_t pointer, this gives a more complete
view of memory still allocated at program shutdown.

We also change the talloc report in notmuch.c to mode "a" to avoid
clobbering the newly reported log.
2021-06-25 09:20:37 -03:00
David Bremner
35d559eb18 lib/config: fix memory leak
This commit fixes a small memory leak (per iterator restart) by
actually using the talloc context intended to be blown away on
restart.
2021-06-25 09:13:04 -03:00
David Bremner
636e03a9ca version: bump to 0.32.2 2021-06-25 09:02:54 -03:00
Ori
2c96956b3b emacs: Add compatibility for org-msg.el
Enable `notmuch-company` with `org-msg`, which does not derive from
`message-mode` in composing. This change was first proposed in the
discussion here:
https://github.com/jeremy-compostella/org-msg/issues/53
2021-06-24 17:26:43 -03:00
David Bremner
5be9e024d1 doc: tweak hook configuration documentation.
Add a historical note, and hint to look below for more about hooks.
Capitalized the heading for consistency, removed blank line.
2021-06-23 08:42:48 -03:00
David Bremner
7406abf5e0 test/libconfig: make indexing more consistent
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-06-21 06:57:17 -03:00
David Bremner
8dbd5deb8d Merge branch 'release' 2021-06-20 17:15:20 -03:00
David Bremner
86818626b3 NEWS: fix typo
Oops. Apparently our release checks do not check the spelling of
UNRELEASED (although Tomi's wiki conversion script does).
2021-06-20 16:59:30 -03:00
David Bremner
ce0fa835d3 NEWS: start NEWS for 0.32.2 2021-06-20 16:41:03 -03:00
David Bremner
dda50ede05 emacs: require seq for seq-some
Although the function dates from 2015, the autoload is newer. In
particular [1] it is not found in Emacs 25.3.

[1]: id:874ke85tqx.fsf@cgc-instruments.com
2021-06-08 20:12:33 -03:00
David Bremner
a19d2b0d2b test: check openssl prequisite for add_gpgsm_home
This is a fix for the test failures reported by Dan Čermák [1].

It is more robust to check for the prerequisite inside the function
that uses it, rather than in every test file that calls the function.

[1]: id:87k0n4fqgm.fsf@tethera.net
2021-06-08 17:15:46 -03:00
Tomi Ollila
6f0f83660e test: aggregate-results updates
notmuch-test will now call aggregate-results.sh with file list
that it compiles based on the test ran, and aggregate-results
will report failure is any of the test files are missing.

With this notmuch-test no longer has to exit in non-parallel
run if some test fail to write its report file -- so it works
as parallel tests in this sense.

Changed test_done() in test-lib.sh write report file in one write(2),
so there is (even) less chance it being partially written. Also,
now it writes 'total' last and aggregate-results.sh expects this
line to exist in all report files for reporting to be successful.

Added 'set -eu' to notmuch-test and modified code to work with
these settings. That makes it harder to get mistakes slipped
into committed code.
2021-06-07 20:16:33 -03:00
David Bremner
651a1b085b lib/message: use passed database for error handling
'message' should always be initialized if we reach here, but in case it
is not, we still want to be able to log an error message.
2021-06-05 15:41:28 -03:00
David Bremner
b0a11dbc38 lib/{open,message}: make some internal functions static
They are not used outside their file, so being extern seems like an oversight
2021-06-05 15:40:00 -03:00
Jani Nikula
87234a8ef3 emacs: update default mailing list archives for stashing links
Gmane web interface is long gone, remove it. Make MARC the new
default. Update LKML to Lore, where it already redirects anyway. Also
add Notmuch web archive.
2021-06-05 15:39:53 -03:00
David Bremner
2c85cc29bd test: add known broken test for indexing RFC822 group names
Austin Clements diagnosed this indexing problem in [1].

[1]: id:20130711215207.GR2214@mit.edu
2021-06-05 15:31:03 -03:00
Tomi Ollila
03366a3c5a emacs: fix declare-function definitions with related line breaks
- declare-function notmuch-unthreaded lacked file name
- declare-function notmuch-search had differently named last arg
  - note: check-declare-directory did not complain about that
- declare-function notmuch-search-show-thread without nil
- some functions declared to be in different file than those
  existed ("notmuch" -> "notmuch-lib")

- some related function/declare lines were (/are now) wider than
  80-columns; added line breaks (and proper indentation) there
2021-06-05 08:24:51 -03:00
David Bremner
d7ddfa0d0e emacs: drop setting mail-user-agent, and document how to set it
After some discussion [1], I decided it is better to make notmuch users
who rely on this behaviour customize mail-user-agent. This is
consistent with the behaviour of other emacs mail packages.

[1]: id:87k0nuhfrk.fsf@toryanderson.com
2021-06-04 20:05:31 -03:00
Tomi Ollila
572af27950 test: source $NOTMUCH_SRCDIR/test/test-lib-emacs.sh
Sourcing test-lib.sh will cd to TMP_DIRECTORY, so
relative path in $0 will not work in previous version
 . $(dirname "$0")/test-lib-emacs.sh

Now individual test scripts -- e.g. ./test/T310-emacs.sh
will work.
2021-06-03 09:29:27 -03:00
David Bremner
100106a45d Merge remote-tracking branch 'origin/release' 2021-05-31 20:26:31 -03:00
Daniel Kahn Gillmor
0478c0e077 NEWS/emacs: document changes in 0.32 that affect keybindings.
See list discussion in thread starting with
id:87h7ip2baq.fsf@fifthhorseman.net for more details.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Amended-by: David Bremner (s/.emacs/Emacs configuration/)
2021-05-31 20:25:23 -03:00
Felipe Contreras
85ae2bcf56 ruby: use notmuch_exclude_t enum
It exists since 2013, let's allow it to be used in Ruby.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-23 09:05:33 -03:00
David Bremner
f44c83c083 test: add regression test for large number of deletions
Prior to 9ad19e4454 there was an unhandled Xapian exception when
reindexing after a large number of deletes.  This test was used for
bisection, and will subsequently serve as a regression test.
2021-05-23 08:31:36 -03:00
David Bremner
8cb30b08d8 perf-test: add test for reindexing after removal/renaming msgs
At this point it is a bit tricky to measure the performance increase
from the new message deletion code, since the same commit (9ad19e4)
that improved the performance also seems to have fixed a bug with an
uncaught Xapian exception triggered by this test.
2021-05-23 08:22:31 -03:00
Tomi Ollila
f2533b9e73 test: say_color() in one write(2)
say_color() used to call (builtin) printf (and tput(1) to stdout)
several times, which caused attempts to write messages with color
to have partial content (e.g. escape sequences) often intermixed
with other tests when parallel tests were run.

Now, with all output collected, then written out using one
printf, all strings with color print out correctly
((at least short) write(2)'s appear to write out "atomically").

While at it, used only one tput(1) execution to determine whether
color output works, and made bold/colors/sgr0 to tput(1) their
values once per test.
2021-05-23 08:05:15 -03:00
David Bremner
69c2c930ec test: quiet some extra debugging output
This output does not cause test failures, but may make it harder to
interpret the output.
2021-05-23 08:04:07 -03:00
David Bremner
119a41b9ed test: ignore debugging messages
Previously building with "-DDEBUG" broke the test suite in several places.
2021-05-23 08:03:02 -03:00
David Bremner
748352693c lib/thread: add common prefix to debug messages, join lines
This will simplify filtering these message, e.g. in the test suite.
2021-05-23 08:01:38 -03:00
Jani Nikula
1222cba7e4 doc: example command-line option reference
Example reference to a command-line option using the option role
reference. This creates a hyperlink in html, and the usual boldface
style in man page. This could be used throughout the man pages.
2021-05-22 16:47:32 -03:00
Jani Nikula
f2e2f2aa96 doc: use program and option directives to document options
Use the program and option directives to document the subcommand
options. This unifies a lot of option documentation throughout.

This also makes it possible to reference options with :option:`--foo`
(within .. program::) or :option:`subcommand --foo` (globally). This
is left for later work.

See https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#directive-program

Note: There is a lot of indentation change, but intentionally there is
no reflow. Using 'git diff -w' or 'git show -w' to ignore white space
changes makes this a very easy change to review.
2021-05-22 16:43:24 -03:00
Jani Nikula
574b2436ee doc: use envvar directive and role for environment variables
Make man1/notmuch.rst the single point of truth for describing notmuch
environment variables. Use the envvar directive for that, and
reference them with the envvar role.

Drive-by cleanup configuration file and hook directory search order
documentation.
2021-05-22 16:41:20 -03:00
Jani Nikula
ff4e81ac57 doc: cross-reference notmuch man pages with actual links
Add internal hyperlink targets for man pages and cross-reference them
using the any role reference. There are a number of alternatives to
accomplish this, but this seems like the combination that retains the
man page section number and the same boldface style in the man pages.

As a bonus, we get sanity checking on the links; for example
notmuch-search-terms.rst had a reference to notmuch-properties(1)
i.e. the wrong section.

The obvious semantic follow-up change would be to only have meaningful
"see also" references instead of having them all everywhere.
2021-05-22 16:38:56 -03:00
Tomi Ollila
8675be1d30 test: replace notmuch_passwd_sanitize() with _libconfig_sanitize()
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-22 11:51:29 -03:00
Jani Nikula
3baa61e0e5 doc: use manpage role references to external man pages
Using manpage role references generates helpful links in html
documentation, while retaining the same boldface style in the man
pages.

The external man page site is configurable. The Debian manpage site
seems like a good fit for Notmuch.
2021-05-22 09:56:52 -03:00
David Bremner
702635d5f6 Merge branch 'release' 2021-05-22 09:34:55 -03:00
Felipe Contreras
3dae253c4f ruby: improve compilation with CFLAGS
The ruby MakeMakefile generates a makefile that is suboptimal, which has
CFLAGS like this:

  CFLAGS   = $(CCDLFLAGS) -march=x86-64 -mtune=generic \
    -O2 -pipe -fno-plt -fPIC $(ARCH_FLAG)

This works as long as the user doesn't modify the Makefile.

Certain flags (namely -fPIC) need to be present regardless of what
CFLAGS are specified.

The Makefile should have done this instead:

  CFLAGS = -march=x86-64 -mtune=generic -O2
  override CFLAGS += $(CCDLFLAGS) -pipe -fno-plt -fPIC $(ARCH_FLAG)

Unfortunately they didn't, so we need to workaround their lack of
foresight.

We can simply add the necessary flags in the parent Makefile so everyone
is happy.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-22 09:17:21 -03:00
David Bremner
3f4de98e7c lib/n_d_index_file: re-use thread-id of existing message
This prevents the message document getting multiple thread-id terms
when there are multiple files with the same message-id.

This change shifts some thread ids, requiring adjustments to other tests.
2021-05-22 09:08:02 -03:00