]> git.notmuchmail.org Git - notmuch/log
notmuch
7 years agotest: add function die () and have use of it in add_email_corpus ()
Tomi Ollila [Sat, 28 May 2016 12:39:29 +0000 (15:39 +0300)]
test: add function die () and have use of it in add_email_corpus ()

Added die() function to test-lib.sh with the following first use of it:

If notmuch new fails during email corpus addition the database is
most probably inexistent or broken and the added corpus would be
unusable while running single tests, giving misleading failures
("only" full 'make test' cleans out old corpus).

7 years agotest-lib.sh: renamed die...()s to trap...()s and exit...()
Tomi Ollila [Sat, 28 May 2016 12:39:28 +0000 (15:39 +0300)]
test-lib.sh: renamed die...()s to trap...()s and exit...()

Now the function names more accurately describes what the functions do.

7 years agodoc/notmuch-emacs.rst: update notmuch-hello buffer help text
Tomi Ollila [Sun, 5 Jun 2016 20:38:05 +0000 (23:38 +0300)]
doc/notmuch-emacs.rst: update notmuch-hello buffer help text

To look the same as commit b8a136187a3b changed it in emacs MUA code.

7 years agolib: fix definition of LIBNOTMUCH_CHECK_VERSION
David Bremner [Tue, 7 Jun 2016 10:37:57 +0000 (07:37 -0300)]
lib: fix definition of LIBNOTMUCH_CHECK_VERSION

Fix bug reported in id:20160606124522.g2y2eazhhrwjsa4h@flatcap.org

Although the C99 standard 6.10 is a little non-obvious on this point,
the docs for e.g. gcc are unambiguous. And indeed in practice with the
extra space, this code fails

#include <stdio.h>
#define foo (x) (x+1)

int main(int argc, char **argv){
  printf("%d\n",foo(1));
}

7 years agodevel/man-to-mdwn.pl: portable locale environment variable setting
Tomi Ollila [Thu, 9 Jun 2016 19:35:12 +0000 (22:35 +0300)]
devel/man-to-mdwn.pl: portable locale environment variable setting

Setting locale environment variables (LC_* and LANG) to e.g.
en_US.utf8 works fine on Linux, and that is what locale -a
returns (in Linux). However this does not work e.g. in some *BSD
systems.
In these systems, en_US.UTF-8 works. This also works in Linux
systems (which may look like a surprising thing on the first sight(*)).
But that *UTF-8 format seems to be widely used in the Linux system:
Grep it through the files in /etc/, for example.

Easy way to test: Run the following command lines. First should
complain about setting locale failed, and second should not.

$ LC_ALL=en_US.UTF-1 perl -e ''
$ LC_ALL=en_US.UTF-8 perl -e ''

(*) and who knows what the "standard" is...

7 years agolib: fix memory leak of field processor objects
David Bremner [Fri, 10 Jun 2016 02:35:27 +0000 (23:35 -0300)]
lib: fix memory leak of field processor objects

The field processor objects need to be deallocated explicitly just like
the range processors (or a talloc destructor defined).

7 years agodoc: clean up boolean vs. probabilistic prefixes
Daniel Kahn Gillmor [Thu, 2 Jun 2016 16:01:27 +0000 (12:01 -0400)]
doc: clean up boolean vs. probabilistic prefixes

sphinx-build emits a minor warning:

[...]doc/man7/notmuch-search-terms.rst:223: WARNING: Block quote ends without a blank line; unexpected unindent.

And the tabular representation of boolean or probabilistic prefixes
currently renders like this when i view it in man:

       ┌───────────────────────────┬────────────────────────────┐
       │Boolean                    │ Probabilistic              │
       └───────────────────────────┴────────────────────────────┘

       │          tag: id:         │           from: to:        │
       │                           │                            │
       │       thread:     folder: │        subject:    attach‐ │
       │       path:               │        ment: mimetype:     │
       └───────────────────────────┴────────────────────────────┘

This isn't just ugly: it's confusing, because it seems to imply that
some of the prefixes in the left-hand column are somehow related to
specific other prefixes in the right-hand column.

The Definition List representation introduced by this patch should be
simpler for readers to understand, and doesn't have the warning.

7 years agodoc: document notmuch-dump header line
David Bremner [Sun, 5 Jun 2016 22:23:58 +0000 (19:23 -0300)]
doc: document notmuch-dump header line

This was introduced with the libconfig changes, but not documented then.

7 years agolib: document config metadata
David Bremner [Sat, 4 Jun 2016 22:17:41 +0000 (19:17 -0300)]
lib: document config metadata

This probably should have been part of 3458e3c89c, but I missed it.

7 years agoUse https instead of http where possible
Daniel Kahn Gillmor [Thu, 2 Jun 2016 16:26:14 +0000 (12:26 -0400)]
Use https instead of http where possible

Many of the external links found in the notmuch source can be resolved
using https instead of http.  This changeset addresses as many as i
could find, without touching the e-mail corpus or expected outputs
found in tests.

7 years agonmbug: updated to modern URL for PEP 343
Daniel Kahn Gillmor [Thu, 2 Jun 2016 16:26:13 +0000 (12:26 -0400)]
nmbug: updated to modern URL for PEP 343

7 years agoupdate link to Chip Rosenthal article about reply-to munging
Daniel Kahn Gillmor [Thu, 2 Jun 2016 16:26:12 +0000 (12:26 -0400)]
update link to Chip Rosenthal article about reply-to munging

The original link is currently returning an internal server error :(

7 years agocompletion: update the location of the bash-completion project
Daniel Kahn Gillmor [Thu, 2 Jun 2016 16:26:11 +0000 (12:26 -0400)]
completion: update the location of the bash-completion project

Alioth currently redirects to github, so point there instead.

7 years agoNEWS, python: update pointer to online documentation
Daniel Kahn Gillmor [Thu, 2 Jun 2016 16:26:10 +0000 (12:26 -0400)]
NEWS, python: update pointer to online documentation

Currently, http://packages.python.org/notmuch/ goes through a series
of redirections and ends up pointing to readthedocs.  Since we're
using readthedocs directly anyway, just point to it directly.

readthedocs are also now sensibly using a separate domain
(readthedocs.io) for their hosted documentation as distinct from their
own domain (readthedocs.org), so use the correct tld.

7 years agodoc: include notmuch-emacs-mua in documentation ToC
Daniel Kahn Gillmor [Thu, 2 Jun 2016 16:01:28 +0000 (12:01 -0400)]
doc: include notmuch-emacs-mua in documentation ToC

Without this patch, i'm seeing sphinx-build emit:

 [...]doc/man1/notmuch-emacs-mua.rst:: WARNING: document isn't included in any toctree

7 years agolib: whitespace cleanup
Tomi Ollila [Sat, 28 May 2016 17:45:31 +0000 (20:45 +0300)]
lib: whitespace cleanup

Cleaned the following whitespace in lib/* files:

lib/index.cc:              1 line:  trailing whitespace
lib/database.cc            5 lines: 8 spaces at the beginning of line
lib/notmuch-private.h:     4 lines: 8 spaces at the beginning of line
lib/message.cc:            1 line:  trailing whitespace
lib/sha1.c:                1 line:  empty lines at the end of file
lib/query.cc:              2 lines: 8 spaces at the beginning of line
lib/gen-version-script.sh: 1 line:  trailing whitespace

7 years agolib: add support for named queries
David Bremner [Tue, 22 Mar 2016 10:54:54 +0000 (07:54 -0300)]
lib: add support for named queries

This relies on the optional presense of xapian field processors, and the
library config API.

7 years agolib: make a global constant for query parser flags
David Bremner [Tue, 22 Mar 2016 10:54:53 +0000 (07:54 -0300)]
lib: make a global constant for query parser flags

It's already kindof gross that this is hardcoded in two different
places. We will also need these later in field processors calling back
into the query parser.

7 years agoCLI: add notmuch-config support for named queries
David Bremner [Tue, 22 Mar 2016 10:54:52 +0000 (07:54 -0300)]
CLI: add notmuch-config support for named queries

Most of the infrastructure here is general, only the validation/dispatch
is hardcoded to a particular prefix.

A notable change in behaviour is that notmuch-config now opens the
database e.g. on every call to list, which fails with an error message
if the database doesn't exit yet.

7 years agoCLI: optionally restore config data.
David Bremner [Tue, 22 Mar 2016 10:54:51 +0000 (07:54 -0300)]
CLI: optionally restore config data.

The default to restore config data seems safest, especially since
currently we have no config data to mess up.

7 years agoCLI: add optional config data to dump output.
David Bremner [Tue, 22 Mar 2016 10:54:50 +0000 (07:54 -0300)]
CLI: add optional config data to dump output.

Note that it changes the default dump output format, but doesn't break
existing notmuch-restore. It might break user scripts though.

7 years agolib: config list iterators
David Bremner [Tue, 22 Mar 2016 10:54:48 +0000 (07:54 -0300)]
lib: config list iterators

Since xapian provides the ability to restrict the iterator to a given
prefix, we expose this ability to the user. Otherwise we mimic the other
iterator interfances in notmuch (e.g. tags.c).

7 years agolib: provide config API
David Bremner [Tue, 22 Mar 2016 10:54:47 +0000 (07:54 -0300)]
lib: provide config API

This is a thin wrapper around the Xapian metadata API. The job of this
layer is to keep the config key value pairs from colliding with other
metadata by transparently prefixing the keys, along with the usual glue
to provide a C interface.

The split of _get_config into two functions is to allow returning of the
return value with different memory ownership semantics.

7 years agoruby: add bindings for `notmuch_database_get_all_tags`
Ludovic LANGE [Sun, 6 Mar 2016 11:56:28 +0000 (07:56 -0400)]
ruby: add bindings for `notmuch_database_get_all_tags`

The Ruby bindings were missing a way to get all the tags of the
database. Now you should be able to access this with the public
instance method `all_tags` of your database object.

Example of use:
    notmuchdb = Notmuch::Database.new path, { :create => false,
     :mode => Notmuch::MODE_READ_ONLY }

    my_tags = notmuchdb.all_tags

    my_tags.each { |tag|
      print tag
    }

    my_tags.destroy!

Amended by db: improve error reporting, add test

7 years agotest: copyright information updates
Tomi Ollila [Fri, 6 May 2016 15:41:57 +0000 (18:41 +0300)]
test: copyright information updates

Files in test directories had only copyright of a single individual,
of which code was adapted here as a base of the test system.
Since then many Notmuch Developers have contributed to the test
system, which is now acknowledged with a constant string in some
of the test files.

The README file in test directory instructed new files contain a
copyright notice, but that has never been done (and it is also not
needed). To simplify things a bit (and lessen confusion) this
instruction is now removed.

As a side enchangement, all of the 3 entries in the whole source
tree cd'ing to `dirname` of "$0" now uses syntax cd "$(dirname "$0")".
This makes these particular lines work when current working directory
is e.g. /c/Program Files/notmuch/test/.
(Probably it would fail elsewhere, though.)

7 years agoemacs: bind notmuch-show-resend-message to 'b' in notmuch-show mode
Tomi Ollila [Sat, 7 May 2016 19:03:12 +0000 (22:03 +0300)]
emacs: bind notmuch-show-resend-message to 'b' in notmuch-show mode

This binding is similar to mutt's, which is

bind {mode} b   "bounce-message"    # remail a message to another user

where {mode} is 'index', 'pager' or 'attach'.

7 years agoemacs: add function to resend message to new recipients
Tomi Ollila [Sat, 7 May 2016 19:03:11 +0000 (22:03 +0300)]
emacs: add function to resend message to new recipients

The new function notmuch-show-message-resend re-sends
message to new recipients using #'message-resend.

Recipients are read from minibuffer as a comma-separated
string (with some keyboard support including tab completion).

Final confirmation before sending is asked.

7 years agocli: tell how many messages were precisely matched when expected 1 match
Tomi Ollila [Sat, 7 May 2016 19:24:18 +0000 (22:24 +0300)]
cli: tell how many messages were precisely matched when expected 1 match

In case of notmuch reply and notmuch show --part=N it is required that
search terms match to one message. If match count was != 1, error
message "Error: search term did not match precisely one message"
was too vague to explain what happened.

By appending (matched <num> messages) to the error message it
makes the problem more understandable (e.g when <num> is '0'
user reckons the query had a typo in it).

7 years agoconfigure: combine common parts of CONFIGURE_C{,XX}FLAGS
Tomi Ollila [Fri, 13 May 2016 21:29:45 +0000 (00:29 +0300)]
configure: combine common parts of CONFIGURE_C{,XX}FLAGS

By combining the common parts of CONFIGURE_CFLAGS and CONFIGURE_CXXFLAGS
to a separate make variable and using that as part of their
definitions makes setting of these easier, DRYer and less error prone
(especially as we cannot check potential typing errors there).

7 years agoconfigure: check directly for xapian compaction API
David Bremner [Tue, 22 Mar 2016 10:54:46 +0000 (07:54 -0300)]
configure: check directly for xapian compaction API

This is consistent with the check for FieldProcessor, and probably a bit
more robust.

7 years agolib/cli: add library API / CLI for compile time options
David Bremner [Tue, 22 Mar 2016 10:54:45 +0000 (07:54 -0300)]
lib/cli: add library API / CLI for compile time options

This is intentionally low tech; if we have more than two options it may
make sense to build up what infrastructure is provided.

7 years agolib: optionally support single argument date: queries
David Bremner [Tue, 22 Mar 2016 10:54:44 +0000 (07:54 -0300)]
lib: optionally support single argument date: queries

This relies on the FieldProcessor API, which is only present in xapian
>= 1.3.

7 years agoconfigure: detect Xapian:FieldProcessor
David Bremner [Tue, 22 Mar 2016 10:54:43 +0000 (07:54 -0300)]
configure: detect Xapian:FieldProcessor

Rather than check versions, it seems more robust to do a test compile.

7 years agoconfigure: add set -u
Tomi Ollila [Fri, 6 May 2016 18:11:25 +0000 (21:11 +0300)]
configure: add set -u

In case of any unset variable, make ./configure exit with nonzero value;
an attempt to expand an unset variable is a bug in the script
(usually a spelling mistake) and those should not pass through
unnoticed.

7 years agoconfigure: replace ${CXXLAGS} with ${CXXFLAGS_for_sh}
Tomi Ollila [Tue, 3 May 2016 17:23:44 +0000 (20:23 +0300)]
configure: replace ${CXXLAGS} with ${CXXFLAGS_for_sh}

Variable CXXLAGS expands to nothing, CXXFLAGS something unusable
here; CXXFLAGS_for_sh expands to what we expect here.

7 years agocli: remove leftover dir variable
Jani Nikula [Fri, 15 Apr 2016 19:29:15 +0000 (22:29 +0300)]
cli: remove leftover dir variable

No functional changes.

7 years agoconfigure: SC2016: Expressions don't expand in single quotes
Jani Nikula [Wed, 13 Apr 2016 18:32:49 +0000 (21:32 +0300)]
configure: SC2016: Expressions don't expand in single quotes

Fix shellcheck warnings. Use double quotes but escape $ to make it
look more intentional.

7 years agoconfigure: SC2034: glib_cflags and glib_ldflags appear unused.
Jani Nikula [Wed, 13 Apr 2016 18:32:48 +0000 (21:32 +0300)]
configure: SC2034: glib_cflags and glib_ldflags appear unused.

Fix shellcheck warnings.

7 years agoconfigure: SC2059: Don't use variables in the printf format string.
Jani Nikula [Wed, 13 Apr 2016 18:32:47 +0000 (21:32 +0300)]
configure: SC2059: Don't use variables in the printf format string.

Fix shellcheck warnings. Use printf "..%s.." "$foo".

7 years agoconfigure: SC2006: Use $(..) instead of legacy `..`
Jani Nikula [Wed, 13 Apr 2016 18:32:46 +0000 (21:32 +0300)]
configure: SC2006: Use $(..) instead of legacy `..`

Fix shellcheck warnings.

7 years agoMerge emacs bug fixes from release
David Bremner [Mon, 2 May 2016 00:11:45 +0000 (21:11 -0300)]
Merge emacs bug fixes from release

7 years agoemacs: Tell `message-mode' that outgoing messages are email.
David Edmondson [Sat, 30 Apr 2016 06:51:48 +0000 (07:51 +0100)]
emacs: Tell `message-mode' that outgoing messages are email.

When composing messages (including replies, etc.), indicate to
`message-mode' definitively that the message is email (as opposed to
Usenet news) rather than having it attempt to determine this for itself.

This causes `message-mode' to observe such variables as
`message-default-mail-headers', which previously happened haphazardly.

7 years agoemacs: Observe the charset of MIME parts when reading them.
David Edmondson [Sat, 30 Apr 2016 06:51:47 +0000 (07:51 +0100)]
emacs: Observe the charset of MIME parts when reading them.

`notmuch--get-bodypart-raw' previously assumed that all non-binary MIME
parts could be successfully read by assuming that they were UTF-8
encoded. This was demonstrated to be wrong, specifically when a part was
marked as ISO8859-1 and included accented characters (which were
incorrectly rendered as a result).

Rather than assuming UTF-8, attempt to use the part's declared charset
when reading it, falling back to US-ASCII if the declared charset is
unknown, unsupported or invalid.

7 years agonotmuch-mutt: use env to locate perl for increased portability
Stefano Zacchiroli [Thu, 21 Apr 2016 18:10:25 +0000 (14:10 -0400)]
notmuch-mutt: use env to locate perl for increased portability

Note: this patch drops -w from the shebang line, but we still have
"use warnings" in the script, which is superior anyhow.

Thanks Andreas Tolfsen for the suggestion.

7 years agodebian: add versioned depends on dpkg-dev 0.22 debian/0.22-1
David Bremner [Wed, 27 Apr 2016 00:40:40 +0000 (21:40 -0300)]
debian: add versioned depends on dpkg-dev

This is needed to support build profiles (e.g. nocheck)

7 years agodebian: add changelog stanza for 0.22
David Bremner [Wed, 27 Apr 2016 00:38:15 +0000 (21:38 -0300)]
debian: add changelog stanza for 0.22

7 years agobump version and NEWS date for 0.22 release
David Bremner [Wed, 27 Apr 2016 00:32:24 +0000 (21:32 -0300)]
bump version and NEWS date for 0.22 release

7 years agoNEWS: mention try-emacs-mua
Tomi Ollila [Mon, 25 Apr 2016 08:44:25 +0000 (11:44 +0300)]
NEWS: mention try-emacs-mua

A non-technical introduction for users who read NEWS to have better
chance to find ./devel/notmuch-emacs-mua when they test or experiment
with notmuch emacs MUA next time.

7 years agodebian: changelog stanza for 0.22~rc1-1 0.22_rc1 debian/0.22_rc1-1
David Bremner [Sun, 24 Apr 2016 21:03:54 +0000 (18:03 -0300)]
debian: changelog stanza for 0.22~rc1-1

7 years agoversion: bump to 0.22~rc1
David Bremner [Sun, 24 Apr 2016 21:02:05 +0000 (18:02 -0300)]
version: bump to 0.22~rc1

7 years agoNEWS: entry for emacs mua address completion
David Bremner [Sun, 24 Apr 2016 11:47:41 +0000 (08:47 -0300)]
NEWS: entry for emacs mua address completion

7 years agoNEWS: document some bug fixes
David Bremner [Sun, 24 Apr 2016 11:44:00 +0000 (08:44 -0300)]
NEWS: document some bug fixes

7 years agoNEWS: document S/MIME support
David Bremner [Sun, 24 Apr 2016 11:36:09 +0000 (08:36 -0300)]
NEWS: document S/MIME support

7 years agoNEWS: note no-op-ness of notmuch-message-address-insinuate
David Bremner [Sat, 16 Apr 2016 15:25:55 +0000 (12:25 -0300)]
NEWS: note no-op-ness of notmuch-message-address-insinuate

7 years agoNEWS: note dropping "pkg-config emacs"
David Bremner [Sat, 16 Apr 2016 15:25:34 +0000 (12:25 -0300)]
NEWS: note dropping "pkg-config emacs"

7 years agoNEWS: add note about xapian 1.3 support
David Bremner [Sat, 16 Apr 2016 15:04:22 +0000 (12:04 -0300)]
NEWS: add note about xapian 1.3 support

7 years agodoc: change copyright date
David Bremner [Sun, 24 Apr 2016 20:49:18 +0000 (17:49 -0300)]
doc: change copyright date

Yes, it is 2016

8 years agoEmacs related NEWS for 0.22.
David Edmondson [Sun, 17 Apr 2016 21:39:53 +0000 (22:39 +0100)]
Emacs related NEWS for 0.22.

8 years agoemacs: Don't indent multipart sub-parts during reply.
David Edmondson [Tue, 12 Apr 2016 08:04:04 +0000 (09:04 +0100)]
emacs: Don't indent multipart sub-parts during reply.

When generating cited messages for replay, override any existing
setting for `notmuch-show-indent-multipart' to ensure that no
indentation occurs.

8 years agodebian: minimal changelog for 0.22~rc0-1 0.22_rc0 debian/0.22_rc0-1
David Bremner [Sat, 16 Apr 2016 11:45:56 +0000 (08:45 -0300)]
debian: minimal changelog for 0.22~rc0-1

8 years agoversion: bump to 0.22~rc0
David Bremner [Sat, 16 Apr 2016 11:44:39 +0000 (08:44 -0300)]
version: bump to 0.22~rc0

8 years agobindings: drop build time message on missing ruby dependency
Jani Nikula [Wed, 13 Apr 2016 18:08:45 +0000 (21:08 +0300)]
bindings: drop build time message on missing ruby dependency

The usual make message on everything being up to date is:

make: Nothing to be done for 'all'.

However, since

commit d038b9320949c79503fe4b76870aaabf279405ab
Author: David Bremner <david@tethera.net>
Date:   Mon Jun 1 09:08:59 2015 +0200

    build: integrate building ruby bindings into notmuch build process

if one doesn't have the ruby dependencies installed, the message has
been:

Missing dependency, skipping ruby bindings

Restore the usual behaviour by dropping the message. It's redundant
during build anyway, since the configure script already outputs:

Checking for ruby development files... No (skipping ruby bindings)

8 years agoemacs: Add notmuch homepage to package header
Chunyang Xu [Wed, 13 Apr 2016 07:58:48 +0000 (03:58 -0400)]
emacs: Add notmuch homepage to package header

So user can find out notmuch's homepage with:

  C-h P ('describe-package') notmuch

8 years agoemacs: Fix packaging
Chunyang Xu [Wed, 13 Apr 2016 07:58:47 +0000 (03:58 -0400)]
emacs: Fix packaging

Refer to (info "(elisp) Library Headers") for package conventions.

8 years agocomplete ghost-on-removal-when-shared-thread-exists
Daniel Kahn Gillmor [Sat, 9 Apr 2016 01:54:52 +0000 (22:54 -0300)]
complete ghost-on-removal-when-shared-thread-exists

To fully complete the ghost-on-removal-when-shared-thread-exists
proposal, we need to clear all ghost messages when the last active
message is removed from a thread.

Amended by db: Remove the last test of T530, as it no longer makes sense
if we are garbage collecting ghost messages.

8 years agoOn deletion, replace with ghost when other active messages in thread
Daniel Kahn Gillmor [Sat, 9 Apr 2016 01:54:51 +0000 (22:54 -0300)]
On deletion, replace with ghost when other active messages in thread

There is no need to add a ghost message upon deletion if there are no
other active messages in the thread.

Also, if the message being deleted was a ghost already, we can just go
ahead and delete it.

8 years agoIntroduce _notmuch_message_has_term()
Daniel Kahn Gillmor [Sat, 9 Apr 2016 01:54:50 +0000 (22:54 -0300)]
Introduce _notmuch_message_has_term()

It can be useful to easily tell if a given message has a given term
associated with it.

8 years agoAdd internal functions to search for alternate doc types
Daniel Kahn Gillmor [Sat, 9 Apr 2016 01:54:49 +0000 (22:54 -0300)]
Add internal functions to search for alternate doc types

Publicly we are only exposing the non-ghost documents (of "type"
"mail").  But internally we might want to inspect the ghost messages
as well.

This changeset adds two new private interfaces to queries to recover
information about alternate document types.

8 years agofix thread breakage via ghost-on-removal
Daniel Kahn Gillmor [Sat, 9 Apr 2016 01:54:48 +0000 (22:54 -0300)]
fix thread breakage via ghost-on-removal

implement ghost-on-removal, the solution to T590-thread-breakage.sh
that just adds a ghost message after removing each message.

It leaks information about whether we've ever seen a given message id,
but it's a fairly simple implementation.

Note that _resolve_message_id_to_thread_id already introduces new
message_ids to the database, so i think just searching for a given
message ID may introduce the same metadata leakage.

8 years agotest thread breakage when messages are removed and re-added
Daniel Kahn Gillmor [Sat, 9 Apr 2016 01:54:47 +0000 (22:54 -0300)]
test thread breakage when messages are removed and re-added

This test (T590-thread-breakage.sh) has known-broken subtests.

If you have a two-message thread where message "B" is in-reply-to "A",
notmuch rightly sees this as a single thread.

But if you:

 * remove "A" from the message store
 * run "notmuch new"
 * add "A" back into the message store
 * re-run "notmuch new"

Then notmuch sees the messages as distinct threads.

This happens because if you insert "B" initially (before anything is
known about "A"), then a "ghost message" gets added to the database in
reference to "A" that is in the same thread, which "A" takes over when
it appears.

But if "A" is subsequently removed, no ghost message is retained, so
when "A" appears, it is treated as a new thread.

I see a few options to fix this:

ghost-on-removal
----------------

We could unilaterally add a ghost upon message removal.  This has a
few disadvantages: the message index would leak information about what
messages the user has ever been exposed to, and we also create a
perpetually-growing dataset -- the ghosts can never be removed.

ghost-on-removal-when-shared-thread-exists
------------------------------------------

We could add a ghost upon message removal iff there are other
non-ghost messages with the same thread ID.

We'd also need to remove all ghost messages that share a thread when
the last non-ghost message in that thread is removed.

This still has a bit of information leakage, though: the message index
would reveal that i've seen a newer message in a thread, even if i had
deleted it from my message store

track-dependencies
------------------

rather than a simple "ghost-message" we could store all the (A,B)
message-reference pairs internally, showing which messages A reference
which other messages B.

Then removal of message X would require deleting all message-reference
pairs (X,B), and only deleting a ghost message if no (A,X) reference
pair exists.

This requires modifying the database by adding a new and fairly weird
table that would need to be indexed by both columns.  I don't know
whether xapian has nice ways to do that.

scan-dependencies
-----------------

Without modifying the database, we could do something less efficient.

Upon removal of message X, we could scan the headers of all non-ghost
messages that share a thread with X.  If any of those messages refers
to X, we would add a ghost message.  If none of them do, then we would
just drop X entirely from the table.

---------------------

One risk of attempted fixes to this problem is that we could fail to
remove the search term indexes entirely.  This test contains
additional subtests to guard against that.

This test also ensures that the right number of ghost messages exist
in each situation; this will help us ensure we don't accumulate ghosts
indefinitely or leak too much information about what messages we've
seen or not seen, while still making it easy to reassemble threads
when messages come in out-of-order.

8 years agotest: add test-binary to print the number of ghost messages
David Bremner [Sat, 9 Apr 2016 01:54:46 +0000 (22:54 -0300)]
test: add test-binary to print the number of ghost messages

This one-liner seems preferable to the complications of depending on
delve, getting the binary name right and parsing the output.

8 years agolib: clean up _notmuch_database_split_path
Jani Nikula [Sun, 10 Apr 2016 19:43:23 +0000 (22:43 +0300)]
lib: clean up _notmuch_database_split_path

Make the logic it a bit easier to read. No functional changes.

8 years agolib: fix handling of one character long directory names at top level
Jani Nikula [Sun, 10 Apr 2016 19:43:22 +0000 (22:43 +0300)]
lib: fix handling of one character long directory names at top level

The code to skip multiple slashes in _notmuch_database_split_path()
skips back one character too much. This is compensated by a +1 in the
length parameter to the strndup() call. Mostly this works fine, but if
the path is to a file under a top level directory with one character
long name, the directory part is mistaken to be part of the file name
(slash == path in code). The returned directory name will be the empty
string and the basename will be the full path, breaking the indexing
logic in notmuch new.

Fix the multiple slash skipping to keep the slash variable pointing at
the last slash, and adjust strndup() accordingly.

The bug was introduced in

commit e890b0cf4011fd9fd77ebd87343379e4a778888b
Author: Carl Worth <cworth@cworth.org>
Date:   Sat Dec 19 13:20:26 2009 -0800

    database: Store the parent ID for each directory document.

just a little over two months after the initial commit in the Notmuch
code history, making this the longest living bug in Notmuch to date.

8 years agotest: test one character long directory names at top level
Jani Nikula [Sun, 10 Apr 2016 19:43:21 +0000 (22:43 +0300)]
test: test one character long directory names at top level

Yes, it's broken. Reported by h01ger on IRC.

8 years agotest: cope with glass backend file naming variations
David Bremner [Sat, 9 Apr 2016 01:49:50 +0000 (22:49 -0300)]
test: cope with glass backend file naming variations

In several places in the test suite we intentionally corrupt the Xapian
database in order to test error handling. This corruption is specific to
the on-disk organization of the database, and that changed with the
glass backend. We use the previously computed default backend to make
the tests adapt to changing names.

8 years agoconfigure: add test for default xapian backend
David Bremner [Sat, 9 Apr 2016 01:49:49 +0000 (22:49 -0300)]
configure: add test for default xapian backend

This is mainly for the test suite.  We already expect the tests to be
run in the same environment as configure was run, at least to get the
name of the python interpreter. So we are not really imposing a new
restriction.

8 years agotest/atomicity: guard chert-only optimization
David Bremner [Sat, 9 Apr 2016 01:49:48 +0000 (22:49 -0300)]
test/atomicity: guard chert-only optimization

This should potentially be updated to have an equivalent optimization
for the glass backend, but it in my unscientific tests, the glass backend
without the optimization is faster then the chert backend with.

8 years agotest: improve error handling in lib-error tests
David Bremner [Sat, 9 Apr 2016 01:49:47 +0000 (22:49 -0300)]
test: improve error handling in lib-error tests

There is at least one bug fixed here (missing parameter to printf), even
if exiting via segfault is considered OK.

8 years agoemacs: make use of `message-make-from'
aeuii@posteo.de [Fri, 8 Apr 2016 21:43:27 +0000 (23:43 +0200)]
emacs: make use of `message-make-from'

Please put my address in CC when replying.  Thanks!

From 4b9ab261a0ea8a31065e310c5150f522be86d37b Mon Sep 17 00:00:00 2001
From: stefan <aeuii@posteo.de>
Date: Fri, 8 Apr 2016 22:47:06 +0200
Subject: [PATCH] emacs: make use of `message-make-from'

Will respect `mail-from-style'.

8 years agoemacs: Always insert crypto buttons.
David Edmondson [Sun, 3 Apr 2016 15:38:22 +0000 (16:38 +0100)]
emacs: Always insert crypto buttons.

When no decryption or signature examination is
happening (i.e. `notmuch-crypto-process-mime' is `nil') insert buttons
that indicate this, rather than remaining silent.

8 years agoemacs: Allow part preferences to depend on message content.
David Edmondson [Sun, 3 Apr 2016 16:04:38 +0000 (17:04 +0100)]
emacs: Allow part preferences to depend on message content.

Currently the preference for which sub-part of a multipart/alternative
part is shown is global. Allow to the user to override the settings on a
per-message basis by providing the ability to call a function that has
access to the message to return the discouraged type list.

The original approach is retained as the default.

8 years agoconfigure: autodetect xapian-1.3
David Bremner [Sat, 26 Mar 2016 17:57:11 +0000 (14:57 -0300)]
configure: autodetect xapian-1.3

Mimic the handling of python2 versus python3. In particular if both
xapian-config and xapian-config-1.3 are found, use xapian-config

8 years agocli/new: add better error messages for FILE_ERROR
David Bremner [Wed, 30 Mar 2016 02:03:02 +0000 (23:03 -0300)]
cli/new: add better error messages for FILE_ERROR

The code in add_file seems to assume that NOTMUCH_STATUS_FILE_ERROR is
never returned from add_message. This turns out to be false (although it
seems to only happen in certain fairly rare race conditions).

8 years agoCLI: add print_status_database
David Bremner [Sun, 10 Jan 2016 01:34:21 +0000 (21:34 -0400)]
CLI: add print_status_database

This could probably be used at quite a few places in the existing code,
but in the immediate future I plan to use in some new code in
notmuch-dump

8 years agonmbug: ignore # comments
David Bremner [Sun, 27 Mar 2016 20:25:11 +0000 (17:25 -0300)]
nmbug: ignore # comments

Lines starting with # have always (for a long time, anyway) been ignored
by notmuch-restore, but have not been generated by notmuch-dump
previously.  In order to make nmbug robust against such output, ignore
comment lines.

8 years agoemacs: Improve the acquisition of text parts.
David Edmondson [Tue, 8 Mar 2016 17:12:59 +0000 (17:12 +0000)]
emacs: Improve the acquisition of text parts.

`notmuch-get-bodypart-text' assumed that it is always possible to
acquire text/* parts via the sexp output format. This is not true if the
part in question has a content type of application/octet-stream but is
being interpreted as text/* based on the extension of the part filename.

Rework `notmuch-get-bodypart-text' to use the raw output format to
address this and make the implementation common with that of
`notmuch-get-bodypart-binary'.

8 years agoemacs: Neaten `notmuch-show-insert-bodypart-internal'.
David Edmondson [Tue, 8 Mar 2016 17:12:58 +0000 (17:12 +0000)]
emacs: Neaten `notmuch-show-insert-bodypart-internal'.

8 years agoemacs: `notmuch-show-insert-part-multipart/encrypted' should not assume the presence...
David Edmondson [Tue, 8 Mar 2016 17:12:57 +0000 (17:12 +0000)]
emacs: `notmuch-show-insert-part-multipart/encrypted' should not assume the presence of a button.

Missed in c802d12a1e43fe69f2fcf7a2f7d44018a55bfb65.

8 years agotest/test-lib.el: revert setting notmuch-mua-reply-insert-header-p-function
Tomi Ollila [Sat, 19 Mar 2016 15:50:29 +0000 (17:50 +0200)]
test/test-lib.el: revert setting notmuch-mua-reply-insert-header-p-function

in d27d90875dfb1 (2016-02-20) notmuch-mua-reply-insert-header-p-function
was set to notmuch-show-reply-insert-header-p-never as its default was
changed to something else. Now that default is set back to *-never so
this change done in d27d90875dfb1 is not needed anymore.

8 years agoNEWS: Consolidate nmbug-status and notmuch-report sections
W. Trevor King [Thu, 24 Mar 2016 17:08:18 +0000 (10:08 -0700)]
NEWS: Consolidate nmbug-status and notmuch-report sections

These are the same tool; the nmbug-status text just landed before the
name change.  We can also drop the message-url details from NEWS,
since they're already in the man page.

8 years agoemacs: `notmuch-show-forward-message' can use `notmuch-mua-new-forward-messages'
David Edmondson [Mon, 8 Feb 2016 11:34:22 +0000 (11:34 +0000)]
emacs: `notmuch-show-forward-message' can use `notmuch-mua-new-forward-messages'

Which allows `notmuch-mua-new-forward-message' to be removed.

8 years agoemacs: Add `notmuch-show-forward-open-messages'.
David Edmondson [Mon, 8 Feb 2016 11:34:21 +0000 (11:34 +0000)]
emacs: Add `notmuch-show-forward-open-messages'.

Add a function to forward all open messages in the current view of a
thread. Bind this to "F".

8 years agoemacs: Improve crypto button labels.
David Edmondson [Tue, 9 Feb 2016 12:23:49 +0000 (12:23 +0000)]
emacs: Improve crypto button labels.

Make the labels for both encryption and signature buttons share a common
format, in which both report the status if it is not one of those known.

8 years agoNEWS: Document the notmuch-report branch
W. Trevor King [Sat, 2 Jan 2016 06:08:05 +0000 (22:08 -0800)]
NEWS: Document the notmuch-report branch

8 years agonotmuch-report: Add notmuch-report(1) and notmuch-report.json(5) man pages
W. Trevor King [Sat, 2 Jan 2016 06:08:04 +0000 (22:08 -0800)]
notmuch-report: Add notmuch-report(1) and notmuch-report.json(5) man pages

To describe the script and config file format, so folks don't have to
dig through NEWS or the script's source to get that information.

The Makefile and conf.py are excerpted from the main doc/ directory
with minor simplifications and adjustments.  The devel/nmbug/ scripts
are largely independent of notmuch, and separating the docs here
allows packagers to easily build the docs and install the scripts in a
separate package, without complicating notmuch's core build/install
process.

8 years agonotmuch-report.json: Rename from status-config.json
W. Trevor King [Sat, 2 Jan 2016 06:08:03 +0000 (22:08 -0800)]
notmuch-report.json: Rename from status-config.json

status-config.json wasn't obviously associated with the old
nmubg-status, now notmuch-report.  The new name is
${CONFIGURED_SCRIPT}.json, so the association should be clear.

8 years agonotmuch-report: Rename from nmbug-status
W. Trevor King [Sat, 2 Jan 2016 06:08:02 +0000 (22:08 -0800)]
notmuch-report: Rename from nmbug-status

This script generates reports based on notmuch queries, and doesn't
really have anything to do with nmbug, except for sharing the NMBGIT
environment variable.

8 years agostatus-config.json: Remove parens from query entry
W. Trevor King [Sat, 2 Jan 2016 06:07:43 +0000 (22:07 -0800)]
status-config.json: Remove parens from query entry

These are now added by nmbug-status.

8 years agonmbug-status: Wrap query phrases in parentheses when and-ing together
W. Trevor King [Sat, 2 Jan 2016 06:07:42 +0000 (22:07 -0800)]
nmbug-status: Wrap query phrases in parentheses when and-ing together

For example:

  "query": ["tag:a", "tag:b or tag:c"]

is now converted to:

  ( tag:a ) and ( tag:b or tag:c )

instead of the old:

  tag:a and tag:b or tag:c

This helps us avoid confusion due to Xapian's higher-precedence AND
[1], where the old query would be interpreted as:

  ( tag:a and tag:b ) or tag:c

[1]: http://xapian.org/docs/queryparser.html

8 years agonmbug-status: Add meta.message-url config setting
W. Trevor King [Sat, 2 Jan 2016 06:07:41 +0000 (22:07 -0800)]
nmbug-status: Add meta.message-url config setting

So you can link to archives other than Gmane.  For example, I'm doing
this in [1].

[1]: https://github.com/wking/nmbug-oci