Jameson Rollins [Wed, 9 Mar 2011 08:49:16 +0000 (00:49 -0800)]
crypto: change customization variable name again
I sweat this is the last time. I realized that it makes more sense to
scope the name space a bit, as I now realize there will be more crypto
function and customizations to come. This commit precedes the
breaking out of the existing crypto functions in to their own
libraries.
Jameson Rollins [Sat, 5 Mar 2011 23:40:44 +0000 (15:40 -0800)]
emacs: change name of notmuch-process-crypto-mime variable
This changes the customization variable from "notmuch-process-pgpmime"
to "notmuch-process-crypto-mime". There is indication that gmime will
soon support crypto operations on s/mime parts, with the same crypto
context that is currently being used for pgp/mime. This means we
should be able to support s/mime crypto operations with the same code.
For this reason it's better to use a more general name for this
variable.
Jameson Rollins [Sat, 5 Mar 2011 07:55:33 +0000 (23:55 -0800)]
tag signed/encrypted during notmuch new
This patch adds the tag "signed" to messages with any multipart/signed
parts, and the tag "encrypted" to messages with any
multipart/encrypted parts. This only occurs when messages are indexed
during notmuch new, so a database rebuild is required to have old
messages tagged.
Jameson Rollins [Fri, 4 Feb 2011 19:43:12 +0000 (11:43 -0800)]
emacs: rename conf var to be "notmuch-process-pgpmime"
This changes the conf variable for pgp/mime processing from
"notmuch-show-process-pgpmime" to "notmuch-process-pgpmime". This is
done to make the scope of the variable widier so that it can be more
easily used in other modes other than show (such as reply).
Jameson Rollins [Wed, 2 Feb 2011 23:49:12 +0000 (15:49 -0800)]
emacs: add support for PGP/MIME verification/decryption
This adds a new emacs configuration variable
"notmuch-show-process-pgpmime". When this is set true, notmuch-query
will use the notmuch show --decrypt flag to decrypt encrypted messages
and/or calculate the sigstatus of signed messages. If sigstatus is
available, notmuch-show will place a specially color-coded header at
the begining of the signed message.
Also included is the ability to switch decryption/verification on/off
on the fly, which is bound to M-RET in notmuch-search-mode.
Jameson Rollins [Wed, 2 Feb 2011 23:24:01 +0000 (15:24 -0800)]
output signer user ID if validity is full or ultimate
This means that if the userid is included in the json output then it
has full or ultimate validity. If the userid is not included that
means the userid has less than full validity, and we should be doing
something else to determine validity (probably of the From: name of
the message).
Jameson Rollins [Wed, 2 Feb 2011 19:15:00 +0000 (11:15 -0800)]
add signature-verification and decryption tests ("crypto")
This adds a new "crypto" test script to the test suite to test
PGP/MIME signature verification and message decryption. Included here
is a test GNUPGHOME with a test secret key (passwordless). Two test
messages are generated: one signed by this key, and another encrypted
to this key (also with signature). The test then checks the output of
"--format=json --verify" and "--format=json --decrypt" respectively.
Jameson Rollins [Mon, 31 Jan 2011 20:23:59 +0000 (12:23 -0800)]
add decryption/verification of PGP/MIME-encrypted mails to notmuch show --format=json
If specified, the format_part_json function will decrypt the encrypted
part, check signature validity, and run format_part_json on the newly
decrypted part and return. The decryption status is reported in a new
"decstatus" json field.
NOTE: If the decrypted part is itself multipart then the decrypted
message will have a *different* number of parts than the undecrypted
message.
Jameson Rollins [Mon, 31 Jan 2011 20:05:51 +0000 (12:05 -0800)]
repurpose verify_part_json function to instead act on GMimeSignatureValidity
The sig validity checking and error handling is moved outside of the
function, and the renamed function ("format_sigstatus_json") now just
handles formatting the sigstatus output.
This is in preparation for decryption handling, which handles
signature checking slightly differently but can now also use this
repurposed function.
David Edmondson [Mon, 17 May 2010 12:41:12 +0000 (13:41 +0100)]
emacs: Optionally show all parts in multipart/alternative.
Add a variable `notmuch-show-all-multipart/alternative-parts' that
allows the user to indicate that all candidate sub-parts of a
multipart/alternative part should be shown rather than just the
preferred part. The default is `nil', showing only the preferred part.
Carl Worth [Fri, 11 Mar 2011 00:53:46 +0000 (16:53 -0800)]
emacs: Don't drop error messages from "notmuch search"
With the previous commit, unexpected output before or between search results
would be displayed. However, trailing junk from the "notmuch search" output
would still be silently swallowed.
The most common case for an error message from "notmuch search" would be
an invalid command-line, and in that case, there would be no search results
and the trailing error message would get swallowed.
We fix the process sentinel to check for leftover data and add it to the
final buffer. We also add a test case to ensure this works.
Carl Worth [Thu, 10 Mar 2011 23:29:24 +0000 (15:29 -0800)]
emacs: Fix notmuch-search-process-filter to handle incomplete lines
This fixes the recently-added emacs-large-search-buffer test. This is
as simple as saving any trailing input and then pre-prepending it on
the next call.
MAny thanks to Thomas Schwinge <thomas@schwinge.name> for tracking
down this problem and contributing a preliminary version of this fix.
Carl Worth [Thu, 10 Mar 2011 23:18:40 +0000 (15:18 -0800)]
emacs: Display any unexpected output from notmuch search
Rather than silently swallowing unexpected output, the emacs interface will now
display it. This will allow error messages to actually arrive at the emacs
interface (though not in an especially pretty way). This also allows for easier
investigation of the inadvertent swallowing of search results that span page
boundaries (as demonstrated by the recent added emacs-large-search-buffer test).
Carl Worth [Thu, 10 Mar 2011 21:22:04 +0000 (13:22 -0800)]
Rename/rewrite the new emacs-forgetfulness test (to emacs-large-search-buffer)
The new name is more descriptive of the bug being tested. Also, the test
is rewritten slightly so that it's much more plain to see how the bug
manifests itself, (that messages are droped from the emacs result at
regular intervals). Primarily, this is by collapsing the large blobs
used to inflate the message subjects.
Carl Worth [Thu, 10 Mar 2011 19:56:16 +0000 (11:56 -0800)]
new: Update comments for add_files_recursive
The most recent commit optimized the implementation of this
function. This commit simply updates the relevant comments to match
the new implementation.
Karel Zak [Fri, 4 Feb 2011 21:44:31 +0000 (22:44 +0100)]
new: read db_files and db_subdirs only if mtime changed
The db_files and db_subdirs are unnecessary for unchanged directories.
maildir with 10000 e-mails:
old version:
$ time ./notmuch new
No new mail.
real 0m0.053s
user 0m0.028s
sys 0m0.026s
new version:
$ time ./notmuch new
No new mail.
real 0m0.032s
user 0m0.009s
sys 0m0.023s
Signed-off-by: Karel Zak <kzak@redhat.com> Reviewed-by: Austin Clements <amdragon@mit.edu>
Looks good (faster than, but provably equivalent to the original code!
notmuch_directory_get_child_* are side-effect free,
db_files/db_subdirs aren't used between where they were set in the old
code and where they are set in the new code, and db_files/db_subdirs
are initialized to NULL when declared).
Another timing data point:
Old code: ./notmuch new 0.77s user 0.28s system 99% cpu 1.051 total
New code: ./notmuch new 0.09s user 0.27s system 98% cpu 0.368 total
Carl Worth [Thu, 10 Mar 2011 19:30:06 +0000 (11:30 -0800)]
build: Save configure options and re-use them for automatic runs of configure
This supports the case of a user running "configure --prefix=/foo" then later
updating the soruce (including the configure script) and re-running make.
In this case, the make invocation will re-run configure. Before this change,
this run of configure would lose the user's carefully chosen prefix. This
is now fixed so that configrue is re-run with the user's options.
Carl Worth [Wed, 9 Mar 2011 23:02:42 +0000 (15:02 -0800)]
build: Add support for non-source-directory builds.
Such as:
mkdir build
cd build
../configure
make
This is implemented by having the configure script set a srcdir
variable in Makefile.config, and then sprinkling $(srcdir) into
various make rules. We also use vpath directives to convince GNU make
to find the source files from the original source directory.
Carl Worth [Sun, 30 Jan 2011 19:26:04 +0000 (05:26 +1000)]
json: Fix search result with no matches to be a valid json object.
In the original json code, search matching nothing would return a
valid, empty json array (that is, "[]"). I broke this in commit 6dcb7592e32ed5140ea0c0357ce78d6a37af6066 when adding support for
--output=threads|messages|tags. This time, while fixing the bug also
add a test to the test suite to help avoid future regressions.
Carl Worth [Fri, 28 Jan 2011 20:21:25 +0000 (06:21 +1000)]
test: Rename and clarify the search-lwn test
Now that we understand the bug here, we rename this test to
search-insufficient-from-quoting to clarify the bug being exercised,
(which occurs when the From: line contains an unquoted '.' character).
We also mark these tests as expected failures until the bug gets fixed.
Austin Clements [Mon, 31 Jan 2011 02:01:56 +0000 (21:01 -0500)]
Simplify _notmuch_doc_id_set_init interface.
Don't require the caller of _notmuch_doc_id_set_init to pass in a
correct bound; instead compute it from the array. This simplifies the
caller and makes this interface easier to use correctly.
Austin Clements [Mon, 31 Jan 2011 01:58:27 +0000 (20:58 -0500)]
Remove code repetition in the doc ID bitmap code.
Remove the repeated "sizeof (doc_ids->bitmap[0])" that bothered cworth
by instead defining macros to compute the word and bit offset of a
given bit in the doc ID set bitmap.
Jameson Rollins [Wed, 26 Jan 2011 20:57:50 +0000 (12:57 -0800)]
emacs: send notmuch-query stderr to /dev/null
The call-process to notmuch in notmuch-query.el was previously sending
stderr into the output buffer. This means that if there is any stderr
the JSON parsing breaks. Unfortunately call-process does not support
sending stderr to a separate buffer or to the minibuffer [0], but it
does support sending it to /dev/null. So we do that here instead.
Michal Sojka [Wed, 26 Jan 2011 13:06:57 +0000 (14:06 +0100)]
new: Print progress estimates only when we have sufficient information
Without this patch, it might happen that the remaining time or processing
rate were calculated just after start where nothing was processed yet.
This resulted into division by a very small number (or zero) and the
printed information was of little value.
Instead of printing nonsenses we print only that the operation is in
progress. The estimates will be printed later, after there is enough data.
Michal Sojka [Wed, 26 Jan 2011 13:13:21 +0000 (23:13 +1000)]
configure: Drop global setting of IFS (without space in it).
This was originally intended to help support filenames with spaces in
them, but this actually breaks things when someone sets a command with
a space in it, (such as CC="ccache cc").
Instead, we now only set a custom IFS when acting on the
newline-separated list of files from /sbin/ldconfig.
Michal Sojka [Sun, 23 Jan 2011 10:45:50 +0000 (11:45 +0100)]
emacs: View the output of pipe command when it fails
Previously, the user didn't know whether the pipe command succeeded or
not. It was only possible to find it out by manually inspecting
the work done (or not done) by the command or by manually switching to
*notmuch-pipe* buffer and determine it from command output. For this
the user had to first find the text corresponding to the last run of
pipe command as the buffer accumulated the output from all pipe commands.
This patch changes the following. The *notmuch-pipe* buffer is erased
before every pipe command so it contains only the output from the last
command. Additionally, when the command failed, the *notmuch-pipe* buffer
is shown and an error message is displayed.
with the output of pipe command.
Michal Sojka [Sun, 23 Jan 2011 11:12:24 +0000 (12:12 +0100)]
test: Make it easier to resolve conflicts when adding new tests
Currently, there are two places in the test framework that contain very
long list on a single line. Whenever a test is added (or changed) in
several branches and these branches are merged, it results in conflict
which is hard to resolve because one has to go through the whole long
line to find where the conflict is.
This patch splits these long lists to several lines so that the
conflicts are easier to resolve.
Cédric Cabessa [Sun, 23 Jan 2011 13:33:43 +0000 (14:33 +0100)]
configure: add options to disable emacs/zsh/bash and choose install dir.
add --bashcompletiondir and --zshcompletiondir (like --emacslispdir) to choose
installation dir for bash/zsh completion files
Make some features optional:
--without-emacs / --with-emacs=no do not install lisp file
--without-bash-completion / --with-bash-completion=no do not install bash
files
--without-zsh-completion / --with-zsh-completion=no do not install zsh files
By default, everything is enabled. You can reenable something with
--with-feature=yes
Michal Sojka [Fri, 21 Jan 2011 09:59:37 +0000 (10:59 +0100)]
new: Enhance progress reporting
notmuch new reports progress only during the "first" phase when the
files on disk are traversed and indexed. After this phase, other
operations like rename detection and maildir flags synchronization are
performed, but the user is not informed about them. Since these
operations can take significant time, we want to inform the user about
them.
This patch enhances the progress reporting facility that was already
present. The timer that triggers reporting is not stopped after the
first phase but continues to run until all operations are finished. The
rename detection and maildir flag synchronization are enhanced to report
their progress.
Michal Sojka [Fri, 21 Jan 2011 09:59:36 +0000 (10:59 +0100)]
new: Add all initial tags at once
If there are several tags applied to the new messages, it is beneficial
to store them to the database at one, because it saves some time,
especially when the notmuch new is run for the first time.
This patch decreased the time for initial import from 1h 35m to 1h 14m.
Austin Clements [Wed, 26 Jan 2011 11:52:54 +0000 (21:52 +1000)]
Do not defer maildir flag synchronization for new messages
This is a simplified version of a patch originally by Michal Sojka
<sojkam1@fel.cvut.cz> which is designed to have the same performance
benefits. Michal said the following:
When notmuch new is run for the first time, it is not necessary to
defer maildir flags synchronization to later because we already know
that no files will be removed.
Performing the maildinr flag synchronization immediately after the
message is added to the database has the advantage that the message
is likely hot in the disk cache so the synchronization is faster.
Additionally, we also save one database query for each message,
which must be performed when the operation is deferred.
Without this patch, the first notmuch new of 200k messages (3 GB)
took 1h and 46m out of which 20m was maildir flags
synchronization. With this patch, the whole operation took only 1h
and 36m.
Unlike Michal's patch, this version does the deferral for any new
message, rather than doing it only on the first run of "notmuch new".
vim: Get user email address from notmuch config file.
Here's a bitty patch to the vim plugin; it now calculates the primary email
of the user based on a call to notmuch config. There's still a lot of work
that needs to get done on notmuch.vim, e.g., the ability to have multiple
emails/accounts.
Carl Worth [Wed, 26 Jan 2011 05:19:31 +0000 (15:19 +1000)]
Add test demonstrating a position overlap bug.
Currently, whenever we call index_terms multiple times for a single
field, the term generator is being reset to position 0 each time. This
means that with text such as:
To: a@b.c, x@y.z
one can get a bogus match by searching for:
To: a@y.c
Thanks to Mark Anderson for reporting the bug, (and providing a nice,
minimal test case that inspired what is used here).
Carl Worth [Tue, 25 Jan 2011 13:40:35 +0000 (23:40 +1000)]
notmuch search: Clean up some memory leaks during search loop.
With talloc, we were already freeing all memory by the time we exited
the loop, but that didn't help with excess use of memory inside the
loop, (which was mostly from tallocing some objects with the incorrect
parent).
Thanks to Andrew Tridgell for sitting next to me and teaching me to
use talloc_report_full to find these leaks.
Carl Worth [Sat, 15 Jan 2011 22:05:10 +0000 (14:05 -0800)]
test: Add new tests for folder-based searching.
This is a new feature which is not implemente yet, so these tests mostly
fail currently. A subsequent commit will add the feature and cause these
tests to start passing.
These tests verify that we can search for containing folders of mail files
by word or by phrase and that the search terms are updated correctly when
directories are renamed.