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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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>
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>
Jakub Wilk [Tue, 26 Sep 2017 17:23:09 +0000 (19:23 +0200)]
doc: fix typos
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.
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.
Daniel Kahn Gillmor [Sat, 23 Sep 2017 14:46:13 +0000 (10:46 -0400)]
fix reference to notmuch_message_get_properties
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.
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!
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.
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.
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.
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.
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.
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).
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.
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.
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)
David Bremner [Tue, 12 Sep 2017 01:22:22 +0000 (22:22 -0300)]
debian: changelog stanza for 0.25.1-1
David Bremner [Tue, 12 Sep 2017 01:20:26 +0000 (22:20 -0300)]
NEWS: news entry for 0.25.1
David Bremner [Tue, 12 Sep 2017 01:19:46 +0000 (22:19 -0300)]
version: bump to 0.25.1
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.
Daniel Kahn Gillmor [Tue, 5 Sep 2017 13:21:00 +0000 (09:21 -0400)]
fix documentation bug (leading quotes break documentation)
David Bremner [Sun, 27 Aug 2017 23:58:23 +0000 (20:58 -0300)]
test/duplicate-mid: check for subject with notmuch-show
In [1] Mark showed that the the current code (
d7a49e81) is not
consistent in it's handling of subjects of messages with duplicate
message-ids (or in notmuch-speak, of messages with multiple files).
notmuch-search uses indexing order and explicitedly preserves the
first. notmuch-show (apparently) uses alphabetical (or at least xapian
term order) of filenames. In a perfect world we would probably report
all subjects in the json output; at the very least we should be
consistent.
[1]: id:87378dny3d.fsf@qmul.ac.uk
David Bremner [Sun, 27 Aug 2017 23:58:22 +0000 (20:58 -0300)]
lib: enforce that n_message_reindex takes headers from first file
This is still a bit stopgap to be only choosing one set of headers,
but this seems like a more defensible set of headers to choose.
David Bremner [Sun, 27 Aug 2017 23:58:21 +0000 (20:58 -0300)]
test: known broken test for subject after reindexing
In [1], Mark gave a test that was behaving strangly. This turns out to
be specific to reindexing. I suppose one could argue that picking the
lexicographically last file name is a defensible choice, but it's
almost as easy to take the first, which seems more intuitive. So mark
the current situation as broken.
[1]: id:
1503859703-2973-1-git-send-email-markwalters1009@gmail.com
David Bremner [Sun, 27 Aug 2017 23:58:20 +0000 (20:58 -0300)]
test/duplicate-mid: clarify index order vs filename order
The existing test for notmuch search had the first in filename order
the same as the first indexed, which made it harder to understand what
the underlying behaviour is. Add a file with a lexicographically
smaller name, but later index time to clarify this.
David Bremner [Sun, 27 Aug 2017 23:58:19 +0000 (20:58 -0300)]
test: make fallback to duplicate test more robust.
The original intent of this test was to verify that notmuch show was
not crashing when the first file (where headers are being read from)
was deleted. Run the output through some sanitization so that as we
add and delete copies we don't have to update this test.
Vladimir Panteleev [Mon, 14 Aug 2017 07:08:36 +0000 (07:08 +0000)]
emacs: Refuse requests to refresh tree views while a refresh is running
notmuch-tree did not protect against concurrent refreshes like
notmuch-search, meaning, hitting '=' (notmuch-refresh-this-buffer)
quickly will spawn multiple parallel notmuch processes, and clobber
the existing results in the current buffer.
* notmuch-tree.el: Add a guard to notmuch-tree-refresh-view similar to
the one in notmuch-search.
David Bremner [Sun, 3 Sep 2017 11:55:42 +0000 (08:55 -0300)]
lib&cli: use g_object_new instead of g_object_newv
'g_object_newv' is deprecated, and prints annoying warnings. The
warnings suggest using 'g_object_new_with_properties', but that's only
available since glib 2.55 (i.e. a month ago as of this writing).
Since we don't actuall pass any properties, it seems we can just call
'g_object_new'.
Tomi Ollila [Sun, 3 Sep 2017 20:24:55 +0000 (23:24 +0300)]
test: notmuch_drop_mail_headers() style update
Changed "" quotes to '' as we're not supposed to dynamically
alter python program (via shell $variable expansion).
Added space to python program to match general python style.
Replaced $* with 'idiomatic' "$@" to serve as better example.
David Bremner [Fri, 1 Sep 2017 23:59:47 +0000 (20:59 -0300)]
test/crypto: remove headers more robustly
In [1], Vladimir Panteleev observed that the In-Reply-To and
References headers could be wrapped in the 'default' output format of
notmuch-reply, depending on the version of Emacs creating the
message. In my own experiments notmuch-reply sometimes wraps headers
with only one message-id if that message-id is long enough. However it
happens, this causes the previous approach using grep to fail.
Since I found the proposed unwrapping shell fragment in [1] a bit hard
to follow, I decided to write a little python script instead. Then
Tomi suggested a slight generalization of my script, and here we are.
[1] id:
20170817175145.3204-7-notmuch@thecybershadow.net
Jan Malakhovski [Thu, 31 Aug 2017 11:46:34 +0000 (11:46 +0000)]
build: fix unbound variable in configure
Commentary by db:
This missing initialization caused configure to crash, and hence the
build to fail in environments without cppcheck.
David Bremner [Wed, 30 Aug 2017 23:14:43 +0000 (20:14 -0300)]
gitignore: add .stamps
Vladimir Panteleev [Thu, 17 Aug 2017 17:51:43 +0000 (17:51 +0000)]
.travis.yml: Switch to "sudo: false" for faster builds
Builds not requiring sudo access run in a container, which will have
better performance and less overhead on the Travis infrastructure.
Use the apt addon to install dependencies instead of explicit apt-get
commands.
Vladimir Panteleev [Thu, 17 Aug 2017 17:51:42 +0000 (17:51 +0000)]
test: Fix T050-new.sh on some Travis CI machines
On some system configurations, setting a breakpoint on the "add_file"
function then issuing "continue" in gdb causes the debugger to
seemingly jump over the add_file invocation. This results in a test
failure, as the "Handle files vanishing between scandir and add_file"
subtest expects add_file to be called and fail due to the vanishing
file. The compiler optimization level also plays a role - the problem
can be reproduced with CFLAGS having -O2 but not -Og.
This problem was observed manifesting as a test failure on Travis CI
configured with "dist: trusty" and "sudo: false". It was not
reproducible on a local Docker image of Travis' runtime environment,
so Travis' virtualization infrastructure likely plays a role as well.
* T050-new.sh: Breakpoint notmuch_database_add_message instead of
add_file to the same effect, and avoid bad gdb behaviour on Travis
CI.
Amended by db:
s/notmuch_database_add_message/notmuch_database_index_file/
Somehow the wrapper function doesn't work as a breakpoint; perhaps due
to inlining.
Vladimir Panteleev [Thu, 17 Aug 2017 17:51:41 +0000 (17:51 +0000)]
.travis.yml: Replace manual zlib installation with "dist: trusty"
Travis now offers Ubuntu Trusty (14.04 LTS) VMs as test runners, which
is gradually becoming the default. We can opt in to using Trusty now
so that we no longer need to manually update zlib to a newer version.
Vladimir Panteleev [Thu, 17 Aug 2017 17:51:40 +0000 (17:51 +0000)]
.travis.yml: Add gdb and gpgsm dependencies
This allows running more tests which were previously skipped due to
missing dependencies.
Vladimir Panteleev [Thu, 17 Aug 2017 17:51:39 +0000 (17:51 +0000)]
.travis.yml: Invoke `make download-test-databases' before running tests
Download the test message database used for the T530-upgrade.sh test.
If the additional load on the web server is undesired, Travis can be
instructed to cache the file.
David Bremner [Sat, 26 Aug 2017 14:41:41 +0000 (11:41 -0300)]
test/smtp-dummy: convert to 'goto DONE' style
Clean up several cppcheck warnings of the form
- test/smtp-dummy.c:170: error: Resource leak: output
Conform to overall notmuch code style.
David Bremner [Sat, 26 Aug 2017 14:41:40 +0000 (11:41 -0300)]
test/smtp-dummy: uncrustify
For some reason lost in the mists of time this code was indented 8 spaces.
David Bremner [Sat, 26 Aug 2017 14:41:39 +0000 (11:41 -0300)]
cppcheck: call va_end in _internal_error
fix for:
util/error_util.c:38: error: va_list 'va_args' was opened but not
closed by va_end()
This makes the code more copy-pastable, if nothing else
David Bremner [Sat, 26 Aug 2017 14:41:38 +0000 (11:41 -0300)]
cppcheck: close files during shutdown
Fix the following cppcheck errors:
notmuch-count.c:207: error: Resource leak: input
notmuch-tag.c:238: error: Resource leak: input
We know that the program is shutting down here, but it does no harm to
clean up a bit.
David Bremner [Tue, 29 Aug 2017 11:35:26 +0000 (08:35 -0300)]
build: add target to run cppcheck
The advantage of having a target as opposed to running cppcheck by
hand
- reuse list of source files
- output errors in a format parsable, e.g. by emacs
- returns exit code 1 on any error, for possibly use in other
targets.
For the moment, leave this as an optional target. If desired, it can
be added to e.g. the release targets in the same way as the test
target.
Using two levels of directory for the stamps is arguably
overengineering, but it doesn't really cost anything, and leaves open
the possibility of putting other kinds of stamp files there.
This only checks "new" source files (w.r.t. their last check). A future target
(cppcheck-all ?) could blow away the stamp files first.
Jani Nikula [Tue, 29 Aug 2017 18:27:09 +0000 (21:27 +0300)]
build: add .deps to CLEAN instead of listing in clean target
Seems, uh, cleaner this way.
Jani Nikula [Tue, 29 Aug 2017 18:27:08 +0000 (21:27 +0300)]
build: add optional target parameter to quiet variable function
Sometimes using $@ as the target in the quiet build lines can be
confusing. Accept an optional second parameter in the quiet variable
function to specify the target.
Jani Nikula [Tue, 29 Aug 2017 18:27:07 +0000 (21:27 +0300)]
build: avoid an extra shell out in quiet variable function
$(word 1, $1) yields the same result as the more complicated
$(shell echo $1 | sed -e s'/ .*//')
David Bremner [Sun, 20 Aug 2017 01:07:27 +0000 (22:07 -0300)]
CLI/new: support maildir synced tags in new.tags
We reorder reading maildir flags to avoid overwriting 'new.tags'. The
inverted status of 'unread' means the maildir flag needs to be checked
a second time.
I backpedalled here on the idea of supporting 'new.tags' without
'unread' in the presence of maildir syncing. For files in 'new/', it
seems quite natural to tag them as 'unread'.
David Bremner [Sun, 20 Aug 2017 01:07:26 +0000 (22:07 -0300)]
lib: add notmuch_message_has_maildir_flag
I considered a higher level interface where the caller passes a tag
name rather than a flag character, but the role of the "unread" tag is
particularly confusing with such an interface.
David Bremner [Sun, 20 Aug 2017 01:07:25 +0000 (22:07 -0300)]
lib/message: split n_m_maildir_flags_tags, store maildir flags
In a future commit this will allow querying maildir flags seperately
from tags to allow resolving certain conflicts.
David Edmondson [Sun, 27 Aug 2017 12:50:50 +0000 (13:50 +0100)]
test: Perform T170 tests that don't require dtach before any that do.
This avoids the later tests seeing different versions of the database
depending on whether dtach is available.
Vladimir Panteleev [Mon, 14 Aug 2017 05:54:56 +0000 (05:54 +0000)]
notmuch-tag.el: Fix minor grammar error
Vladimir Panteleev [Wed, 16 Aug 2017 16:31:27 +0000 (16:31 +0000)]
test: Use small Python script for JSON normalization instead of json.tool
json.tool does not sort or otherwise normalize the order of JSON keys
in its output, which can result in test failures on some test systems.
Instead, use a one-line Python script passed to the interpreter
directly on its command line. Use sort_keys=True for json.dump to
ensure the key order is normalized. The script works with both Python
2 and 3.
* test/test-lib.sh: Update test_expect_equal_json.
Daniel Kahn Gillmor [Thu, 17 Aug 2017 23:14:26 +0000 (19:14 -0400)]
reindex: drop notmuch_param_t, use notmuch_indexopts_t instead
There are at least three places in notmuch that can trigger an
indexing action:
* notmuch new
* notmuch insert
* notmuch reindex
I have plans to add some indexing options (e.g. indexing the cleartext
of encrypted parts, external filters, automated property injection)
that should properly be available in all places where indexing
happens.
I also want those indexing options to be exposed by (and constrained
by) the libnotmuch C API.
This isn't yet an API break because we've never made a release with
notmuch_param_t.
These indexing options are relevant in the listed places (and in the
libnotmuch analogues), but they aren't relevant in the other kinds of
functionality that notmuch offers (e.g. dump/restore, tagging, search,
show, reply).
So i think a generic "param" object isn't well-suited for this case.
In particular:
* a param object sounds like it could contain parameters for some
other (non-indexing) operation. This sounds confusing -- why would
i pass non-indexing parameters to a function that only does
indexing?
* bremner suggests online a generic param object would actually be
passed as a list of param objects, argv-style. In this case (at
least in the obvious argv implementation), the params might be some
sort of generic string. This introduces a problem where the API of
the library doesn't grow as new options are added, which means that
when code outside the library tries to use a feature, it first has
to test for it, and have code to handle it not being available.
The indexopts approach proposed here instead makes it clear at
compile time and at dynamic link time that there is an explicit
dependency on that feature, which allows automated tools to keep
track of what's needed and keeps the actual code simple.
My proposal adds the notmuch_indexopts_t as an opaque struct, so that
we can extend the list of options without causing ABI breakage.
The cost of this proposal appears to be that the "boilerplate" API
increases a little bit, with a generic constructor and destructor
function for the indexopts struct.
More patches will follow that make use of this indexopts approach.
Daniel Kahn Gillmor [Thu, 17 Aug 2017 23:14:25 +0000 (19:14 -0400)]
database: add n_d_index_file (deprecates n_d_add_message)
We need a way to pass parameters to the indexing functionality on the
first index, not just on reindexing. The obvious place is in
notmuch_database_add_message. But since modifying the argument list
would break both API and ABI, we needed a new name.
I considered notmuch_database_add_message_with_params(), but the
functionality we're talking about doesn't always add a message. It
tries to index a specific file, possibly adding a message, but
possibly doing other things, like adding terms to an existing message,
or failing to deal with message objects entirely (e.g. because the
file didn't contain a message).
So i chose the function name notmuch_database_index_file.
I confess i'm a little concerned about confusing future notmuch
developers with the new name, since we already have a private
_notmuch_message_index_file function, and the two do rather different
things. But i think the added clarity for people linking against the
future libnotmuch and the capacity for using index parameters makes
this a worthwhile tradeoff. (that said, if anyone has another name
that they strongly prefer, i'd be happy to go with it)
This changeset also adjusts the tests so that we test whether the new,
preferred function returns bad values (since the deprecated function
just calls the new one).
We can keep the deprecated n_d_add_message function around as long as
we like, but at the next place where we're forced to break API or ABI
we can probably choose to drop the name relatively safely.
NOTE: there is probably more cleanup to do in the ruby and go bindings
to complete the deprecation directly. I don't know those languages
well enough to attempt a fix; i don't know how to test them; and i
don't know the culture around those languages about API additions or
deprecations.
Yuri Volchkov [Mon, 21 Aug 2017 15:44:48 +0000 (17:44 +0200)]
show: workaround for the missing file problem
This patch fixes the 'Deleted first duplicate file does not stop
notmuch show from working' test.
If a message to be shown has several duplicated files, and for some
reason the first file in the list is not available anymore, notmuch
will exit with an error.
This is clearly a problem in the database, but we are not going to let
this problem be a show-stopper. Let's walk through the list, and show
the first existing file.
Signed-off-by: Yuri Volchkov <yuri.volchkov@gmail.com>
Yuri Volchkov [Mon, 21 Aug 2017 15:44:47 +0000 (17:44 +0200)]
test: show id:<> works even if the first duplicate is deleted
Signed-off-by: Yuri Volchkov <yuri.volchkov@gmail.com>
Yuri Volchkov [Mon, 21 Aug 2017 15:44:46 +0000 (17:44 +0200)]
insert: strip trailing / in folder path
This patch fixes the "Insert message into folder with trailing /"
test. The problem was insufficient path canonization.
From database's point of view, "Sent" and "Sent/" are different
folders. If user runs (note the last '/'):
notmuch insert --folder=maildir/Sent/ < test.msg
notmuch will create an extra XDIRECTORY record for the folder
'Sent/'. This means that database will have _TWO_ records for _ONE_
physical folder: 'Sent' and 'Sent/'. However, the 'notmuch new'
command will update only records related to the first one (the correct
one).
Now, if user moved the email file (e.g. from 'Sent/new' to
'Sent/cur'), 'notmuch new' will add a record about the new file, but
will not delete the old record.
Signed-off-by: Yuri Volchkov <yuri.volchkov@gmail.com>
Yuri Volchkov [Mon, 21 Aug 2017 15:44:45 +0000 (17:44 +0200)]
database: move striping of trailing '/' into helper function
Stripping trailing character is not that uncommon
operation. Particularly, the next patch has to perform it as
well. Lets move it to the separate function to avoid code duplication.
Also the new function has a little improvement: if the character to
strip is repeated several times in the end of a string, function
strips them all.
Signed-off-by: Yuri Volchkov <yuri.volchkov@gmail.com>
David Bremner [Fri, 18 Aug 2017 23:50:06 +0000 (20:50 -0300)]
perf-test: add memory test for notmuch-insert
In the future it might be worthwhile selecting corpus messages to
insert, but that seems a bit overcomplicated for now
David Bremner [Fri, 18 Aug 2017 23:50:05 +0000 (20:50 -0300)]
perf-test: renumber tests
One test per number so ordering is clear.
David Bremner [Fri, 18 Aug 2017 23:50:04 +0000 (20:50 -0300)]
test: move generate_message, add_message into test-lib-common.sh
The plan is to use at least the former in the perf test suite.
Daniel Kahn Gillmor [Thu, 17 Aug 2017 23:14:24 +0000 (19:14 -0400)]
lib: clarify description of notmuch_database_add_message
Since we're accumulating the index when we add a new file to the
message, the semantics have slightly changed. This tries to align the
documentation with the actual functionality.
Vladimir Panteleev [Thu, 17 Aug 2017 17:57:12 +0000 (17:57 +0000)]
emacs: Use make-process when available
make-process is a new function introduced in Emacs 25, which provides
greater control over process creation. Crucially, it allows
separately redirecting stderr directly to a buffer, which allows us to
avoid needing to use the shell to redirect to a temporary file in
order to correctly distinguish stdout and stderr.
* notmuch-lib.el: Use make-process when it is available; fall back to
the previous method when not.
Vladimir Panteleev [Thu, 17 Aug 2017 17:57:11 +0000 (17:57 +0000)]
emacs: Refactor subprocess stderr propagation
Load subprocess error output to a string in the callers, and propagate
the error messages as a string parameter instead of a path to file
names.
Required to be able to avoid using temporary files for subprocess
error output.
* notmuch-lib.el: Update notmuch-check-async-exit-status,
notmuch-check-exit-status: accept an err parameter instead of
err-file; shift the responsibility of loading error messages from
files up the call stack.
Vladimir Panteleev [Mon, 14 Aug 2017 06:36:54 +0000 (06:36 +0000)]
doc: Disable SmartyPants in generated manual pages
By default, Sphinx tries to pre-process text through SmartyPants,
which attempts to convert ASCII quotes and dashes to Unicode
characters. Unfortunately, this mangles technical text such as command
lines. For instance, this excerpt from notmuch-tag.rst:
**notmuch** **tag** **--batch** [--input=<*filename*>]
got turned into:
notmuch tag –batch [–input=<filename>]
That's an en-dash and an em-dash respectively.
Not only are these characters visually confusing and could easily be
mistaken for a single dash, copying and pasting such command lines
into a terminal is doomed to result in incomprehensible error
messages.
* doc/conf.py: Disable SmartyPants.
Jani Nikula [Sun, 13 Aug 2017 09:07:24 +0000 (12:07 +0300)]
emacs: set query-context to nil if its "" or "*"
The queries "" and "*" are special cased in the notmuch library to
match all messages, but only if they're the entire query. They can't
be combined with other queries, such as "* AND foo", in which case
they "leak" down to the Xapian query parser.
Notmuch show and tree buffers inadvertently combine the thread query
with said special queries, causing incorrect collapsing of
messages. Handle the special queries specially. We already do a
similar thing in notmuch-search-filter.
Yuri Volchkov [Sat, 12 Aug 2017 16:47:30 +0000 (18:47 +0200)]
test: insert into the folder with trailing /
From database's point of view, "Drafts" and "Drafts/" are different
folders
Signed-off-by: Yuri Volchkov <yuri.volchkov@gmail.com>
Amended: add test_subtest_known_broken (db)
Daniel Kahn Gillmor [Wed, 9 Aug 2017 07:14:41 +0000 (03:14 -0400)]
completion: add bash completion for "notmuch reindex"
The main thing that notmuch reindex does is to use search terms, so we
can reuse a bunch of the existing completion framework.
Daniel Kahn Gillmor [Wed, 9 Aug 2017 07:44:10 +0000 (03:44 -0400)]
fix typo
Yuri Volchkov [Fri, 11 Aug 2017 18:31:22 +0000 (20:31 +0200)]
test: remove remainder of previously killed basic test
In the commit
51cd69feb1d131db7a468e33e0fa2e043caad41e the part of the
test "test runs if prerequisite is satisfied" has been
removed. However, there was a remainder of that test - variable
'haveit'.
Kill it, to not to confuse people.
Signed-off-by: Yuri Volchkov <yuri.volchkov@gmail.com>
Vladimir Panteleev [Thu, 17 Aug 2017 00:41:10 +0000 (00:41 +0000)]
Use rooted paths in .gitignore files
A leading / in paths in a .gitignore file matches the beginning of the
path, meaning that for patterns without slashes, git will match files
only in the current directory as opposed to in any subdirectory.
Prefix relevant paths with / in .gitignore files, to prevent
accidentally ignoring files in subdirectories and possibly slightly
improve the performance of "git status".
Vladimir Panteleev [Thu, 17 Aug 2017 00:41:09 +0000 (00:41 +0000)]
test: Update extant references to corpus.mail
971cdc72cdb80f060193bc0914dc9badcc29696b renamed corpus.mail to
corpora.mail. Although
971cdc72cdb80f060193bc0914dc9badcc29696b
updated some of the remaining corpus.mail references, two remained,
causing the test suite to leave behind an unignored corpora.mail
directory.
Daniel Kahn Gillmor [Fri, 14 Jul 2017 13:05:06 +0000 (15:05 +0200)]
remove boolean "first" argument from format_part_sprinter
This argument seems to be unused, and format_part_sprinter isn't
required to meet any specific API so it seems cleaner and simpler to
drop it.
David Bremner [Tue, 8 Aug 2017 16:35:08 +0000 (12:35 -0400)]
test: add test for ,S message without 'unread' in new.tags
This is arguably overkill, but it helps to understand the complicated
interactions here between maildir tags and configuration.
David Bremner [Tue, 8 Aug 2017 16:35:07 +0000 (12:35 -0400)]
test: add missing quotes in maildir-sync test.
Oops. ';' is significant in the shell. Who knew.
David Bremner [Thu, 17 Aug 2017 00:44:43 +0000 (21:44 -0300)]
Merge branch 'release'
merge in debian-only changes
David Bremner [Sat, 15 Jul 2017 02:01:26 +0000 (23:01 -0300)]
cli/new: improve error reporting
Recently a user reported a crash in notmuch new, but because of
missing error reporting, all they could say was "A Xapian exception
occured". This commit adds the extra information available about
the error message in the exception.
David Bremner [Thu, 17 Aug 2017 00:38:26 +0000 (21:38 -0300)]
debian: start changelog for next debian upload
Daniel Kahn Gillmor [Thu, 20 Jul 2017 06:28:52 +0000 (08:28 +0200)]
do not use bullets in debian/NEWS
see lintian's debian-news-entry-uses-asterisk for justification
Daniel Kahn Gillmor [Fri, 28 Jul 2017 18:45:05 +0000 (14:45 -0400)]
remove obsolete lintian-override (see https://bugs.debian.org/865055)
David Bremner [Tue, 15 Aug 2017 11:38:10 +0000 (08:38 -0300)]
Merge tag 'debian/0.25-6'
uploaded to unstable
David Bremner [Tue, 15 Aug 2017 10:52:47 +0000 (07:52 -0300)]
debian: actually stop shipping 50notmuch.el
David Bremner [Thu, 10 Aug 2017 11:08:49 +0000 (07:08 -0400)]
Merge tag 'debian/0.25-5'
uploaded to unstable
David Bremner [Thu, 10 Aug 2017 10:44:07 +0000 (06:44 -0400)]
debian upload 0.25-5
fix typo in -4
David Bremner [Fri, 4 Aug 2017 21:38:45 +0000 (17:38 -0400)]
test: add broken tests for maildir syncing
Users should be able to specify synced tags in new.tags
David Bremner [Fri, 4 Aug 2017 22:43:33 +0000 (18:43 -0400)]
Merge tag 'debian/0.25-4'
uploaded to unstable
David Bremner [Fri, 4 Aug 2017 22:15:09 +0000 (18:15 -0400)]
debian: upload 0.25-4
replace notmuch-emacs with elpa-emacs as a recommend
David Bremner [Thu, 3 Aug 2017 14:59:32 +0000 (10:59 -0400)]
Merge tag 'debian/0.25-3'
uploaded to unstable
David Bremner [Thu, 3 Aug 2017 13:26:34 +0000 (09:26 -0400)]
debian: changelog stanza for 0.25-3