]> git.notmuchmail.org Git - notmuch/log
notmuch
6 years agodebian: bump Standards-Version to 4.1.1
Daniel Kahn Gillmor [Thu, 30 Nov 2017 09:40:42 +0000 (04:40 -0500)]
debian: bump Standards-Version to 4.1.1

No minor changes were necessary to become compliant with Debian policy
version 4.1.1, so this is basically a freebie.

6 years agodebian/control: Priority: extra is deprecated
Daniel Kahn Gillmor [Thu, 30 Nov 2017 09:40:41 +0000 (04:40 -0500)]
debian/control: Priority: extra is deprecated

Move transitional package to to "oldlibs/optional"

This resolves two lintian warnings:

W: notmuch-emacs: transitional-package-should-be-oldlibs-optional oldlibs/extra
W: notmuch-emacs: priority-extra-is-replaced-by-priority-optional

6 years agodebian/changelog: remove trailing whitespace
Daniel Kahn Gillmor [Thu, 30 Nov 2017 09:40:40 +0000 (04:40 -0500)]
debian/changelog: remove trailing whitespace

6 years agotest: unbreak performance tests
David Bremner [Sat, 2 Dec 2017 12:53:04 +0000 (08:53 -0400)]
test: unbreak performance tests

In 8e7fb88237aedea22 Jani replaced the use of $(pwd -P) to find the
TEST_DIRECTORY in order to better support out of tree
builds. Unfortunately the performance-tests need a different value for
the variable and were thus broken.

This commit splits out the setting of this variable for the two sets
of tests.  Performance tests still don't work out of tree, because
the handling of the downloaded corpus needs to be updated.

6 years agotest: test notmuch insert --folder=""
Jani Nikula [Thu, 2 Nov 2017 19:08:57 +0000 (21:08 +0200)]
test: test notmuch insert --folder=""

Test insert into top level folder.

6 years agocli: allow empty strings for notmuch insert --folder argument
Jani Nikula [Sat, 14 Oct 2017 13:15:43 +0000 (16:15 +0300)]
cli: allow empty strings for notmuch insert --folder argument

Now that it's easy to add argument specific modifiers in opt
descriptions, add a new .allow_empty field to allow empty strings for
individual string arguments while retaining strict checks
elsewhere. Use this for notmuch insert --folder, where the empty
string means top level folder.

6 years agoMerge branch 'release'
David Bremner [Mon, 6 Nov 2017 00:25:54 +0000 (20:25 -0400)]
Merge branch 'release'

Changes from 0.25.2 release

6 years agodebian: changelog for 0.25.2-1 0.25.2 debian/0.25.2-1
David Bremner [Mon, 6 Nov 2017 00:06:23 +0000 (20:06 -0400)]
debian: changelog for 0.25.2-1

6 years agoversion: bump to 0.25.2
David Bremner [Sun, 5 Nov 2017 23:59:30 +0000 (19:59 -0400)]
version: bump to 0.25.2

6 years agoNEWS for 0.25.2
David Bremner [Sun, 5 Nov 2017 23:54:40 +0000 (19:54 -0400)]
NEWS for 0.25.2

6 years agocli/crypto: fix segfault on failed gmime2 crypto context creation
Jani Nikula [Mon, 16 Oct 2017 15:40:44 +0000 (18:40 +0300)]
cli/crypto: fix segfault on failed gmime2 crypto context creation

Commit 1fdc08d0ffab ("cli/crypto: treat failure to create a crypto
context as fatal.") started treating crypto context creation failures
"as fatal", returning NULL from _mime_node_create().

Unfortunately, we do not have NULL checks for _mime_node_create()
failures. The only caller, mime_node_child(), could check and return
NULL (as it's documented to do on errors) but none of the several call
sites have NULL checks either. And none of them really have a trivial
but feasible and graceful way of recovery.

So while the right thing to do would be to handle NULL returns
properly all over the place, and we have other scenarios that do
return NULL from above mentioned functions, the crypto context
creation failure is something that does seem to show up regularly in
some scenarios, revert back to the functionality before commit
1fdc08d0ffab as an interim fix.

6 years agotest: fix test database backup/restore location
Jani Nikula [Tue, 24 Oct 2017 18:36:11 +0000 (21:36 +0300)]
test: fix test database backup/restore location

backup_database() and restore_database() used to store the backups in
the test specific temporary directory, through the current working
directory being there. Commit 8e7fb88237ae ("test: use source and
build paths in test-lib-common.sh") started using a test specific
backup directories under the build tree test directory. This was in
error. Switch back to the old location, but using paths to the
location instead of relying on current working directory.

Reported by Daniel Kahn Gillmor <dkg@fifthhorseman.net>.

6 years agoNEWS: cleartext indexing
Daniel Kahn Gillmor [Sun, 22 Oct 2017 15:36:34 +0000 (11:36 -0400)]
NEWS: cleartext indexing

give a short summary of cleartext indexing of encrypted e-mail
messages.

6 years agoNEWS: test suite out-of-tree builds
Jani Nikula [Sat, 21 Oct 2017 19:53:28 +0000 (22:53 +0300)]
NEWS: test suite out-of-tree builds

Out-of-tree builds now work and supersede --root option.

6 years agocli/reindex: add --try-decrypt=(true|false)
Daniel Kahn Gillmor [Sat, 21 Oct 2017 02:25:48 +0000 (22:25 -0400)]
cli/reindex: add --try-decrypt=(true|false)

Enable override of the index.try_decrypt setting on a per-run basis
when invoking "notmuch reindex".  This allows the possibility of (for
example) an emacs keybinding that adds the cleartext of the currently
shown decrypted message to the index, making it searchable in the
future.

It also enables one-time indexing of all messages matching some query,
like so:

    notmuch reindex tag:encrypted and\
       not property:index.decryption=success and\
       from:alice@example.org

We also update the documentation and tab completion, and add a few
more tests.

6 years agocli/insert: add --try-decrypt=(true|false)
Daniel Kahn Gillmor [Sat, 21 Oct 2017 02:25:47 +0000 (22:25 -0400)]
cli/insert: add --try-decrypt=(true|false)

Enable override of the index.try_decrypt setting on a per-message
basis when invoking "notmuch insert".

We also update the documentation and tab completion, and add more tests.

6 years agocli/new: add --try-decrypt=(true|false)
Daniel Kahn Gillmor [Sat, 21 Oct 2017 02:25:46 +0000 (22:25 -0400)]
cli/new: add --try-decrypt=(true|false)

Enable override of the index.try_decrypt setting during "notmuch new"
on a per-invocation basis.

We update the documentation and tab completion, and also add a test.

6 years agotests: emacs_fcc_message: allow passing --arguments to notmuch new
Daniel Kahn Gillmor [Sat, 21 Oct 2017 02:25:45 +0000 (22:25 -0400)]
tests: emacs_fcc_message: allow passing --arguments to notmuch new

Subsequent patches may want to send GNU-style --long-arguments to
notmuch new in the test suite, in particular when invoking
emacs_fcc_message.  This changeset makes that possible.

6 years agocli: set up shared command-line arguments for indexing
Daniel Kahn Gillmor [Sat, 21 Oct 2017 02:25:44 +0000 (22:25 -0400)]
cli: set up shared command-line arguments for indexing

We have an indexopts structure for manipulating indexing in different
ways, but we also have three command-line invocations that can trigger
indexing: new, insert, and reindex.

This changeset prepares a common parser that these subcommands can
share.

Note: if the deprecated crypto.gpg_path configuration option is set to
anything other than "gpg", we ignore it (and print a warning on
stderr, if built against gmime < 3.0).

At the moment, it's just --try-decrypt, but others will likely follow.

6 years agoconfig: define new option index.try_decrypt
Daniel Kahn Gillmor [Sat, 21 Oct 2017 02:25:43 +0000 (22:25 -0400)]
config: define new option index.try_decrypt

By default, notmuch won't try to decrypt on indexing.  With this
patch, we make it possible to indicate a per-database preference using
the config variable "index.try_decrypt", which by default will be
false.

At indexing time, the database needs some way to know its internal
defaults for how to index encrypted parts.  It shouldn't be contingent
on an external config file (since that can't be retrieved from the
database object itself), so we store it in the database.

This behaves similarly to the query.* configurations, which are also
stored in the database itself, so we're not introducing any new
dependencies by requiring that it be stored in the database.

6 years agoconfig: test whether an item is stored in the database by name
Daniel Kahn Gillmor [Sat, 21 Oct 2017 02:25:42 +0000 (22:25 -0400)]
config: test whether an item is stored in the database by name

QUERY_STRING was only used in two places, both to test whether a
variable should be stored in (or retrieved from) the database.

Since other configuration variables might be stored in the database in
the future, consolidate that test into a single function.

We also document that these configuration options should not be placed
in the config file.

6 years agocrypto: index encrypted parts when indexopts try_decrypt is set.
Daniel Kahn Gillmor [Sat, 21 Oct 2017 02:25:41 +0000 (22:25 -0400)]
crypto: index encrypted parts when indexopts try_decrypt is set.

If we see index options that ask us to decrypt when indexing a
message, and we encounter an encrypted part, we'll try to descend into
it.

If we can decrypt, we add the property index.decryption=success.

If we can't decrypt (or recognize the encrypted type of mail), we add
the property index.decryption=failure.

Note that a single message may have both values of the
"index.decryption" property: "success" and "failure".  For example,
consider a message that includes multiple layers of encryption.  If we
manage to decrypt the outer layer ("index.decryption=success"), but
fail on the inner layer ("index.decryption=failure").

Because of the property name, this will be automatically cleared (and
possibly re-set) during re-indexing.  This means it will subsequently
correspond to the actual semantics of the stored index.

6 years agoreindex: drop all properties named with prefix "index."
Daniel Kahn Gillmor [Sat, 21 Oct 2017 02:25:40 +0000 (22:25 -0400)]
reindex: drop all properties named with prefix "index."

This allows us to create new properties that will be automatically set
during indexing, and cleared during re-indexing, just by choice of
property name.

6 years agodoc: add notmuch-properties(7)
Daniel Kahn Gillmor [Sat, 21 Oct 2017 02:25:39 +0000 (22:25 -0400)]
doc: add notmuch-properties(7)

We will want a user-facing place to record details about the use of
notmuch properties shortly.  This establishes a new manual page for
that purpose.

6 years agoindex: implement notmuch_indexopts_t with try_decrypt
Daniel Kahn Gillmor [Sat, 21 Oct 2017 02:25:38 +0000 (22:25 -0400)]
index: implement notmuch_indexopts_t with try_decrypt

This is currently mostly a wrapper around _notmuch_crypto_t that keeps
its internals private and doesn't expose any of the GMime API.
However, non-crypto indexing options might also be added later
(e.g. filters or other transformations).

6 years agobuild: don't copy the test directory for out-of-tree builds
Jani Nikula [Mon, 25 Sep 2017 20:38:39 +0000 (23:38 +0300)]
build: don't copy the test directory for out-of-tree builds

It should now work without.

6 years agotest: use source path in add_gnupg_home
Jani Nikula [Sat, 21 Oct 2017 19:21:41 +0000 (22:21 +0300)]
test: use source path in add_gnupg_home

Make a distinction between source and build directories.

6 years agotest: remove --root option and fix TMP_DIRECTORY cleanup
Jani Nikula [Sat, 21 Oct 2017 11:58:02 +0000 (14:58 +0300)]
test: remove --root option and fix TMP_DIRECTORY cleanup

The primary motivation here is to fix TMP_DIRECTORY cleanup prior to
running each test when the current working directory is not the test
subdirectory. Tests with failures would leave their TMP_DIRECTORY
directory behind for debugging, and repeated out-of-tree test runs
would have old temp directories. (This lead to e.g. T310-emacs.sh
hanging because emacs would prompt for overwriting files.)

We remove the likely anyway defunct --root test option while at it,
just to be on the safe side when doing 'rm -rf' on the TMP_DIRECTORY.

6 years agotest: use source and build paths in T590-thread-breakage.sh
Jani Nikula [Mon, 25 Sep 2017 20:38:38 +0000 (23:38 +0300)]
test: use source and build paths in T590-thread-breakage.sh

Make a distinction between source and build directories.

6 years agotest: use source and build paths in T480-hex-escaping.sh
Jani Nikula [Mon, 25 Sep 2017 20:38:37 +0000 (23:38 +0300)]
test: use source and build paths in T480-hex-escaping.sh

Make a distinction between source and build directories.

6 years agotest: use source and build paths in T4?0-emacs-*.sh
Jani Nikula [Mon, 25 Sep 2017 20:38:36 +0000 (23:38 +0300)]
test: use source and build paths in T4?0-emacs-*.sh

Make a distinction between source and build directories.

6 years agotest: use source and build paths in T380-atomicity.sh
Jani Nikula [Mon, 25 Sep 2017 20:38:35 +0000 (23:38 +0300)]
test: use source and build paths in T380-atomicity.sh

Make a distinction between source and build directories.

6 years agotest: use source and build paths in T360-symbol-hiding.sh
Jani Nikula [Mon, 25 Sep 2017 20:38:34 +0000 (23:38 +0300)]
test: use source and build paths in T360-symbol-hiding.sh

Make a distinction between source and build directories.

6 years agotest: use source and build paths in T355-smime.sh
Jani Nikula [Mon, 25 Sep 2017 20:38:33 +0000 (23:38 +0300)]
test: use source and build paths in T355-smime.sh

Make a distinction between source and build directories.

6 years agotest: use source and build paths in T310-emacs.sh
Jani Nikula [Mon, 25 Sep 2017 20:38:31 +0000 (23:38 +0300)]
test: use source and build paths in T310-emacs.sh

Make a distinction between source and build directories.

6 years agotest: use source and build paths in T260-thread-order.sh
Jani Nikula [Mon, 25 Sep 2017 20:38:30 +0000 (23:38 +0300)]
test: use source and build paths in T260-thread-order.sh

Make a distinction between source and build directories.

6 years agotest: use source and build paths in T160-json.sh and T170-sexp.sh
Jani Nikula [Mon, 25 Sep 2017 20:38:29 +0000 (23:38 +0300)]
test: use source and build paths in T160-json.sh and T170-sexp.sh

Make a distinction between source and build directories.

6 years agotest: use source and build paths in T000-basic.sh
Jani Nikula [Mon, 25 Sep 2017 20:38:28 +0000 (23:38 +0300)]
test: use source and build paths in T000-basic.sh

Make a distinction between source and build directories.

6 years agotest: use source and build paths in notmuch-test
Jani Nikula [Mon, 25 Sep 2017 20:38:27 +0000 (23:38 +0300)]
test: use source and build paths in notmuch-test

Make a distinction between source and build directories.

6 years agotest: mkdir and cd to $TMP_DIRECTORY instead of $test for testing
Jani Nikula [Mon, 25 Sep 2017 20:38:26 +0000 (23:38 +0300)]
test: mkdir and cd to $TMP_DIRECTORY instead of $test for testing

$TMP_DIRECTORY is a full path, while $test is not.

6 years agotest: use source and build paths in test-lib-common.sh
Jani Nikula [Mon, 25 Sep 2017 20:38:25 +0000 (23:38 +0300)]
test: use source and build paths in test-lib-common.sh

Make a distinction between source and build directories.

The expectation is that anyone sourcing test-lib-common.sh has sourced
export-dirs.sh.

6 years agoperf-test: use source and build paths in perf-test-lib.sh
Jani Nikula [Mon, 25 Sep 2017 20:38:24 +0000 (23:38 +0300)]
perf-test: use source and build paths in perf-test-lib.sh

Make a distinction between source and build directories.

6 years agotest: use source and build paths in test-lib.sh
Jani Nikula [Mon, 25 Sep 2017 20:38:23 +0000 (23:38 +0300)]
test: use source and build paths in test-lib.sh

Make a distinction between source and build directories.

6 years agotest: add a script to figure out source and build directories
Jani Nikula [Mon, 25 Sep 2017 20:38:22 +0000 (23:38 +0300)]
test: add a script to figure out source and build directories

Expect the tests to be run somewhere in the build directory
hierarchy. Allow for source and build directories to be passed through
the environment.

6 years agotest: check for notmuch binary in test-lib.sh
Jani Nikula [Mon, 25 Sep 2017 20:38:21 +0000 (23:38 +0300)]
test: check for notmuch binary in test-lib.sh

Move notmuch executable check into common code. Redundant for
notmuch-test runs, but works also for individual tests.

6 years agoperf-test: use $(dirname "$0") for sourcing perf-test-lib.sh
Jani Nikula [Mon, 25 Sep 2017 20:38:20 +0000 (23:38 +0300)]
perf-test: use $(dirname "$0") for sourcing perf-test-lib.sh

Don't assume the tests are always run from within the source tree.

6 years agotest: use $(dirname "$0") for sourcing test-lib.sh
Jani Nikula [Mon, 25 Sep 2017 20:38:19 +0000 (23:38 +0300)]
test: use $(dirname "$0") for sourcing test-lib.sh

Don't assume the tests are always run from within the source tree.

6 years agobuild: use NOTMUCH_SRCDIR for referencing notmuch-test
Jani Nikula [Mon, 25 Sep 2017 20:38:18 +0000 (23:38 +0300)]
build: use NOTMUCH_SRCDIR for referencing notmuch-test

Don't assume the tests are always run from within the source tree.

6 years agotest: use corpora/default not corpus in T480-hex-escaping.sh
Jani Nikula [Mon, 25 Sep 2017 20:38:17 +0000 (23:38 +0300)]
test: use corpora/default not corpus in T480-hex-escaping.sh

Turns out round trip tests didn't really round trip anything. Broken
by yours truly in 971cdc72cdb8 ("test: make it possible to have
multiple corpora"). Ooops.

6 years agoproperties: add notmuch_message_remove_all_properties_with_prefix()
Daniel Kahn Gillmor [Tue, 17 Oct 2017 19:09:59 +0000 (15:09 -0400)]
properties: add notmuch_message_remove_all_properties_with_prefix()

Subsequent patches will introduce a convention that properties whose
name starts with "index." will be stripped (and possibly re-added)
during re-indexing.  This patch lays the groundwork for doing that.

6 years agocrypto: make shared crypto code behave library-like
Daniel Kahn Gillmor [Tue, 17 Oct 2017 19:09:56 +0000 (15:09 -0400)]
crypto: make shared crypto code behave library-like

If we're going to reuse the crypto code across both the library and
the client, then it needs to report error states properly and not
write to stderr.

6 years agocrypto: move into libnotmuch_util
Daniel Kahn Gillmor [Tue, 17 Oct 2017 19:09:55 +0000 (15:09 -0400)]
crypto: move into libnotmuch_util

This prepares us for using the crypto object in both libnotmuch and
the client.

6 years agodoc: make SEE ALSO references one-per-line
Daniel Kahn Gillmor [Tue, 17 Oct 2017 16:57:21 +0000 (12:57 -0400)]
doc: make SEE ALSO references one-per-line

This will make future diffs cleaner, make it easier to keep them
alphabetical, and make it easier to scan and search the documentation
sources.

6 years agodoc: fix documentation typos and copy/paste-os
Daniel Kahn Gillmor [Tue, 17 Oct 2017 16:57:20 +0000 (12:57 -0400)]
doc: fix documentation typos and copy/paste-os

6 years agocli: make notmuch count --exclude a boolean argument
Jani Nikula [Sat, 14 Oct 2017 20:18:36 +0000 (23:18 +0300)]
cli: make notmuch count --exclude a boolean argument

Commit 0f314c0c99be ("cli: convert notmuch_bool_t to stdbool")
over-eagerly converted EXCLUDE_TRUE and EXCLUDE_FALSE to EXCLUDE_true
and EXCLUDE_false in notmuch-count.c. We could just fix the case back,
but convert the option to an actual boolean argument instead.

We've used a keyword argument rather than a boolean argument for
notmuch count --exclude for five years, since commit 785c1e497f05
("cli: move count to the new --exclude=(true|false|flag) naming
scheme."), "to allow future options to be added more easily". I think
we can conclude future options aren't coming any time soon.

6 years agogmime-extra: drop compat layer for g_mime_multipart_encrypted_decrypt
Daniel Kahn Gillmor [Tue, 10 Oct 2017 05:49:10 +0000 (01:49 -0400)]
gmime-extra: drop compat layer for g_mime_multipart_encrypted_decrypt

In practice, we're going to see this function invoked differently
depending on which gmime we build against.  The compatibility layer
forces our code into the lowest-common-denominator -- unable to make
use of new features even when built against a newer version.

Dropping the compatibility layer paves the way for clearer use of
features from GMime 3.0 in future commits.

6 years agotests: prepare for more crypto tests (using add_gnupg_home)
Daniel Kahn Gillmor [Tue, 10 Oct 2017 05:49:08 +0000 (01:49 -0400)]
tests: prepare for more crypto tests (using add_gnupg_home)

Move add_gnupg_home to test-lib.sh to prepare it for reuse.

6 years agogmime-extra: remove duplicate GMimeAddressType typedef
Daniel Kahn Gillmor [Tue, 10 Oct 2017 05:49:06 +0000 (01:49 -0400)]
gmime-extra: remove duplicate GMimeAddressType typedef

"typedef GMimeAddressType GMimeRecipientType" is already present
further down in the compatibility wrapper (with other typedefs).  We
don't need it twice.

6 years agocrypto: _notmuch_crypto_cleanup should return void
Daniel Kahn Gillmor [Tue, 10 Oct 2017 05:49:04 +0000 (01:49 -0400)]
crypto: _notmuch_crypto_cleanup should return void

There's no chance that _notmuch_crypto_cleanup() will ever return
anything other than 0, and no one ever checks its return value anyway.
So make it return void instead of int.

6 years agocrypto: drop pretense of notmuch_crypto_context_t
Daniel Kahn Gillmor [Tue, 10 Oct 2017 05:49:03 +0000 (01:49 -0400)]
crypto: drop pretense of notmuch_crypto_context_t

notmuch_crypto_context_t was introduced (i think) as some sort of
abstraction layer to make notmuch somewhat independent of GMime.  But
it isn't even useful for GMime 3.0 or later -- we can drop the
pretense that it's some sort of abstraction in this case, and just
call it what it is, GMimeCryptoContext, which is useful for building
against older versions of GMime.

This also renames _notmuch_crypto_get_context() to
_notmuch_crypto_get_gmime_context().

6 years agocrypto: rename notmuch_crypto_t to _notmuch_crypto_t
Daniel Kahn Gillmor [Tue, 10 Oct 2017 05:49:02 +0000 (01:49 -0400)]
crypto: rename notmuch_crypto_t to _notmuch_crypto_t

The notmuch_crypto_t struct isn't used externally, and we have no
plans to explicitly export it.  Prefix its name (and associated
functions) with _ to make that intent clear.

6 years agolib: convert notmuch_bool_t to stdbool internally
Jani Nikula [Sat, 7 Oct 2017 08:44:05 +0000 (11:44 +0300)]
lib: convert notmuch_bool_t to stdbool internally

C99 stdbool turned 18 this year. There really is no reason to use our
own, except in the library interface for backward
compatibility. Convert the lib internally to stdbool.

6 years agocli: convert notmuch_bool_t to stdbool
Jani Nikula [Sat, 7 Oct 2017 08:44:04 +0000 (11:44 +0300)]
cli: convert notmuch_bool_t to stdbool

C99 stdbool turned 18 this year. There really is no reason to use our
own, except in the library interface for backward
compatibility. Convert the cli and test binaries to stdbool.

6 years agodevel/check-out-of-tree-build.sh: consistent naming, consistent quoting
Tomi Ollila [Tue, 3 Oct 2017 05:18:25 +0000 (08:18 +0300)]
devel/check-out-of-tree-build.sh: consistent naming, consistent quoting

Renamed from out-of-tree-build-check.sh to be consistent with
other files in this directory.

Fixed quoting in "$srcdir" usage for additional robustness, other
quoting changes for consistency.

6 years agocli: reduce indent in keyword argument processing
Jani Nikula [Sun, 1 Oct 2017 20:53:21 +0000 (23:53 +0300)]
cli: reduce indent in keyword argument processing

Reducing indent makes future changes easier. No functional changes.

6 years agocli: change while to for in keyword argument processing
Jani Nikula [Sun, 1 Oct 2017 20:53:20 +0000 (23:53 +0300)]
cli: change while to for in keyword argument processing

Using a for loop makes it easier to use continue, in preparation for
future changes. No functional changes.

6 years agocli: refactor boolean argument processing
Jani Nikula [Sun, 1 Oct 2017 20:53:19 +0000 (23:53 +0300)]
cli: refactor boolean argument processing

Clean up the control flow to prepare for future changes. No functional
changes.

6 years agocli: use notmuch_bool_t for boolean argument in show
Jani Nikula [Sun, 1 Oct 2017 20:53:18 +0000 (23:53 +0300)]
cli: use notmuch_bool_t for boolean argument in show

Pedantically correct, although they're the same underlying type.

6 years agohex-xcode: use notmuch_bool_t for boolean arguments
Jani Nikula [Sun, 1 Oct 2017 20:53:17 +0000 (23:53 +0300)]
hex-xcode: use notmuch_bool_t for boolean arguments

Pedantically correct, although they're the same underlying type.

6 years agocli: use the arg parser .present feature to handle show --entire-thread
Jani Nikula [Sun, 1 Oct 2017 20:53:16 +0000 (23:53 +0300)]
cli: use the arg parser .present feature to handle show --entire-thread

The --entire-thread default depends on other arguments, so we'll have
to figure out if it was explicitly set by the user or not. The arg
parser .present feature helps us clean up the code here.

6 years agotest: expand argument parsing tests
Jani Nikula [Sun, 1 Oct 2017 20:53:15 +0000 (23:53 +0300)]
test: expand argument parsing tests

Test and use the new .present field, only output the parameters
given. Test space between parameter name and value.

6 years agocli: add .present field to opt desc to check if the arg was present
Jani Nikula [Sun, 1 Oct 2017 20:53:14 +0000 (23:53 +0300)]
cli: add .present field to opt desc to check if the arg was present

Add pointer to boolean .present field to opt desc, which (if non-NULL)
will be set to TRUE if the argument in question is present on the
command line. Unchanged otherwise.

6 years agotest: add opt_inherit to arg-test
Jani Nikula [Sun, 1 Oct 2017 20:53:13 +0000 (23:53 +0300)]
test: add opt_inherit to arg-test

Just split the arguments to two opt desc arrays.

6 years agotest: add boolean argument to arg-test
Jani Nikula [Sun, 1 Oct 2017 20:53:12 +0000 (23:53 +0300)]
test: add boolean argument to arg-test

Surprisingly it's not there.

6 years agocli: use designated initializers for opt desc
Jani Nikula [Sun, 1 Oct 2017 20:53:11 +0000 (23:53 +0300)]
cli: use designated initializers for opt desc

Several changes at once, just to not have to change the same lines
several times over:

- Use designated initializers to initialize opt desc arrays.

- Only initialize the needed fields.

- Remove arg_id (short options) as unused.

- Replace opt_type and output_var with several type safe output
  variables, where the output variable being non-NULL determines the
  type. Introduce checks to ensure only one is set. The downside is
  some waste of const space per argument; this could be saved by
  retaining opt_type and using a union, but that's still pretty
  verbose.

- Fix some variables due to the type safety. Mostly a good thing, but
  leads to some enums being changed to ints. This is pedantically
  correct, but somewhat annoying. We could also cast, but that defeats
  the purpose a bit.

- Terminate the opt desc arrays using {}.

The output variable type safety and the ability to add new fields for
just some output types or arguments are the big wins. For example, if
we wanted to add a variable to set when the argument is present, we
could do so for just the arguments that need it.

Beauty is in the eye of the beholder, but I think this looks nice when
defining the arguments, and reduces some of the verbosity we have
there.

6 years agocli: strip trailing "/" from the final maildir path in notmuch insert
Jani Nikula [Sun, 1 Oct 2017 20:53:10 +0000 (23:53 +0300)]
cli: strip trailing "/" from the final maildir path in notmuch insert

Several subtle interconnected changes here:

- If the folder name passed as argument is the empty string "" or
  slash "/", the final maildir path would end up having "//" in it. We
  should strip the final maildir path, not folder.

- The folder variable should really be const char *, another reason
  not to modify it.

- The maildir variable is only const to let us point it at db_path
  directly.

To be able to strip the maildir variable, always allocate it. Default
folder to the empty string "", and don't treat folder not being
present on the command line as anything special.

As a side effect, we also create the cur/new/tmp in the top level
directory if they're not there and --create-folder is given.

6 years agocli/new: ignore special directories also in pass 2
Jani Nikula [Fri, 1 Sep 2017 15:53:09 +0000 (18:53 +0300)]
cli/new: ignore special directories also in pass 2

Avoid passing . and .. to ignore check. We also don't need to check
their dirent type either.

6 years agocli/new: check for special directories earlier in pass 1
Jani Nikula [Fri, 1 Sep 2017 15:53:08 +0000 (18:53 +0300)]
cli/new: check for special directories earlier in pass 1

Avoid passing . and .. to ignore check. We don't need to check their
dirent type either.

6 years agodevel: add script to test out-of-tree builds
Jani Nikula [Mon, 11 Sep 2017 17:17:47 +0000 (20:17 +0300)]
devel: add script to test out-of-tree builds

Something I used for 'git bisect run', but we should really add this
as part of our process.

6 years agoT390-python: add test for get_message_parts and special characters
Florian Klink [Sun, 24 Sep 2017 12:36:12 +0000 (14:36 +0200)]
T390-python: add test for get_message_parts and special characters

This imports a message with ISO-8859-2 encoded characters, then opens
the database using the python bindings. We peek through all mesage
parts, afterwards print the message id.

Signed-off-by: Florian Klink <flokli@flokli.de>
Signed-off-by: Andreas Rammhold <andreas@rammhold.de>
6 years agopython: open messages in binary mode
Florian Klink [Sun, 24 Sep 2017 12:36:11 +0000 (14:36 +0200)]
python: open messages in binary mode

currently, notmuch's get_message_parts() opens the file in text mode and passes
the file object to email.message_from_file(fp). In case the email contains
UTF-8 characters, reading might fail inside email.parser with the following exception:

  File "/usr/lib/python3.6/site-packages/notmuch/message.py", line 591, in get_message_parts
    email_msg = email.message_from_binary_file(fp)
  File "/usr/lib/python3.6/email/__init__.py", line 62, in message_from_binary_file
    return BytesParser(*args, **kws).parse(fp)
  File "/usr/lib/python3.6/email/parser.py", line 110, in parse
    return self.parser.parse(fp, headersonly)
  File "/usr/lib/python3.6/email/parser.py", line 54, in parse
    data = fp.read(8192)
  File "/usr/lib/python3.6/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 1865: invalid continuation byte

To fix this, read file in binary mode and pass to
email.message_from_binary_file(fp).

Unfortunately, Python 2 doesn't support
email.message_from_binary_file(fp), so keep using
email.message_from_file(fp) there.

Signed-off-by: Florian Klink <flokli@flokli.de>
6 years agodoc: fix typos
Jakub Wilk [Tue, 26 Sep 2017 17:23:09 +0000 (19:23 +0200)]
doc: fix typos

6 years agoemacs: sanitize subject in replies
Jani Nikula [Tue, 26 Sep 2017 18:26:08 +0000 (21:26 +0300)]
emacs: sanitize subject in replies

Commit a7964c86d125 ("emacs: Sanitize authors and subjects in search
and show") added sanitization of header information for display. Do
the same for reply subjects.

This fixes the long-standing annoying artefact of certain versions of
mailman using tab as folding whitespace, leading to tabs in reply
subjects.

6 years agotest: add emacs reply test for subjects with TAB
Jani Nikula [Tue, 26 Sep 2017 18:26:07 +0000 (21:26 +0300)]
test: add emacs reply test for subjects with TAB

Expect TABs to be sanitized from the subject line. Known broken.

6 years agofix reference to notmuch_message_get_properties
Daniel Kahn Gillmor [Sat, 23 Sep 2017 14:46:13 +0000 (10:46 -0400)]
fix reference to notmuch_message_get_properties

6 years agolib: index the content-type of the parts of encrypted messages
Daniel Kahn Gillmor [Sat, 16 Sep 2017 14:59:05 +0000 (17:59 +0300)]
lib: index the content-type of the parts of encrypted messages

This is a logical followup to "lib: index the content type of
signature parts", which will make it easier to record the message
structure of all messages.

6 years agolib: index the content type of signature parts
Jani Nikula [Sat, 16 Sep 2017 14:59:04 +0000 (17:59 +0300)]
lib: index the content type of signature parts

It's useful (*) to be able to easily find messages with certain types
of signatures. Having the mimetype: prefix searches fail for some
content types is also genuinely surprising (*). Index the content type
of signature parts.

While at it, switch to the gmime convenience constants for content and
signature part indexes.

*) At least for developers of email software!

6 years agotest: signed and encrypted part content type indexing
Jani Nikula [Sat, 16 Sep 2017 14:59:03 +0000 (17:59 +0300)]
test: signed and encrypted part content type indexing

Add known broken subtests for searching signed and encrypted messages
using mimetype: prefix search for the content-types of signed and
encrypted parts.

6 years agolib: abstract content type indexing
Jani Nikula [Sat, 16 Sep 2017 14:59:02 +0000 (17:59 +0300)]
lib: abstract content type indexing

Make the follow-up change of indexing signature content types
easier. No functional changes.

6 years agodebian: update gitignore
David Bremner [Sun, 17 Sep 2017 18:53:15 +0000 (15:53 -0300)]
debian: update gitignore

elpa-notmuch is a new binary package, notmuch-dbg is no longer generated.

6 years agocli/new: abstract special directory check
Jani Nikula [Fri, 1 Sep 2017 15:53:07 +0000 (18:53 +0300)]
cli/new: abstract special directory check

Add an abstraction for . and .. directory checks. No functional
changes.

6 years agocli/new: use the same style for fs entry loops
Jani Nikula [Fri, 1 Sep 2017 15:53:06 +0000 (18:53 +0300)]
cli/new: use the same style for fs entry loops

Just to please the eyes. No functional changes.

6 years agobuild: fix out-of-tree builds, again
Jani Nikula [Sun, 10 Sep 2017 11:56:16 +0000 (14:56 +0300)]
build: fix out-of-tree builds, again

Broken, again, by yours truly in bc11759dd1fd ("build: switch to
hiding libnotmuch symbols by default"). Reference notmuch.sym via
$(srctree).

6 years agoemacs/address: use member instead of memq to check for pair
David Bremner [Wed, 13 Sep 2017 01:17:32 +0000 (22:17 -0300)]
emacs/address: use member instead of memq to check for pair

Quoting from the elisp reference:

     For other types (e.g., lists, vectors, strings), two arguments
     with the same contents or elements are not necessarily ‘eq’ to
     each other.

Thanks to "Attic Hermit" for the fix.

6 years agopython: deprecated add_message calls index_file correctly and returns result
Gaute Hope [Wed, 30 Aug 2017 08:16:33 +0000 (10:16 +0200)]
python: deprecated add_message calls index_file correctly and returns result

The deprecated Database.add_message now calls the new index_file with
correct number of arguments (without an extra `self`), and returns the
tuple from index_file - as it used to do before.

This change also adds a DeprecationWarning to the function.

6 years agoMerge tag '0.25.1'
David Bremner [Tue, 12 Sep 2017 01:32:00 +0000 (22:32 -0300)]
Merge tag '0.25.1'

notmuch 0.25.1 release (bugfix for emacs bug 28350)

6 years agodebian: changelog stanza for 0.25.1-1 0.25.1
David Bremner [Tue, 12 Sep 2017 01:22:22 +0000 (22:22 -0300)]
debian: changelog stanza for 0.25.1-1

6 years agoNEWS: news entry for 0.25.1
David Bremner [Tue, 12 Sep 2017 01:20:26 +0000 (22:20 -0300)]
NEWS: news entry for 0.25.1

6 years agoversion: bump to 0.25.1
David Bremner [Tue, 12 Sep 2017 01:19:46 +0000 (22:19 -0300)]
version: bump to 0.25.1

6 years agoemacs: override enriched-decode-display-prop for text/enriched display
Jani Nikula [Mon, 11 Sep 2017 20:09:49 +0000 (23:09 +0300)]
emacs: override enriched-decode-display-prop for text/enriched display

Switch to a local version of enriched-decode-display-prop if we
encounter a text/enriched part. This is to mitigate
https://bugs.gnu.org/28350. Normally it would be prudent to remove the
override afterwards, but in this case just leave it in.

Notes from db:
      This doesn't disable text/enriched, just one feature of it.