Commit graph

4967 commits

Author SHA1 Message Date
David Bremner
59fed50a82 lib: update cached mtime in notmuch_directory_set_mtime
Without this change, the following code fails

  notmuch_directory_set_mtime(dir, 12345);
  assert(notmuch_directory_get_mtime(dir) == 12345);
2016-08-23 20:58:46 -03:00
David Bremner
3ba1b938b5 doc: update cross references for notmuch.1
In particular add notmuch-compact(1) (Debian bug #825884)
2016-08-23 20:53:52 -03:00
David Bremner
9e177b236c lib: reword comment about XFOLDER: prefix
I believe the current one is misleading, because in my experiments
Xapian did not add : when prefix and term were both upper case. Indeed,
it's hard to see how it could, because prefixes are added at a layer
above Xapian in our code. See _notmuch_message_add_term for an example.

Also try to explain why this is a good idea.  As far as I can ascertain,
this is more of an issue for a system trying to work with an unknown set
of prefixes. Since notmuch has a fixed set of prefixes, and we can
hopefully be trusted not to add XGOLD and XGOLDEN as prefixes, it is
harder for problems to arise.
2016-08-18 05:11:37 -03:00
David Bremner
98da3c079a debian: changelog stanza for 0.22.1-3 2016-08-14 13:33:25 +09:00
David Bremner
cf8aabdd37 test: make gdb even quieter
gdb sometimes writes warnings to stdout, which we don't need/want, and
for some reason --batch-silent isn't enough to hide. So in this commit
we write them to a log file, which is probably better for debugging
anyway. To see an illustrative test failure before this change, run

% make
% touch notmuch-count.c
% cd test && ./T060-count.sh

(cherry picked from commit f45fa5bdd3)
2016-08-14 13:27:57 +09:00
Daniel Kahn Gillmor
1ba73d1437 Omit User-Agent: header by default
The User-Agent: header can be fun and interesting, but it also leaks
quite a bit of information about the user and their software stack.

This represents a potential security risk (attackers can target the
particular stack) and also an anonymity risk (a user trying to
preserve their anonymity by sending mail from a non-associated account
might reveal quite a lot of information if their choice of mail user
agent is exposed).

This change also avoids hiding the User-Agent header by default, so
that people who decide they want to send it will at least see it (and
can edit it if they want to) before sending.

It makes sense to have safer defaults.
2016-08-11 20:16:00 +09:00
Mikhail
188fccd84f configure: add --without-api-docs option
Add option to explicitly disable API man page build even if doxygen
binary is available. --without-docs also implies not building API
manpage.

This change intended to add more distinctness into build system and
allow user not to build unwanted man pages.
2016-08-11 20:13:46 +09:00
Mark Walters
999d473299 emacs: wash: word-wrap bugfix
Previously notmuch-wash made the width of the text (approximately) the
window-width minus the depth in thread. This is correct for the
default indentation of 1 per message depth, but is incorrect for any
other setting of notmuch-show-indent-messages-width.

As notmuch-show-indent-messages-width is customisable, and notmuch-tree
sets it to zero to avoid indenting messages in the message pane, this
bug can show up in real use.

Two of the tests had to be updated: when
notmuch-show-indent-messages-width is 0, then the new (correct) word
wrapping happens later, when notmuch-show-indent-messages-width is 4,
then the new word wrapping happens sooner.
2016-08-09 09:34:25 +09:00
David Bremner
293186d6c6 lib: provide _notmuch_database_log_append
_notmuch_database_log clears the log buffer each time. Rather than
introducing more complicated semantics about for this function, provide
a second function that does not clear the buffer. This is mainly a
convenience function for callers constructing complex or multi-line log
messages.

The changes to query.cc are to make sure that the common code path of
the new function is tested.
2016-08-09 09:34:11 +09:00
David Bremner
f45fa5bdd3 test: make gdb even quieter
gdb sometimes writes warnings to stdout, which we don't need/want, and
for some reason --batch-silent isn't enough to hide. So in this commit
we write them to a log file, which is probably better for debugging
anyway. To see an illustrative test failure before this change, run

% make
% touch notmuch-count.c
% cd test && ./T060-count.sh
2016-08-09 09:33:59 +09:00
Matt Armstrong
2a7b11b064 emacs: express n-search-line-faces in terms of two new faces
The two new faces (notmuch-search-flagged-face and
notmuch-search-unread-face) make it easier to find the relevant face by
customizing notmuch-faces.  I plan to do the same to the other alists of
faces found elsewhere.
2016-08-02 13:40:44 +09:00
David Bremner
2ce0f1368f create .mailmap file (for git shortlog/blame)
Recently it was suggested on the list that we add a contributor to
AUTHORS. This file has been unmodified for 7 years, and is somewhat out
of date. It would potentially make sense to automagically update this
file during the release process using the output from git shortlog. This
file helps clean up some inconsistencies in author data in the history.
2016-07-29 06:01:44 +09:00
Jaime Velasco Juan
4bf82dea2d Fix typo in Message.maildir_flags_to_tags
It has been calling _tags_to_maildir_flags instead since the beginning,
2016-07-29 05:57:13 +09:00
David Bremner
92d8eae8f1 Merge branch 'release' 2016-07-19 09:03:19 -03:00
David Bremner
8fe58226ef debian: changelog stanza for 0.22.1-2 2016-07-19 08:51:33 -03:00
David Bremner
6cf6469e91 debian: add explicit build-depends on gnupg
apt dropped it's depends on gnupg, so we can't rely on it being present
in the build env anymore
2016-07-19 08:49:10 -03:00
David Bremner
b824ecc48f debian: changelog stanza for 0.22.1-1
Basically copy upstream NEWS
2016-07-19 06:43:20 -03:00
David Bremner
2d2d001081 NEWS: set date of point release 2016-07-19 06:36:15 -03:00
David Bremner
51816247d2 version: bump to 0.22 2016-07-19 06:33:37 -03:00
David Bremner
713f7d0c0c NEWS: initial NEWS for 0.22.1 2016-07-13 19:55:24 -03:00
David Bremner
09b18ae8f4 debian: add changelog stanza for 0.22.1~rc0-1
No actual changes discussed, because the NEWS file is yet to be
created.
2016-06-30 21:28:31 +02:00
David Bremner
308b44290d version: bump to 0.21.1~rc0
Getting ready for the point release
2016-06-30 17:52:42 +02:00
Stefano Zacchiroli
9e6017b8b4 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.
2016-06-30 17:50:16 +02:00
David Bremner
ff9284db6e 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));
}
2016-06-30 17:49:29 +02:00
David Bremner
f2886b80c1 doc: forbid further operations on a closed database
We could add many null pointer checks, but currently I don't see a use
case that justifies it.
2016-06-30 17:48:23 +02:00
David Bremner
48d33532bb test: don't use dump and restore in a pipeline
This has been wrong since bbbdf0478e, but the race condition was not
previously been (often?) triggered in the tests. With the DB_RETRY_LOCK
patches, it manifests itself as a deadlock.
2016-06-30 17:47:36 +02:00
David Bremner
3a45d29ed4 lib: add built_with handling for XAPIAN_DB_RETRY_LOCK
This support will be present only if the appropriate version of xapian
is available _and_ the user did not disable the feature when
building. So there really needs to be some way for the user to check.
2016-06-29 09:05:49 +02:00
David Bremner
6450813e8f test: initial tests for locking retry
Currently there's not much to test, so we simulate contention, and check
that the modifications to the database are serialized.
2016-06-29 09:05:28 +02:00
Istvan Marko
9b60dc3cd9 Use the Xapian::DB_RETRY_LOCK flag when available
Xapian 1.3 has introduced the DB_RETRY_LOCK flag (Xapian bug
275). Detect it in configure and optionally use it. With this flag
commands that need the write lock will wait for their turn instead of
aborting when it's not immediately available.

Amended by db: allow disabling in configure
2016-06-29 09:03:34 +02:00
David Bremner
496dccf44f test: don't use dump and restore in a pipeline
This has been wrong since bbbdf0478e, but the race condition was not
previously been (often?) triggered in the tests. With the DB_RETRY_LOCK
patches, it manifests itself as a deadlock.
2016-06-29 09:03:14 +02:00
David Bremner
38f0d44a82 doc: forbid further operations on a closed database
We could add many null pointer checks, but currently I don't see a use
case that justifies it.
2016-06-28 23:20:38 +02:00
Tomi Ollila
be55acf4f0 test/notmuch-test: simple streamlining
A few simple things that applies well to test/notmuch-test.sh

- Shell does pathname expansion also without doing `echo ...` in subshell.

- Redirections >/dev/null 2>/dev/null hide (improbable but) potential
  serious errors; adding -f to rm instead.

- Inter-file capitalization consistency in comments.

- Unnecesary space removal.
2016-06-28 09:23:39 +02:00
Mark Walters
dd5cd6964f emacs: show: improve handling of mark read tagging errors
Previously if a marking read tag change (i.e., removing the unread
tag) failed for some reason, such as a locked database, then no more
mark read tag changes would be attempted in that buffer.

This handles the error more gracefully. There is not much we can do
yet about dealing with the error itself, and marking read is probably
not important enough to warrant keeping a queue of pending changes or
anything.

However this commit changes it so that

- we do try and make future mark read tag changes.

- we display the tag state correctly: i.e. we don't display the tag as
  deleted (no strike through)

- and since we know the tag change failed we can try to mark this
  message read in the future. Indeed, since the code uses the
  post-command hook we will try again on the next keypress (unless the
  user has left the message).

We indicate to the user that these mark read tag changes may have
failed in the header-line.
2016-06-28 09:20:54 +02:00
David Bremner
cc1a6d2a94 test: factor out some boilerplate from C tests
The trick of having a common header file doesn't work to share between
test scripts, so make an include file in the test directory.

The use of #include <notmuch-test.h> looks slightly pretentious, but
the include file is not actually in the current (temporary) directory.
2016-06-13 21:52:33 -03:00
Tomi Ollila
57bd4cf322 Makefile.local: set IS_GIT = yes when regular file $srcdir/.git exists
$srcdir/.git may also be file. E.g. `git worktree` creates .git file
while new working tree is populated.
2016-06-11 13:13:48 -03:00
Tomi Ollila
2333a44ab7 test: test_python: set PYTHONPATH to the python execution environment
Place PYTHONPATH to the environment when python is executed in a way
that current shell environment is not affected. This also allows adding
the old value of PYTHONPATH to the end of the new value (otherwise it
would have been appended again and again when test_python is called).

At the same time, use -B option to avoid writing .pyc files to
bindings/python/* (which are not cleared out by distclean).

Drop the (unused) prefix code which preserved the original stdout of the
python program and opened sys.stdout to OUTPUT. In place of that there
is now note how (debug) information can be printed to original stdout.
2016-06-11 13:12:08 -03:00
Tomi Ollila
f0e5317bcd test: set LD_LIBRARY_PATH early and keep its old contents
Previously LD_LIBRARY_PATH was exported (and environment changed)
in the middle of test case execution, when a function setting it
was called.

Previously the old contents of LD_LIBRARY_PATH was lost (if any)
when it was re-set and exported. In some systems the old contents of
LD_LIBRARY_PATH was needed to e.g. locate suitable gmime library.
2016-06-11 13:11:49 -03:00
Tomi Ollila
65c219560f notmuch-emacs-mua: escape $PWD (and cd always)
Escaping $PWD makes this work in directories like 'foo"bar'...

Cd'ing always makes the working directory to be consistent whether
--body option was used or not (when using emacsclient, but cd'ing
when using emacs does not cause any harm).

Note that documentation of `insert-file` expects programs to
call `insert-file-contents` instead. In our simple case
`insert-file` works better as it does some good checks that we'd
have to implement ourselves. Look lisp/files.el in emacs sources
for more information.
2016-06-11 13:09:22 -03:00
Tomi Ollila
e401daecab notmuch-emacs-mua: use message-add-actions
Use message.el -provided function message-add-actions to
set(/add) #'save-buffers-kill-terminal into the message-exit-actions
list.
2016-06-11 13:09:08 -03:00
Tomi Ollila
36492f20a7 test: fix die() in test-lib-common.sh
In scripts that include test-lib-common.sh but not test-lib.sh
the die() implementation needs to be a bit different due to
fd redirection differences. test-lib-common.sh implements die()
only if it was not implemented already.
2016-06-11 13:03:44 -03:00
Tomi Ollila
d53b417d1f 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).
2016-06-11 13:03:09 -03:00
Tomi Ollila
1ca752fa36 test-lib.sh: renamed die...()s to trap...()s and exit...()
Now the function names more accurately describes what the functions do.
2016-06-11 13:03:00 -03:00
Tomi Ollila
6a49e8a51e doc/notmuch-emacs.rst: update notmuch-hello buffer help text
To look the same as commit b8a136187a changed it in emacs MUA code.
2016-06-11 13:02:35 -03:00
David Bremner
44cfa90bdc 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));
}
2016-06-11 13:01:44 -03:00
Tomi Ollila
1e96445cb5 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...
2016-06-11 13:01:30 -03:00
David Bremner
4291f32680 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).
2016-06-10 09:20:22 -03:00
Daniel Kahn Gillmor
d080b4100a 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.
2016-06-07 08:00:40 -03:00
David Bremner
d9d2d535b3 doc: document notmuch-dump header line
This was introduced with the libconfig changes, but not documented then.
2016-06-07 07:52:34 -03:00
David Bremner
ba0b95f846 lib: document config metadata
This probably should have been part of 3458e3c89c, but I missed it.
2016-06-07 07:51:57 -03:00
Daniel Kahn Gillmor
6a833a6e83 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.
2016-06-05 08:32:17 -03:00