notmuch release 0.24 now available

2017-03-12 Thread David Bremner

Where to obtain notmuch 0.24
===
  https://notmuchmail.org/releases/notmuch-0.24.tar.gz

Which can be verified with:

  https://notmuchmail.org/releases/notmuch-0.24.tar.gz.sha256
  f7e44cf67630669d3537c4febd7685ca27d62a134e42f9a5db90d5a6ed4c75fc  
notmuch-0.24.tar.gz

  https://notmuchmail.org/releases/notmuch-0.24.tar.gz.sha256.asc
  (signed by David Bremner)

What's new in notmuch 0.24
=

General
---

Regular expression searches supported for `from:` and `subject:`.

  This requires recent Xapian (1.4+) See notmuch-search-terms(7) for
  details.

Command Line Interface
--

Run external `notmuch-` prefixed commands as subcommands

  You can now add your own `notmuch-` prefixed commands in PATH, and
  have notmuch run them as if they were notmuch commands. See the
  `notmuch(1)` man page for details

Emacs
-

Postpone and resume messages in `notmuch-message-mode` (composition)

  Notmuch now has built in support for postponing, saving and resuming
  messages. The default bindings are C-x C-s to save a draft, C-c C-p
  to postpone a draft (save and exit compose buffer), and "e" in show
  or tree view to resume.

  Draft messages are tagged with `notmuch-draft-tags` (draft by
  default) so you may wish to add that to the excluded tags list. When
  saving a previously saved draft message the earlier draft gets
  tagged deleted.

  Note that attachments added before postponing will be included as
  they were when you postponed in the final message.

Address Completion

  It is now possible to save the list of address completions for
  notmuch's internal completion between runs of emacs. This makes the
  first calls to address completion much better and faster. For
  privacy reasons it is disabled by default, to enable set or
  customize `notmuch-address-save-filename`.

Tag jump menu

  It is now possible to configure tagging shortcuts (with an interface
  like notmuch jump). For example (by default) k u will remove the
  unread tag, and k s will add a tag "spam" and remove the inbox
  tag. Pressing k twice will do the reverse operation so, for example,
  k k s removes the spam tag and adds the inbox tag. See the customize
  variable `notmuch-tagging-keys` for more information.

Refresh all buffers

  It is now possible to refresh all notmuch buffers to reflect the
  current state of the database with a single command, `M-=`.

Stop display of application/* parts

  By default gnus displays all application/* parts such as
  application/zip in the message buffer. This has several undesirable
  effects for notmuch (security, triggering errors etc). Notmuch now
  overrides this and does not display them by default. If you have
  customized `mm-inline-override-types` then we assume you know what
  you want and do not interfere; if you do want to stop the display of
  application/* add application/* to your customization. If you want
  to allow application/* then set `mm-inline-override-types` to
  "non/existent".

Small change in the api for notmuch-search-tag

  When `notmuch-search-tag` is called non-interactively and the region
  is set, then it only tags the threads in the region. (Previously it
  only tagged the current thread.)

Bugfix for sending messages with very long headers.

  Previously emacs didn't fold very long headers when sending which
  could cause the MTA to refuse to send the message. This makes sure
  it does fold any long headers so the message is RFC compliant.

`notmuch emacs-mua` command installed with the Emacs interface

  We've carried a `notmuch-emacs-mua` script in the source tree for
  quite some time. It can be used to launch the Notmuch Emacs
  interface from the command line in many different ways. Starting
  with this release, it will be installed with the Emacs
  interface. With the new external subcommand support, the script
  transparently becomes a new notmuch command. See the
  `notmuch-emacs-mua(1)` man page for details.

Notmuch Emacs desktop integration

  The desktop integration file will now be installed with the Notmuch
  Emacs interface, adding a Notmuch menu item and configuration to
  allow the user to set up Notmuch Emacs as the `mailto:` URL handler.

Library changes
---

`notmuch_query_count_messages` is now non-destructive.

  Internally the implementation of excludes has changed to make this
  possible.

Improved handling of DatabaseModifiedError

  Previously uncaught exceptions reading message metadata are now
  handled.

What is notmuch
===
Notmuch is a system for indexing, searching, reading, and tagging
large collections of email messages in maildir or mh format. It uses
the Xapian library to provide fast, full-text search with a convenient
search syntax.

For more about notmuch, see https://notmuchmail.org

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 1/3] configure: add ${NOTMUCH_SRCDIR} -- absolute path to notmuch source

2017-03-12 Thread David Bremner
Tomi Ollila  writes:

> The ${srcdir} -- usually relative path to notmuch source -- works fine
> in current ./configure and all makefiles. To have simple access to
> notmuch source in tests and out of tree builds holding absolute path to
> the source directory is useful.

series pushed to master.

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: verify test database v1 checksum in more portable way

2017-03-12 Thread David Bremner
Tomi Ollila  writes:

> Replaced use of sha256 (gnu coreutils binary) with more portable
> openssl sha256 execution.
> ---
>
> Works on Linux and also on my FreeBSD KVM environment.

There's a tradeoff here. In a minimal GNU/Linux environment coreutils is
there but not openssl. So I don't mind the substitution (for the test
suite), but I think you need to add a
"test_require_external prereq openssl" or equivalent to T530-upgrade.sh

This will also require adding openssl as a debian build dependency; I
can also live with that, although it might inconvenience some people
building the debian-snapshot target.

There's something aesthetically displeasing about hardcoding the
checksum into the test script but I think I'm just grumbling at this
point.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: emacs: use epg-gpg-program

2017-03-12 Thread David Bremner
Tomi Ollila  writes:

> From: John Byrnes 
>
> From: John Byrnes 
>
> Adjusted notmuch-crypto gpg call-process function to respect
> the GPG program set by the EasyPG epg-gpg-program variable.
>
> This is to correct a problem observed on NixOS where only gpg2 is
> installed by default. The Notmuch Emacs frontend fails when trying to
> access someone's key to verify their signature when it cannot find the
> GPG binary.

Following Tomi's hint on IRC I ran

emacs -Q --batch --eval "(progn (package-initialize) (require 'notmuch) 
(message epg-gpg-program))"

and it seems epg-gpg-program is defined. On the other hand can anyone
think of a good reason not to add (require 'epg) to the top of
notmuch-crypto.el?

d

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: notmuch-0.18 issues [was Re: notmuch-0.16: realpath() compatibility issue; clang visibility problem]

2017-03-12 Thread Thomas Klausner
On Sun, Mar 12, 2017 at 07:24:53PM +0200, Tomi Ollila wrote:
> On Sun, Mar 12 2017, David Bremner  wrote:
> 
> > Thomas Klausner  writes:
> >
> >>
> >> 1. pkgsrc's copy of rst2man is called "rst2man.py". The configure test
> >>
> >
> > Since I see notmuch in pkgsrc for netbsd, I guess things have improved.
> > I had a quick look at the pkgsrc patches [1].  I don't think we're
> > interested in carrying the zlib workarounds upstream, but I guess we
> 
> Note that notmuch dump/restore may not work correctly with zlib 1.2.3 !
> I tried a while ago (someone suggested on this mailing list) and got
> corrupted data. If newer netbsd has newer zlib I'd suggest to use that.

pkgsrc provides a newer zlib. I've removed the compat patches and
depend on zlib-1.2.5.2 now, like notmuch's configure requests.

Thanks for looking at the pkgsrc patches!
 Thomas
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


emacs: use epg-gpg-program

2017-03-12 Thread Tomi Ollila
From: John Byrnes 

From: John Byrnes 

Adjusted notmuch-crypto gpg call-process function to respect
the GPG program set by the EasyPG epg-gpg-program variable.

This is to correct a problem observed on NixOS where only gpg2 is
installed by default. The Notmuch Emacs frontend fails when trying to
access someone's key to verify their signature when it cannot find the
GPG binary.
---

id:878tqrpm8b@johnbyrnes.info with a shorter subject line.

To me this patch LGTM.

In comparison to id:87tw9ek798@alice.fifthhorseman.net , Fedora 25 has:

$ gpg --version
gpg (GnuPG) 1.4.21

$ gpg2 --version
gpg (GnuPG) 2.1.13

$ emacs -Q -batch --eval '(progn (require '\''epg-config) (message 
epg-gpg-program))'
gpg2

 emacs/notmuch-crypto.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
index 68a7e9f..c5111fd 100644
--- a/emacs/notmuch-crypto.el
+++ b/emacs/notmuch-crypto.el
@@ -140,7 +140,7 @@ mode."
 (with-selected-window window
   (with-current-buffer buffer
(goto-char (point-max))
-   (call-process "gpg" nil t t "--list-keys" fingerprint))
+   (call-process epg-gpg-program nil t t "--list-keys" fingerprint))
   (recenter -1
 
 (defun notmuch-crypto-sigstatus-error-callback (button)
@@ -151,9 +151,9 @@ mode."
 (with-selected-window window
   (with-current-buffer buffer
(goto-char (point-max))
-   (call-process "gpg" nil t t "--recv-keys" keyid)
+   (call-process epg-gpg-program nil t t "--recv-keys" keyid)
(insert "\n")
-   (call-process "gpg" nil t t "--list-keys" keyid))
+   (call-process epg-gpg-program nil t t "--list-keys" keyid))
   (recenter -1))
 (notmuch-show-refresh-view)))
 
-- 
2.10.0

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] test: verify test database v1 checksum in more portable way

2017-03-12 Thread Tomi Ollila
Replaced use of sha256 (gnu coreutils binary) with more portable
openssl sha256 execution.
---

Works on Linux and also on my FreeBSD KVM environment.

 test/T530-upgrade.sh  | 6 --
 test/test-databases/database-v1.tar.xz.sha256 | 1 -
 2 files changed, 4 insertions(+), 3 deletions(-)
 delete mode 100644 test/test-databases/database-v1.tar.xz.sha256

diff --git a/test/T530-upgrade.sh b/test/T530-upgrade.sh
index f0fd151..bda3f98 100755
--- a/test/T530-upgrade.sh
+++ b/test/T530-upgrade.sh
@@ -12,8 +12,10 @@ fi
 
 test_begin_subtest "database checksum"
 test_expect_success \
-'( cd $TEST_DIRECTORY/test-databases &&
-   sha256sum --quiet --check --status ${dbtarball}.sha256 )'
+'case `openssl sha256 $TEST_DIRECTORY/test-databases/${dbtarball}` in
+   *4299e051b10e1fa7b33ea2862790a09ebfe96859681804e5251e130f800e69d2*) ;;
+   *) false ;;
+ esac'
 
 tar xf $TEST_DIRECTORY/test-databases/${dbtarball} -C ${MAIL_DIR} 
--strip-components=1
 
diff --git a/test/test-databases/database-v1.tar.xz.sha256 
b/test/test-databases/database-v1.tar.xz.sha256
deleted file mode 100644
index 2cc4f96..000
--- a/test/test-databases/database-v1.tar.xz.sha256
+++ /dev/null
@@ -1 +0,0 @@
-4299e051b10e1fa7b33ea2862790a09ebfe96859681804e5251e130f800e69d2  
database-v1.tar.xz
-- 
2.9.3

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] configure: change default bash completion location to /usr/share

2017-03-12 Thread Tomi Ollila
On Sun, Mar 12 2017, David Bremner  wrote:

> At least Fedora and Debian now use
> /usr/share/bash-completion/completions now. Apparently
> /etc/bash_completion.d will be phased out at some point in the future.
> ---

LGTM (from keyboard of 20+ year zsh user)

Tomi

>  configure  | 4 ++--
>  debian/notmuch.install | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/configure b/configure
> index e16a9b76..0de354ea 100755
> --- a/configure
> +++ b/configure
> @@ -132,7 +132,7 @@ Fine tuning of some installation directories is available:
>   --sysconfdir=DIRRead-only single-machine data [PREFIX/etc]
>   --emacslispdir=DIR  Emacs code [PREFIX/share/emacs/site-lisp]
>   --emacsetcdir=DIR   Emacs miscellaneous files 
> [PREFIX/share/emacs/site-lisp]
> - --bashcompletiondir=DIR Bash completions files 
> [SYSCONFDIR/bash_completion.d]
> + --bashcompletiondir=DIR Bash completions files 
> [PREFIX/share/bash-completion/completions]
>   --zshcompletiondir=DIR  Zsh completions files 
> [PREFIX/share/zsh/functions/Completion/Unix]
>  
>  Some features can be disabled (--with-feature=no is equivalent to
> @@ -1030,7 +1030,7 @@ HAVE_DOXYGEN=${have_doxygen}
>  desktop_dir = \$(prefix)/share/applications
>  
>  # The directory to which bash completions files should be installed
> -bash_completion_dir = ${BASHCOMPLETIONDIR:=\$(sysconfdir)/bash_completion.d}
> +bash_completion_dir = 
> ${BASHCOMPLETIONDIR:=\$(prefix)/share/bash-completion/completions}
>  
>  # The directory to which zsh completions files should be installed
>  zsh_completion_dir = 
> ${ZSHCOMLETIONDIR:=\$(prefix)/share/zsh/functions/Completion/Unix}
> diff --git a/debian/notmuch.install b/debian/notmuch.install
> index 86e891d4..31b9a37e 100644
> --- a/debian/notmuch.install
> +++ b/debian/notmuch.install
> @@ -1,3 +1,3 @@
>  usr/bin
>  usr/share/man
> -etc/bash_completion.d
> +usr/share/bash-completion
> -- 
> 2.11.0
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: notmuch-0.18 issues [was Re: notmuch-0.16: realpath() compatibility issue; clang visibility problem]

2017-03-12 Thread Tomi Ollila
On Sun, Mar 12 2017, David Bremner  wrote:

> Thomas Klausner  writes:
>
>>
>> 1. pkgsrc's copy of rst2man is called "rst2man.py". The configure test
>>
>
> Since I see notmuch in pkgsrc for netbsd, I guess things have improved.
> I had a quick look at the pkgsrc patches [1].  I don't think we're
> interested in carrying the zlib workarounds upstream, but I guess we

Note that notmuch dump/restore may not work correctly with zlib 1.2.3 !
I tried a while ago (someone suggested on this mailing list) and got
corrupted data. If newer netbsd has newer zlib I'd suggest to use that.

My 3-year old "supportive patch"
https://notmuchmail.org/pipermail/notmuch/2014/017918.html
still works nicely (building with it on one system and using in two).


> could look at a rename of libutil.a. 'libmyutil.a' is not really nice,
> but I guess we could use libnmutil.a or libnotmuch_util.a.
>
> Any upstream contributors with opinions on what colour we should paint
> this particular unicycle shed?

From those 2 my vote would be libnotmuch_util.a. I'd think more of it but I
probably forget.

>
> d
>
> [1]: http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/mail/notmuch/patches/


Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] configure: change default bash completion location to /usr/share

2017-03-12 Thread David Bremner
At least Fedora and Debian now use
/usr/share/bash-completion/completions now. Apparently
/etc/bash_completion.d will be phased out at some point in the future.
---
 configure  | 4 ++--
 debian/notmuch.install | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index e16a9b76..0de354ea 100755
--- a/configure
+++ b/configure
@@ -132,7 +132,7 @@ Fine tuning of some installation directories is available:
--sysconfdir=DIRRead-only single-machine data [PREFIX/etc]
--emacslispdir=DIR  Emacs code [PREFIX/share/emacs/site-lisp]
--emacsetcdir=DIR   Emacs miscellaneous files 
[PREFIX/share/emacs/site-lisp]
-   --bashcompletiondir=DIR Bash completions files 
[SYSCONFDIR/bash_completion.d]
+   --bashcompletiondir=DIR Bash completions files 
[PREFIX/share/bash-completion/completions]
--zshcompletiondir=DIR  Zsh completions files 
[PREFIX/share/zsh/functions/Completion/Unix]
 
 Some features can be disabled (--with-feature=no is equivalent to
@@ -1030,7 +1030,7 @@ HAVE_DOXYGEN=${have_doxygen}
 desktop_dir = \$(prefix)/share/applications
 
 # The directory to which bash completions files should be installed
-bash_completion_dir = ${BASHCOMPLETIONDIR:=\$(sysconfdir)/bash_completion.d}
+bash_completion_dir = 
${BASHCOMPLETIONDIR:=\$(prefix)/share/bash-completion/completions}
 
 # The directory to which zsh completions files should be installed
 zsh_completion_dir = 
${ZSHCOMLETIONDIR:=\$(prefix)/share/zsh/functions/Completion/Unix}
diff --git a/debian/notmuch.install b/debian/notmuch.install
index 86e891d4..31b9a37e 100644
--- a/debian/notmuch.install
+++ b/debian/notmuch.install
@@ -1,3 +1,3 @@
 usr/bin
 usr/share/man
-etc/bash_completion.d
+usr/share/bash-completion
-- 
2.11.0

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: reply to messages with message/rfc822 parts

2017-03-12 Thread David Bremner
Mark Walters  writes:

> Hello
>
> I was trying to reply to a message I had forwarded to someone (to update
> the information sent in the first message) and came across some strange
> behaviour.
>
>
> The initial forward was done using notmuch-emacs: this took the message
> and sent it as a message/rfc822 mimetype complete message. Since I had
> added some text at the top this meant the message as a whole was
> multipart/mixed with my text/plain at the top and the message/rfc822
> below.
>
> Then I tried to reply to this message and the text/plain part was
> included in the reply but the message/rfc822 part was not. In this case
> the message/rfc822 just had headers and a text/plain subpart so I would
> have expected it to be included.
>
> I imagine we actually want to recurse into the message/rfc822 part
> including relevant subparts. I tried tweaking notmuch-mua.el to do this
> but, so far, I have failed. (I will have another look)

As far as I know this problem is now fixed.

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: notmuch-0.18 issues [was Re: notmuch-0.16: realpath() compatibility issue; clang visibility problem]

2017-03-12 Thread David Bremner
Thomas Klausner  writes:

>
> 1. pkgsrc's copy of rst2man is called "rst2man.py". The configure test
> for this fails, of course, and there is another place where rst2man is
> called directly. I've changed that to rst2man.py locally, but it'd be
> good if configure could test for both names, set a variable to the one
> found, and use the variable in the other place.
>
> 2. doc/Makefile.local has "python" hardcoded. pkgsrc supports multiple
> python versions at the same time, with the disadvantage that there is
> no "python" executable, only "python2.6", "python2.7", "python3.3"
> etc. I've passed in the proper executable name as PYTHONBIN and used
> it in the Makefile.
>
> 3. installation of notmuch-version.el fails, because the install rule
> has no dependency on the generated file notmuch-version.el. I've added
> such a dependency.
>

Since I see notmuch in pkgsrc for netbsd, I guess things have improved.
I had a quick look at the pkgsrc patches [1].  I don't think we're
interested in carrying the zlib workarounds upstream, but I guess we
could look at a rename of libutil.a. 'libmyutil.a' is not really nice,
but I guess we could use libnmutil.a or libnotmuch_util.a.

Any upstream contributors with opinions on what colour we should paint
this particular unicycle shed?

d

[1]: http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/mail/notmuch/patches/


___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] debian: package ruby bindings

2017-03-12 Thread David Bremner
Felipe Contreras  writes:

> Signed-off-by: Felipe Contreras 
> ---
>  debian/control  | 14 ++
>  debian/notmuch-ruby.install |  1 +
>  debian/rules|  9 +
>  3 files changed, 24 insertions(+)
>  create mode 100644 debian/notmuch-ruby.install

Nobody really cares for the ruby bindings for notmuch these days, so I'm
going to drop the idea of packaging them for Debian for now.

I'm not really sure about continuing to release the ruby bindings with
notmuch; I'll see how the next API transition goes.

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: notmuch-0.16: realpath() compatibility issue; clang visibility problem

2017-03-12 Thread David Bremner
Thomas Klausner  writes:

> Hi!
>
> I'm currently starting to try out notmuch-0.16 on NetBSD. It went off
> to a rocky start, since it segfaulted in the initial config setup.
>
> Debugging it I found that notmuch uses a glibc extension to realpath,
> allowing NULL as second argument.

This exact bug was fixed long ago, tagging fixed in nmbug.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [RFC PATCH] cli/search: interpret no search terms as synonym for '*'

2017-03-12 Thread David Bremner
David Bremner  writes:

> This is a bit less typing (and escaping), especially for the
> --output=tags case.
> ---
>
> I started merrily on other commands, but I'm not so sure. For example
> "git annex metadata" has the feature of interpreting missing file name
> as all files and I find it super irritating in general because I keep
> adding tags to all files. Hence RFC.

Since I didn't receive any feedback, I'm going to drop plans to add this
feature for now.

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] test-databases: use wget or curl to download test databases

2017-03-12 Thread Tomi Ollila
Often Linux systems are shipped with wget(1) by default (and no curl).

Many BSDs, macOS, and e.g. some Linux minimal/container images
comes with curl(1) (and no wget).

Attempting to download with curl if wget is not available increases
the likelihood for this to succeed.
---

This is an update to id:1395846591-3490-1-git-send-email-tomi.oll...@iki.fi
(~1080 days). Changed 'hash' to 'command -v' and added '-L' to curl options
(just to be sure) -- and added more detail to the commit message -- Latest
observation was that centos 7 (docker) container image did not have wget(1)
but curl(1) there were.

David asked whether this a job for configure. For the time being I think this
is simplest to use -- any alternative adds unnecessary cohesion between the
tool/configuration and this make. If, in the future, we will add more online
capabilities to this (test) system, then, perhaps we'd better to make some
script (as command) to handle that; now 3 years has passed since my previous
version -- and that is good as we'd like to be as offline as possible there.

 test/test-databases/Makefile.local | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/test/test-databases/Makefile.local 
b/test/test-databases/Makefile.local
index dcc8863c70d8..7aedff70f6e3 100644
--- a/test/test-databases/Makefile.local
+++ b/test/test-databases/Makefile.local
@@ -7,7 +7,13 @@ dir := test/test-databases
 test_databases := $(dir)/database-v1.tar.xz
 
 %.tar.xz:
-   wget -nv -O $@ ${TEST_DATABASE_MIRROR}/$(notdir $@);
+   @exec 1>&2 ;\
+   if command -v wget >/dev/null ;\
+   then set -x; wget -nv -O $@ ${TEST_DATABASE_MIRROR}/$(notdir $@) ;\
+   elif command -v curl >/dev/null ;\
+   then set -x; curl -L -s -o $@ ${TEST_DATABASE_MIRROR}/$(notdir $@) ;\
+   else echo Cannot fetch databases, no wget nor curl available; exit 1 ;\
+   fi
 
 download-test-databases: ${test_databases}
 
-- 
2.11.0

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/2] lib: clamp return value of g_mime_utils_header_decode_date to >=0

2017-03-12 Thread David Bremner
For reasons not completely understood at this time, gmime (as of
2.6.22) is returning a date before 1900 on bad date input. Since this
confuses some other software, we clamp such dates to 0,
i.e. 1970-01-01.
---
 lib/message.cc | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/message.cc b/lib/message.cc
index 007f1171..8a8a25b4 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -1034,10 +1034,15 @@ _notmuch_message_set_header_values (notmuch_message_t 
*message,
 
 /* GMime really doesn't want to see a NULL date, so protect its
  * sensibilities. */
-if (date == NULL || *date == '\0')
+if (date == NULL || *date == '\0') {
time_value = 0;
-else
+} else {
time_value = g_mime_utils_header_decode_date (date, NULL);
+   /*
+* Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=779923
+*/
+   time_value = (time_value < 0) ? 0 : time_value;
+}
 
 message->doc.add_value (NOTMUCH_VALUE_TIMESTAMP,
Xapian::sortable_serialise (time_value));
-- 
2.11.0

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 1/2] lib: add known broken test for parsing bad dates.

2017-03-12 Thread David Bremner
This reproduces the symptoms of bug report
id:20150422065630.6330.90536@hoothoot
---
 test/T660-bad-date.sh | 15 +++
 1 file changed, 15 insertions(+)
 create mode 100755 test/T660-bad-date.sh

diff --git a/test/T660-bad-date.sh b/test/T660-bad-date.sh
new file mode 100755
index ..6463d5b8
--- /dev/null
+++ b/test/T660-bad-date.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+test_description="parsing of bad dates"
+. ./test-lib.sh || exit 1
+
+add_message [date]='"()"'
+
+test_begin_subtest 'Bad dates translate to a date after the Unix epoch'
+test_subtest_known_broken
+cat  OUTPUT
+test_expect_equal_file EXPECTED OUTPUT
+
+test_done
-- 
2.11.0

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 3/3] fix out of tree tests

2017-03-12 Thread Tomi Ollila
Use $NOTMUCH_SRCDIR/ instead of $TEST_DIRECTORY/../ (in those 2 places)
where reference to source directory instead of build directory is
required.
---
 test/test-lib.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 43fed20..185deed 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -1129,7 +1129,7 @@ test_emacs () {
 test_python() {
 # Note: if there is need to print debug information from python program,
 # use stdout = os.fdopen(6, 'w') or stderr = os.fdopen(7, 'w')
-PYTHONPATH="$TEST_DIRECTORY/../bindings/python${PYTHONPATH:+:$PYTHONPATH}" 
\
+PYTHONPATH="$NOTMUCH_SRCDIR/bindings/python${PYTHONPATH:+:$PYTHONPATH}" \
$NOTMUCH_PYTHON -B - > OUTPUT
 }
 
@@ -1141,7 +1141,7 @@ test_C () {
 exec_file="test${test_count}"
 test_file="${exec_file}.c"
 cat > ${test_file}
-${TEST_CC} ${TEST_CFLAGS} -I${TEST_DIRECTORY} -I${TEST_DIRECTORY}/../lib 
-o ${exec_file} ${test_file} -L${TEST_DIRECTORY}/../lib/ -lnotmuch -ltalloc
+${TEST_CC} ${TEST_CFLAGS} -I${TEST_DIRECTORY} -I${NOTMUCH_SRCDIR}/lib -o 
${exec_file} ${test_file} -L${TEST_DIRECTORY}/../lib/ -lnotmuch -ltalloc
 echo "== stdout ==" > OUTPUT.stdout
 echo "== stderr ==" > OUTPUT.stderr
 ./${exec_file} "$@" 1>>OUTPUT.stdout 2>>OUTPUT.stderr
-- 
2.9.3

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 1/3] configure: add ${NOTMUCH_SRCDIR} -- absolute path to notmuch source

2017-03-12 Thread Tomi Ollila
The ${srcdir} -- usually relative path to notmuch source -- works fine
in current ./configure and all makefiles. To have simple access to
notmuch source in tests and out of tree builds holding absolute path to
the source directory is useful.
---

Fixed version of series starting with
id:1480769604-11307-1-git-send-email-tomi.oll...@iki.fi

diff to that one:

: -if [ "$srcdir" != "." ] && [ "$srcdir" != "$NOTMUCH_SRCDIR" ]; then
: +if [ "$srcdir" != "." ]; then

That one broke OOT build when using absolute path (and is now pretty
obvious)... That change is not needed here (and should not have been
there in the first place...)

 configure | 8 
 1 file changed, 8 insertions(+)

diff --git a/configure b/configure
index e16a9b7..bcfa416 100755
--- a/configure
+++ b/configure
@@ -19,7 +19,12 @@ To work around this problem you may try to execute:
 # Store original IFS value so it can be changed (and restored) in many places.
 readonly DEFAULT_IFS="$IFS"
 
+# The top-level directory for the source. This ./configure and all Makefiles
+# are good with ${srcdir} usually being relative. Some components (e.g. tests)
+# are executed in subdirectories and for those it is simpler to use
+# ${NOTMUCH_SRCDIR} which holds absolute path to the source.
 srcdir=$(dirname "$0")
+NOTMUCH_SRCDIR=$(cd "$srcdir" && pwd)
 
 subdirs="util compat lib parse-time-string completion doc emacs"
 subdirs="${subdirs} performance-test test test/test-databases"
@@ -913,6 +918,7 @@ cat > Makefile.config < sh.config 

[PATCH 2/3] fix out of tree build

2017-03-12 Thread Tomi Ollila
In addition to use ${srcdir} and deliver ${NOTMUCH_SRCDIR} where needed,
source from ruby bindings had to be copied to the out-of-tree target
directory -- if the source files in source directory were referenced
in build and there were also built object files there, those could have
been considered as target files (and then not found when attempting
to create bindings/ruby/notmuch.so).
---
 bindings/Makefile.local  |  1 +
 bindings/ruby/extconf.rb |  2 +-
 configure| 10 --
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/bindings/Makefile.local b/bindings/Makefile.local
index 11d11d4..17b561c 100644
--- a/bindings/Makefile.local
+++ b/bindings/Makefile.local
@@ -8,6 +8,7 @@ ifeq ($(HAVE_RUBY_DEV),1)
cd $(dir)/ruby && \
EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \
LIBNOTMUCH="../../lib/$(LINKER_NAME)" \
+   NOTMUCH_SRCDIR='$(NOTMUCH_SRCDIR)' \
ruby extconf.rb --vendor
$(MAKE) -C $(dir)/ruby
 endif
diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
index ddaa684..161de5a 100644
--- a/bindings/ruby/extconf.rb
+++ b/bindings/ruby/extconf.rb
@@ -5,7 +5,7 @@
 
 require 'mkmf'
 
-dir = File.join('..', '..', 'lib')
+dir = File.join(ENV['NOTMUCH_SRCDIR'], 'lib')
 
 # includes
 $INCFLAGS = "-I#{dir} #{$INCFLAGS}"
diff --git a/configure b/configure
index bcfa416..6c782e1 100755
--- a/configure
+++ b/configure
@@ -47,6 +47,12 @@ if [ "$srcdir" != "." ]; then
 # Emacs only likes to generate compiled files next to the .el files
 # by default so copy these as well (which is not ideal).
 cp -a "$srcdir"/emacs/*.el emacs
+
+# We were not able to create fully working Makefile using ruby mkmf.rb
+# so ruby bindings source files are copied as well (ditto -- not ideal).
+mkdir bindings/ruby
+cp -a "$srcdir"/bindings/ruby/*.[ch] bindings/ruby
+cp -a "$srcdir"/bindings/ruby/extconf.rb bindings/ruby
 fi
 
 # Set several defaults (optionally specified by the user in
@@ -357,8 +363,8 @@ int main(void) {
 return 0;
 }
 EOF
-if ${CC} ${CFLAGS} _libversion.c -o _libversion > /dev/null 2>&1 && \
-   ./_libversion > _libversion.sh && . ./_libversion.sh
+if ${CC} ${CFLAGS} -I"$srcdir" _libversion.c -o _libversion > /dev/null 2>&1 \
+   && ./_libversion > _libversion.sh && . ./_libversion.sh
 then
 printf "OK.\n"
 else
-- 
2.9.3

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch