Commit graph

6253 commits

Author SHA1 Message Date
Tomi Ollila
eb1f799892 configure: fix reference to possibly undefined $PKG_CONFIG_PATH
In case zlib not found by pkg-config(1) the pkg-config information
is resolved by attempting to print ZLIB_VERSION from from zlib
installation if it exists anyway.

If above done successfully compat/zlib.pc is written for forthcoming
pkg-config execution.

Since `set -u` is in effect (since 124a67e96, 2016-05-06),
expanding unset $PKG_CONFIG_PATH (would have) failed whenever tried.

Now it is changed to set as "$PKG_CONFIG_PATH:compat" if PKG_CONFIG_PATH
is set and is non-empty string, plain "compat" otherwise.
2019-12-09 16:24:37 -04:00
Daniel Kahn Gillmor
e712b91f46 wrap-and-sort -ast
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-12-04 08:06:19 -04:00
Daniel Kahn Gillmor
fe66c3048a Add debian/upstream/metadata (for DEP-12)
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-12-03 19:11:15 -04:00
Daniel Kahn Gillmor
20bd613261 debian/copyright: use secure git URL
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-12-03 19:09:38 -04:00
Daniel Kahn Gillmor
7ffff7927c Rules-Requires-Root: no (we do nothing as root during package build)
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-12-03 19:09:06 -04:00
Daniel Kahn Gillmor
575f207b3d Standards-Version: bump to 4.4.1 (no changes needed)
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-12-03 19:08:11 -04:00
Oliver Kiddle
2044c7aad9 configure: Install zsh completions where zsh will find them.
Zsh searches in the $fpath array for completion functions. By default
this includes $(prefix)/share/zsh/site-functions but not the existing
value. The prefix for zsh and notmuch isn't guaranteed to be the same
but it normally will be making this a better default for
zsh_completion_dir.
2019-12-03 08:25:55 -04:00
David Bremner
3185830e3a python-cffi: use shutil.which
I was supposed to amend the original patch that added this function,
but somehow I botched that. The original version runs, so make an
extra commit for the tidying.
2019-12-03 08:12:30 -04:00
Floris Bruynooghe
1e072204cd Move from _add_message to _index_file API
This moves away from the deprecated notmuch_database_add_message API
and instead uses the notmuch_database_index_file API.  This means
instroducing a class to manage the index options and bumping the
library version requirement to 5.1.
2019-12-03 08:12:30 -04:00
Floris Bruynooghe
e2df30f7a9 Rename package to notmuch2
This is based on a previous discussion on the list where this was more
or less seen as the least-bad option.
2019-12-03 08:12:30 -04:00
Floris Bruynooghe
a950aa2844 Show which notmuch command and version is being used
This add the notmuch version and absolute path of the binary used
in the pytest header.  This is nice when running the tests
interactively as you get confirmation you're testing the version you
thought you were testing.
2019-12-03 08:12:30 -04:00
David Bremner
fbb8e1f430 debian: add python3 dependencies for the new python bindings
These should generally match those in .travis.yml
2019-12-03 08:12:30 -04:00
David Bremner
a48ccb5ef8 switch travis to bionic
This should solve the problem with pytest versions. Drop the notmuch
PPA, as (hopefully) we don't need those packages in bionic
2019-12-03 08:12:30 -04:00
David Bremner
af8c069194 travis: add python3-{cffi,pytest,setuptools}, libpython3-all-dev
These are needed for building and testing the new python bindings.
2019-12-03 08:12:30 -04:00
David Bremner
85adc756c9 tests: run python-cffi tests
The entire python-cffi test suite is considered as a single test at
the level of the notmuch test suite. This might or might not be ideal,
but it gets them run.
2019-12-03 08:12:30 -04:00
David Bremner
46e9615621 build: optionally build python-cffi bindings
Put the build product (and tests) in a well known location so that we
can find them e.g. from the tests.
2019-12-03 08:12:30 -04:00
David Bremner
3aaa8cfe94 configure: check for python cffi and pytest modules
This is needed to build the new python bindings, and run their tests.
2019-12-03 08:12:30 -04:00
David Bremner
e8cb7c7f60 bindings/python-cffi: preserve environment for tests
We'll need this e.g. to pass PATH to the pytest tests

Based on the suggested approach in id:87d0eljggj.fsf@powell.devork.be
2019-12-03 08:12:30 -04:00
Floris Bruynooghe
83c2d15898 Introduce CFFI-based python bindings
This introduces CFFI-based Python3-only bindings.
The bindings aim at:
- Better performance on pypy
- Easier to use Python-C interface
- More "pythonic"
  - The API should not allow invalid operations
  - Use native object protocol where possible
- Memory safety; whatever you do from python, it should not coredump.
2019-12-03 08:12:30 -04:00
William Casarin
5f9ea4d290 emacs: bind M-RET to notmuch-tree-from-search-thread
This is an unbound function that is quite useful. It opens a selected
thread in notmuch-tree from the current search query.

Signed-off-by: William Casarin <jb55@jb55.com>
2019-12-03 07:43:36 -04:00
David Edmondson
a1139fb5ec emacs: A prefix argument kills rather than browsing URLs
In `notmuch-show', the "B" key (notmuch-show-browse-urls) will kill
the URL if called with a prefix argument rather than browsing
directly.
2019-12-03 07:41:38 -04:00
David Bremner
dc2b5a031b notmuch release 0.29.3-1 for unstable (sid) [dgit]
[dgit distro=debian no-split --quilt=linear]
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEkiyHYXwaY0SiY6fqA0U5G1WqFSEFAl3eb60ACgkQA0U5G1Wq
 FSE1Ug//Wxc7AYeHc9ErjBOkK/oQjagGOI6cKsovHfyHDRqVULsDfGt/at7wBuS2
 7V1sfU5zttoNmltmamkao4T+f/dH70D5UJxWXu1vM0QDnKz+1U4g5jTGV9sDbqwA
 34XtewzZ4508GjmmhhCHLkwQN1zplI1phGfhkwDCWrWc5er8Yat9EroHvgJ2GYcA
 fvMe13hODPC4/R5jPyKHKERyFrcj5oeZPOAV6pnaNKq1qeNgOpKm1usldl73rqe5
 ehrqF5ZgMr7wVjrnK/9wV4x4FTUKTgjweLzwQ3pWkYj3tzDx5KBBM47IrIKwoLh1
 /IS4PY9znohi/Nyl8IScmIeDAVj6PYITj0lqaDCL8x0vTkuZ5f8sFiJORZcmderk
 CylvJUahr/shdV1YolBsh1TfavP4eKIz77MkfO77uTyZACPIyZF0iHlV+me8ixIJ
 IDi2BJ0Sp+pky6/211iJtbf43CUnXATfr3COraLtT/xEKfENA63lvJRL4y+6ahmr
 BrGNfUZTvnY1+K9ym8dm3wfLe49TThMM+zbkY+2b25puO6u7cIFXgjBhhIwC4rdY
 bCd3RewBngge8NzvHw//k5+fd4s7b2BfA/6rLGWlEm4g6eik2IALtDU9Qm3L1twS
 RVr1yLoXICoJNLX7hZlgaF3iv+LzMrWkyKgjaLKiZ8HYnDwKXJg=
 =qUN/
 -----END PGP SIGNATURE-----

Merge tag 'debian/0.29.3-1'

notmuch release 0.29.3-1 for unstable (sid) [dgit]

[dgit distro=debian no-split --quilt=linear]
2019-11-27 08:45:43 -04:00
David Bremner
a59ef7d02c debian: changelog for 0.29.3 2019-11-27 08:20:54 -04:00
David Bremner
e5437dc4c2 mention python 2 changes 2019-11-27 08:20:54 -04:00
David Bremner
3efa2ad72c version: bump to 0.29.3 2019-11-27 08:20:54 -04:00
David Bremner
9024b2f5f6 NEWS for 0.29.3 2019-11-27 08:20:54 -04:00
Ralph Seichter
a11b2f0f2d notmuch-dump.c: Fix output file being closed twice
Fixed: If the output file for a dump was non-writeable, gzclose_w()
was called twice on the output file handle, resulting in SIGABRT.

(cherry picked from commit 17806ecc95)
2019-11-27 08:00:00 -04:00
David Bremner
8e22514842 lib: fix memory error in notmuch_config_list_value
The documentation for notmuch_config_list_key warns that that the
returned value will be destroyed by the next call to
notmuch_config_list_key, but it neglected to mention that calling
notmuch_config_list_value would also destroy it (by calling
notmuch_config_list_key). This is surprising, and caused a use after
free bug in _setup_user_query_fields (first noticed by an OpenBSD
porter, so kudos to the OpenBSD malloc implementation).  This change
fixes that use-after-free bug.
2019-11-27 07:58:09 -04:00
Jakub Wilk
bb843f63fc python: make some docstrings raw
Fixes:

    notmuch/message.py:57: DeprecationWarning: invalid escape sequence \s
    notmuch/query.py:155: DeprecationWarning: invalid escape sequence \.
    notmuch/messages.py:89: DeprecationWarning: invalid escape sequence \s

with Python >= 3.6.
2019-11-20 21:08:15 -04:00
David Bremner
7ad7cfbff2 notmuch release 0.29.2-2 for experimental (experimental) [dgit]
[dgit distro=debian no-split --quilt=linear]
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEkiyHYXwaY0SiY6fqA0U5G1WqFSEFAl299QoACgkQA0U5G1Wq
 FSGeIRAAhVCm1IHVorsfGxf2f+ZLSg/2mqIZCwDRATMjK/lw1pLmJYcyWTAqSWQa
 liIW03ffms63Ry4Y5y6UJAoXALX0VfGqYkPCTiX2W0Qw2gSd/NWWP6nNDMsE+t++
 sYWraR6o6Blepc6odzFU17uib7uutGwng2H2eIWslxJTvR5bly55pybe/fluv7VT
 3kta8fExgVPPC1FpT9TBBykHtcd+Uv7CDHXk2pcw+ELBdKBPwS4Wn0GIU8VJ9mtU
 uHixTuNIjGEJa+n9dCUcHqDHrdgqsoR4RNFAIbQR+1M8zWDC8HFAvaeDe4desPX4
 slVTxzDuEoh8+F+uPNaKy/qAPrFPUP/ruJLAIuHLNo1QVGAFJuBUk5jzTF9nRjTJ
 +Uy2vRGo0REmgmyGc3qOCUn8E6ed3JnA/QpzSUiZNRKZZJgVWAivU0/Kb8ksW1PE
 fzbhkitw5kx3AMTUa4hefKun4vqUlzHBTHWnkUuf91sz0xN6NDFSoWNMnMCQ2i6O
 8ZWhsaUY9wh5JY1izM4LzhcgldKxZ7z0LdhBQG3vET/PZz2wsxQ+LAUQ7ziUHEOC
 pqtDqTO+eGK1w4bhCkIMlK2kU8ScoIHk0vuFgzx5mmYbv2kHhWkG3RsA7z1EE6Ad
 RG7FfRTGTmyQxN36mAsfV5lJvgQ3DFURtCX+zqTnHzb/NtW9Fu0=
 =13/r
 -----END PGP SIGNATURE-----

Merge tag 'debian/0.29.2-2'

notmuch release 0.29.2-2 for experimental (experimental) [dgit]

[dgit distro=debian no-split --quilt=linear]
2019-11-03 08:09:13 -04:00
David Bremner
2a003f0f50 debian upload 0.29.2-2: goodbye python2 support
Convert to pybuild while we are at it.
2019-11-02 18:21:25 -03:00
David Bremner
60ddce8a16 notmuch 0.29.2 release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEkiyHYXwaY0SiY6fqA0U5G1WqFSEFAl2rJ5UACgkQA0U5G1Wq
 FSHLDhAAnV6BGnmT/CBa1FTJQIzsb0QoQZPAMieMoyLfc2ORU71fjaJ+fOo+S9pz
 e0WUocRf9eFFBAiN6AWI3N0UtzGalZzB7mPE+MHlG0SGW8g+7rjWuEaByUyuEDa7
 08AudVHq3KL0eO82P8Bzi0GFhFBP9tKn0hwYUky8A0eGlAVILrUgiMhQbYolB7GN
 a6IlBgFxsbRomzgMO1LBZDv1xCpzWWns8wyv6OUgCPtw6R4miMsym8k3I3+NaGTR
 X/fZRC6bxlpBBYpJzOJg6PD9IXv5aOw9hmhV7eqS3GfYJg+9F2cYdjUzOm4vsAsr
 HTO1i0jsUqy0QOV1KvVs03UG0x2MtCv3BK90nf1XWfA2DCyb8n5uRStwgFzWLWCh
 gXZ6t9dNkU4zk5x5za25Y2j8KMuoXZBbco6krjIRrbKQiEu/ZWDtg5n++z4otJ6q
 TgWjmRN/vQHUvI0mXEEHwuR1s5LUFTXQirOWJv75wedLH6gqfMrtOHqtxhB0Kom2
 9J81KAZ9CEIrio8+Lc3T4hQKta/HSvHf4dJjoPY01uObNadPJ90SLsgTZMRAH5PT
 kt8DBEqQc16e5Cz0UdwsgX5xKCfzYC2SkkFTI5rU3VA+G0cR8X8b0XgOlXYBP5xi
 x8/wjvSnmJbaGL+xBn8quC70SxSNBjZIvRilQdAG7aRKjMbF+bA=
 =zbMW
 -----END PGP SIGNATURE-----

Merge tag '0.29.2'

notmuch 0.29.2 release
2019-10-19 22:25:24 -03:00
David Bremner
1c8d9e172e update NEWS for 0.29.2 2019-10-19 07:37:37 -03:00
David Bremner
75328e4fec Changelog stanza for 0.29.2-1 2019-10-19 07:24:08 -03:00
David Bremner
449e77761e bump version 2019-10-19 07:21:53 -03:00
Daniel Kahn Gillmor
7eb9615b30 Drop devel/printmimestructure (it is in mailscripts 0.11)
mailscripts 0.11 now ships a derivative of devel/printmimestructure
called email-print-mime-structure.  Maintenance for that utility will
happen in mailscripts from now on, so we should not track an
independent copy of it in notmuch's source tree.

See https://bugs.debian.org/939993 for more details about the
adoption.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-10-13 09:31:50 -03:00
David Bremner
1979145b91 Merge branch 'release' 2019-10-13 09:24:48 -03:00
David Bremner
49621ea8d5 util: whitespace cleanup for 4c5b17b1
Oops. This should make the merge back to master smoother.
2019-10-13 09:18:24 -03:00
David Bremner
4c5b17b10b util: unreference objects referenced by the returned stream obj
We want freeing the returned stream to also free these underlying
objects. Compare tests/test-filters.c in the gmime 3.2.x source, which
uses this same idiom.

Thanks to James Troup for the report and the fix.
2019-10-12 08:45:55 -03:00
David Bremner
2cf38f8e1c test: known broken test file descriptor leak in gzip file open
James Troup reported this bug in id:87pnjsf9q5.fsf@canonical.com
2019-10-12 08:43:39 -03:00
David Bremner
74a1b5ac65 Merge branch 'release' 2019-09-23 21:36:01 -03:00
David Bremner
1ee5bdcc1d remove stray ` from NEWS 2019-09-23 21:34:38 -03:00
Daniel Kahn Gillmor
23bcd00363 cli/{show,reply}: use repaired form of "Mixed Up" mangled messages
When showing or replying to a message that has been mangled in transit
by an MTA in the "Mixed up" way, notmuch should instead use the
repaired form of the message.

Tracking the repaired GMimeObject for the lifetime of the mime_node so
that it is cleaned up properly is probably the trickiest part of this
patch, but the choices here are based on the idea that the
mime_node_context is the memory manager for the whole mime_node tree
in the first place, so new GMimeObject tree created on-the-fly during
message parsing should be disposed of in the same place.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-09-15 19:07:06 -04:00
Daniel Kahn Gillmor
4b1a8fd183 index: repair "Mixed Up" messages before indexing.
When encountering a message that has been mangled in the "mixed up"
way by an intermediate MTA, notmuch should instead repair it and index
the repaired form.

When it does this, it also associates the index.repaired=mixedup
property with the message.  If a problem is found with this repair
process, or an improved repair process is proposed later, this should
make it easy for people to reindex the relevant message.  The property
will also hopefully make it easier to diagnose this particular problem
in the future.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-09-15 19:07:06 -04:00
Daniel Kahn Gillmor
67666538b3 util/repair: identify and repair "Mixed Up" mangled messages
Implement a functional identification and repair process for "Mixed
Up" MIME messages as described in
https://tools.ietf.org/html/draft-dkg-openpgp-pgpmime-message-mangling-00#section-4.1

The detection test is not entirely complete, in that it does not
verify the contents of the latter two message subparts, but this is
probably safe to skip, because those two parts are unlikely to be
readable anyway, and the only part we are effectively omitting (the
first subpart) is guaranteed to be empty anyway, so its removal can be
reversed if you want to do so.  I've left FIXMEs in the code so that
anyone excited about adding these additional checks can see where to
put them in.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-09-15 19:06:31 -04:00
Daniel Kahn Gillmor
cb522fb06e test: add test for "Mixed-Up Mime" message mangling
Some MTAs mangle e-mail messages in transit in ways that are
repairable.

Microsoft Exchange (in particular, the version running today on
Office365's mailservers) appears to mangle multipart/encrypted
messages in a way that makes them undecryptable by the recipient.

I've documented this in section 4.1 "Mixed-up encryption" of draft -00
of
https://tools.ietf.org/html/draft-dkg-openpgp-pgpmime-message-mangling

Fortunately, it's possible to repair such a message, and notmuch can
do that so that a user who receives an encrypted message from a user
of office365.com can still decrypt the message.

Enigmail already knows about this particular kind of mangling.  It
describes it as "broken PGP email format probably caused by an old
Exchange server", and it tries to repair by directly changing the
message held by the user.  if this kind of repair goes wrong, the
repair process can cause data loss
(https://sourceforge.net/p/enigmail/bugs/987/, yikes).

The tests introduced here are currently broken.  In subsequent
patches, i'll introduce a non-destructive form of repair for notmuch
so that notmuch users can read mail that has been mangled in this way,
and the tests will succeed.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-09-15 01:20:03 -04:00
Tomi Ollila
e0e55c5b6f configure: disallow whitespace in paths, extend checks to $PWD
Whitespace in $NOTMUCH_SRCDIR (and $PWD) may work in builds,
but definitely will not work in tests. It would be difficult
to make tests support whitespace in test filename paths -- and
fragile to maintain if done.

So it is just easier and safer to disallow whitespace there.

In case of out of tree build $NOTMUCH_SRCDIR differs from $PWD
(current directory). Extend this whitespace, and also previously
made unsafe characters check to $PWD too.
2019-09-11 18:51:23 -03:00
Daniel Kahn Gillmor
9829533e92 index: avoid indexing legacy-display parts
When we notice a legacy-display part during indexing, it makes more
sense to avoid indexing it as part of the message body.

Given that the protected subject will already be indexed, there is no
need to index this part at all, so we skip over it.

If this happens during indexing, we set a property on the message:
index.repaired=skip-protected-headers-legacy-display

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-09-01 08:45:30 -03:00
Daniel Kahn Gillmor
c61e22d5cb cli/{show,reply}: skip over legacy-display parts
Make use of the previous changes to fast-forward past any
legacy-display parts during "notmuch show" and "notmuch reply".

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-09-01 08:44:17 -03:00
Daniel Kahn Gillmor
ff3d873f0b util/repair: add _notmuch_repair_crypto_payload_skip_legacy_display
This is a utility function designed to make it easier to
"fast-forward" past a legacy-display part associated with a
cryptographic envelope, and show the user the intended message body.

The bulk of the ugliness in here is in the test function
_notmuch_crypto_payload_has_legacy_display, which tests all of the
things we'd expect to be true in a a cryptographic payload that
contains a legacy display part.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-09-01 08:40:33 -03:00