possible infinite recursion in notmuch-cli

2013-10-10 Thread Daniel Kahn Gillmor
Hi notmuch folks--

On oss-security recently, there was a discussion about recursive
compression and the ability to create infinite loops.

 id:20131010013106.GA29693 at openwall.com

After some discussion with amdragon on IRC, i believe that this is only
relevant to notmuch when actively decrypting a message -- OpenPGP's
ability to embed compression makes it possible to write a PGP/MIME
message that is a quine: that is, when decompressed, it would expand to
itself, which would send our parser into an infinite loop.

Since we're not decrypting during indexing, only notmuch-show and
notmuch-reply are probably affected by this problem. (but if someone
implements indexing of encrypted messages, then we'd have to worry about
this in the indexer as well)

The simple and generalized solution would be to limit the recursive
depth of our walk of the MIME tree; probably a large limit of something
like 30 or 50 would not trigger any real-world problems, and would halt
a runaway recursion well before most modern machines ran out of
resources.

A more targeted fix might be to just limit the number of recursive
decryptions that happen, since the MIME spec does not appear to be
capable of permitting other parts to provide both compression and
nesting, which is the root of the problem.  However, it's possible that
our MIME parsing ends up being more permissive than the specs, and is
willing to try to interpret (for example) a gzip-compressed multipart/*
or message/* part.  

So the simple/generalized solution is probably the right way to go.

Sorry i don't have time to implement the fix myself right now, but i
wanted to make sure the active coders in the project are aware of the
issue.

Regards,

  --dkg

references:

 http://mumble.net/~campbell/blag.txt (see 2013-10-08)
 http://www.openwall.com/lists/oss-security/2013/10/10/2
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 965 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20131010/0cb76904/attachment.pgp>


[PATCH 1/3] database: Add notmuch_database_compact_close

2013-10-10 Thread Tomi Ollila
On Wed, Oct 02 2013, Ben Gamari  wrote:

> This function uses Xapian's Compactor machinery to compact the notmuch
> database. The compacted database is built in a temporary directory and
> later moved into place while the original uncompacted database is
> preserved.
>
> Signed-off-by: Ben Gamari 
> ---
>  configure   |  27 --
>  lib/database.cc | 151 
> 
>  lib/notmuch.h   |  21 +++-
>  3 files changed, 195 insertions(+), 4 deletions(-)
>
> diff --git a/configure b/configure
> index 6166917..1a8e939 100755
> --- a/configure
> +++ b/configure
> @@ -277,7 +277,8 @@ printf "Checking for Xapian development files... "
>  have_xapian=0
>  for xapian_config in ${XAPIAN_CONFIG}; do
>  if ${xapian_config} --version > /dev/null 2>&1; then
> - printf "Yes (%s).\n" $(${xapian_config} --version | sed -e 's/.* //')
> + xapian_version=$(${xapian_config} --version | sed -e 's/.* //')
> + printf "Yes (%s).\n" ${xapian_version}
>   have_xapian=1
>   xapian_cxxflags=$(${xapian_config} --cxxflags)
>   xapian_ldflags=$(${xapian_config} --libs)
> @@ -289,6 +290,21 @@ if [ ${have_xapian} = "0" ]; then
>  errors=$((errors + 1))
>  fi
>  
> +# Compaction is only supported on Xapian > 1.2.6
> +have_xapian_compact=0
> +if [ ${have_xapian} = "1" ]; then
> +printf "Checking for Xapian compaction support... "
> +case "${xapian_version}" in
> +0.*|1.[01].*|1.2.[0-5])
> +printf "No (only available with Xapian > 1.2.6).\n" ;;
> +[1-9]*.[0-9]*.[0-9]*)
> +have_xapian_compact=1
> +printf "Yes.\n" ;;
> +*)
> +printf "Unknown version.\n" ;;
> +esac
> +fi
> +
>  printf "Checking for GMime development files... "
>  have_gmime=0
>  IFS=';'
> @@ -729,6 +745,9 @@ HAVE_STRCASESTR = ${have_strcasestr}
>  # build its own version)
>  HAVE_STRSEP = ${have_strsep}
>  
> +# Whether the Xapian version in use supports compaction
> +HAVE_XAPIAN_COMPACT = ${have_xapian_compact}
> +
>  # Whether the getpwuid_r function is standards-compliant
>  # (if not, then notmuch will #define _POSIX_PTHREAD_SEMANTICS
>  # to enable the standards-compliant version -- needed for Solaris)
> @@ -787,13 +806,15 @@ CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) 
> \$(GMIME_CFLAGS)  \\
>  -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR) \\
>  -DHAVE_STRSEP=\$(HAVE_STRSEP) \\
>  -DSTD_GETPWUID=\$(STD_GETPWUID)   \\
> --DSTD_ASCTIME=\$(STD_ASCTIME)
> +-DSTD_ASCTIME=\$(STD_ASCTIME) \\
> +-DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)
>  CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)\\
>\$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\
>\$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS) \\
>-DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)   \\
>-DHAVE_STRSEP=\$(HAVE_STRSEP)   \\
>-DSTD_GETPWUID=\$(STD_GETPWUID) \\
> -  -DSTD_ASCTIME=\$(STD_ASCTIME)
> +  -DSTD_ASCTIME=\$(STD_ASCTIME)   \\
> +  -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)
>  CONFIGURE_LDFLAGS =  \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS)
>  EOF
> diff --git a/lib/database.cc b/lib/database.cc
> index bb4f180..06f1c0a 100644
> --- a/lib/database.cc
> +++ b/lib/database.cc
> @@ -24,7 +24,9 @@
>  #include 
>  
>  #include 
> +#include 
>  #include 
> +#include 
>  
>  #include  /* g_free, GPtrArray, GHashTable */
>  #include  /* g_type_init */
> @@ -268,6 +270,8 @@ notmuch_status_to_string (notmuch_status_t status)
>   return "Unbalanced number of calls to notmuch_message_freeze/thaw";
>  case NOTMUCH_STATUS_UNBALANCED_ATOMIC:
>   return "Unbalanced number of calls to 
> notmuch_database_begin_atomic/end_atomic";
> +case NOTMUCH_STATUS_UNSUPPORTED_OPERATION:
> + return "Unsupported operation";
>  default:
>  case NOTMUCH_STATUS_LAST_STATUS:
>   return "Unknown error status value";
> @@ -800,6 +804,153 @@ notmuch_database_close (notmuch_database_t *notmuch)
>  notmuch->date_range_processor = NULL;
>  }
>  
> +#if HAVE_XAPIAN_COMPACT
> +static int unlink_cb (const char *path,
> +   unused (const struct stat *sb),
> +   unused (int type),
> +   unused (struct FTW *ftw))
> +{
> +return remove(path);
> +}
> +
> +static int rmtree (const char *path)
> +{
> +return nftw(path, unlink_cb, 64, FTW_DEPTH | FTW_PHYS);
> +}
> +
> +class NotmuchCompactor : public Xapian::Compactor
> +{
> +notmuch_compact_status_cb_t status_cb;
> +
> +public:
> +NotmuchCompactor(notmuch_compact_status_cb_t cb) : status_cb(cb) { }
> +
> +virt

possible infinite recursion in notmuch-cli

2013-10-10 Thread Daniel Kahn Gillmor
Hi notmuch folks--

On oss-security recently, there was a discussion about recursive
compression and the ability to create infinite loops.

 id:20131010013106.ga29...@openwall.com

After some discussion with amdragon on IRC, i believe that this is only
relevant to notmuch when actively decrypting a message -- OpenPGP's
ability to embed compression makes it possible to write a PGP/MIME
message that is a quine: that is, when decompressed, it would expand to
itself, which would send our parser into an infinite loop.

Since we're not decrypting during indexing, only notmuch-show and
notmuch-reply are probably affected by this problem. (but if someone
implements indexing of encrypted messages, then we'd have to worry about
this in the indexer as well)

The simple and generalized solution would be to limit the recursive
depth of our walk of the MIME tree; probably a large limit of something
like 30 or 50 would not trigger any real-world problems, and would halt
a runaway recursion well before most modern machines ran out of
resources.

A more targeted fix might be to just limit the number of recursive
decryptions that happen, since the MIME spec does not appear to be
capable of permitting other parts to provide both compression and
nesting, which is the root of the problem.  However, it's possible that
our MIME parsing ends up being more permissive than the specs, and is
willing to try to interpret (for example) a gzip-compressed multipart/*
or message/* part.  

So the simple/generalized solution is probably the right way to go.

Sorry i don't have time to implement the fix myself right now, but i
wanted to make sure the active coders in the project are aware of the
issue.

Regards,

  --dkg

references:

 http://mumble.net/~campbell/blag.txt (see 2013-10-08)
 http://www.openwall.com/lists/oss-security/2013/10/10/2


pgpeTZ94z3BIt.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 1/3] cli: add insert --must-index option

2013-10-10 Thread Tomi Ollila
On Thu, Oct 10 2013, David Bremner  wrote:

> Peter Wang  writes:
>
>> On Tue, 10 Sep 2013 09:06:00 +0100, Mark Walters > gmail.com> wrote:
>>> 
>>> Alternatively maybe add notmuch_database_destroy_with_flush or something
>>> which does give a return value. notmuch_database_close is only called 3
>>> times and notmuch_database_destroy lots of times so changing close is
>>> much less intrusive than changing destroy. But I don't know whether we
>>> would break any  bindings or external programs etc.
>>> 
>>> What do you think?
>>
>> I think notmuch_database_close and notmuch_database_destroy should
>> return the status, and we update the three language bindings
>> and bump the soname.
>>
>
> I'm not opposed to doing an SONAME bump for 0.17. Are there other ABI
> breaking changes that we have been holding back on? Can these maybe go
> through at the same time?

Maybe something along these lines...

(Quick draft for the API part; to start discussion before working too much
for something that is going to be dropped...)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index 9dab555..ae52dab 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -106,6 +106,17 @@ typedef enum _notmuch_status {
 NOTMUCH_STATUS_LAST_STATUS
 } notmuch_status_t;

+/* Structure to provide logging interface to the notmuch library
+ *
+ * ...
+ */
+
+typedef struct _notmuch_loghook {
+void (*func)(struct _notmuch_loghook *, int level, int status,
+const char * format, ...);
+} notmuch_loghook_t;
+
+
 /* Get a string representation of a notmuch_status_t value.
  *
  * The result is read-only.
@@ -159,7 +170,9 @@ typedef struct _notmuch_filenames notmuch_filenames_t;
  * NOTMUCH_STATUS_XAPIAN_EXCEPTION: A Xapian exception occurred.
  */
 notmuch_status_t
-notmuch_database_create (const char *path, notmuch_database_t **database);
+notmuch_database_create (const char *path,
+notmuch_loghook_t *loghook,
+notmuch_database_t **database);

 typedef enum {
 NOTMUCH_DATABASE_MODE_READ_ONLY = 0,
@@ -200,6 +213,7 @@ typedef enum {
 notmuch_status_t
 notmuch_database_open (const char *path,
   notmuch_database_mode_t mode,
+  notmuch_loghook_t *loghook,
   notmuch_database_t **database);

 /* Close the given notmuch database.

>
> d

Tomi



[PATCH 0/2] emacs: show: use interactive instead of current-prefix-arg

2013-10-10 Thread Tomi Ollila
On Wed, Oct 09 2013, Mark Walters  wrote:

> This is a tidied up version of the patch at
> id:1380729013-3942-1-git-send-email-markwalters1009 at gmail.com
> (incorporating suggestions from Tomi in
> id:m2siwjhapc.fsf at guru.guru-group.fi)
>
> This helps fix a problem in pick but there was reasonable agreement on
> irc that show should not be looking at current-prefix-arg directly.
>
> One test needs to be changed to the new behaviour.

LGTM. Having elide-toggle &optional looks like a very good idea!

Tomi

>
> Best wishes
>
> Mark
>
>
> Mark Walters (2):
>   emacs: show: use interactive instead of current-prefix-arg
>   test: emacs-show: fix use of prefix-arg
>
>  emacs/notmuch-show.el |   12 +++-
>  emacs/notmuch.el  |5 +++--
>  test/emacs-show   |3 +--
>  3 files changed, 11 insertions(+), 9 deletions(-)
>
> -- 
> 1.7.9.1
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 1/3] cli: add insert --must-index option

2013-10-10 Thread David Bremner
Tomi Ollila  writes:
>> I'm not opposed to doing an SONAME bump for 0.17. Are there other ABI
>> breaking changes that we have been holding back on? Can these maybe go
>> through at the same time?
>
> Maybe something along these lines...
>
> (Quick draft for the API part; to start discussion before working too much
> for something that is going to be dropped...)
>
>  notmuch_status_t
> -notmuch_database_create (const char *path, notmuch_database_t **database);
> +notmuch_database_create (const char *path,
> +  notmuch_loghook_t *loghook,
> +  notmuch_database_t **database);

Another idea floated (by Austin?) was to pass in an options struct, to
allow future options to be added without changing the function
signature. I guess with some care this could be done in an upwardly
compatible way.

d


Re: [PATCH 1/3] database: Add notmuch_database_compact_close

2013-10-10 Thread Tomi Ollila
On Wed, Oct 02 2013, Ben Gamari  wrote:

> This function uses Xapian's Compactor machinery to compact the notmuch
> database. The compacted database is built in a temporary directory and
> later moved into place while the original uncompacted database is
> preserved.
>
> Signed-off-by: Ben Gamari 
> ---
>  configure   |  27 --
>  lib/database.cc | 151 
> 
>  lib/notmuch.h   |  21 +++-
>  3 files changed, 195 insertions(+), 4 deletions(-)
>
> diff --git a/configure b/configure
> index 6166917..1a8e939 100755
> --- a/configure
> +++ b/configure
> @@ -277,7 +277,8 @@ printf "Checking for Xapian development files... "
>  have_xapian=0
>  for xapian_config in ${XAPIAN_CONFIG}; do
>  if ${xapian_config} --version > /dev/null 2>&1; then
> - printf "Yes (%s).\n" $(${xapian_config} --version | sed -e 's/.* //')
> + xapian_version=$(${xapian_config} --version | sed -e 's/.* //')
> + printf "Yes (%s).\n" ${xapian_version}
>   have_xapian=1
>   xapian_cxxflags=$(${xapian_config} --cxxflags)
>   xapian_ldflags=$(${xapian_config} --libs)
> @@ -289,6 +290,21 @@ if [ ${have_xapian} = "0" ]; then
>  errors=$((errors + 1))
>  fi
>  
> +# Compaction is only supported on Xapian > 1.2.6
> +have_xapian_compact=0
> +if [ ${have_xapian} = "1" ]; then
> +printf "Checking for Xapian compaction support... "
> +case "${xapian_version}" in
> +0.*|1.[01].*|1.2.[0-5])
> +printf "No (only available with Xapian > 1.2.6).\n" ;;
> +[1-9]*.[0-9]*.[0-9]*)
> +have_xapian_compact=1
> +printf "Yes.\n" ;;
> +*)
> +printf "Unknown version.\n" ;;
> +esac
> +fi
> +
>  printf "Checking for GMime development files... "
>  have_gmime=0
>  IFS=';'
> @@ -729,6 +745,9 @@ HAVE_STRCASESTR = ${have_strcasestr}
>  # build its own version)
>  HAVE_STRSEP = ${have_strsep}
>  
> +# Whether the Xapian version in use supports compaction
> +HAVE_XAPIAN_COMPACT = ${have_xapian_compact}
> +
>  # Whether the getpwuid_r function is standards-compliant
>  # (if not, then notmuch will #define _POSIX_PTHREAD_SEMANTICS
>  # to enable the standards-compliant version -- needed for Solaris)
> @@ -787,13 +806,15 @@ CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) 
> \$(GMIME_CFLAGS)  \\
>  -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR) \\
>  -DHAVE_STRSEP=\$(HAVE_STRSEP) \\
>  -DSTD_GETPWUID=\$(STD_GETPWUID)   \\
> --DSTD_ASCTIME=\$(STD_ASCTIME)
> +-DSTD_ASCTIME=\$(STD_ASCTIME) \\
> +-DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)
>  CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)\\
>\$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\
>\$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS) \\
>-DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)   \\
>-DHAVE_STRSEP=\$(HAVE_STRSEP)   \\
>-DSTD_GETPWUID=\$(STD_GETPWUID) \\
> -  -DSTD_ASCTIME=\$(STD_ASCTIME)
> +  -DSTD_ASCTIME=\$(STD_ASCTIME)   \\
> +  -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)
>  CONFIGURE_LDFLAGS =  \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS)
>  EOF
> diff --git a/lib/database.cc b/lib/database.cc
> index bb4f180..06f1c0a 100644
> --- a/lib/database.cc
> +++ b/lib/database.cc
> @@ -24,7 +24,9 @@
>  #include 
>  
>  #include 
> +#include 
>  #include 
> +#include 
>  
>  #include  /* g_free, GPtrArray, GHashTable */
>  #include  /* g_type_init */
> @@ -268,6 +270,8 @@ notmuch_status_to_string (notmuch_status_t status)
>   return "Unbalanced number of calls to notmuch_message_freeze/thaw";
>  case NOTMUCH_STATUS_UNBALANCED_ATOMIC:
>   return "Unbalanced number of calls to 
> notmuch_database_begin_atomic/end_atomic";
> +case NOTMUCH_STATUS_UNSUPPORTED_OPERATION:
> + return "Unsupported operation";
>  default:
>  case NOTMUCH_STATUS_LAST_STATUS:
>   return "Unknown error status value";
> @@ -800,6 +804,153 @@ notmuch_database_close (notmuch_database_t *notmuch)
>  notmuch->date_range_processor = NULL;
>  }
>  
> +#if HAVE_XAPIAN_COMPACT
> +static int unlink_cb (const char *path,
> +   unused (const struct stat *sb),
> +   unused (int type),
> +   unused (struct FTW *ftw))
> +{
> +return remove(path);
> +}
> +
> +static int rmtree (const char *path)
> +{
> +return nftw(path, unlink_cb, 64, FTW_DEPTH | FTW_PHYS);
> +}
> +
> +class NotmuchCompactor : public Xapian::Compactor
> +{
> +notmuch_compact_status_cb_t status_cb;
> +
> +public:
> +NotmuchCompactor(notmuch_compact_status_cb_t cb) : status_cb(cb) { }
> +
> +virt

[PATCH 0/3] General fixes

2013-10-10 Thread David Bremner
Felipe Contreras  writes:

> Felipe Contreras (3):
>   query: bind queries to database objects
>   ruby: allow build with RUNPATH
>   ruby: bind database close()/destroy() properly

Hi Felipe;

I agree with the discussion on IRC that the change in the first patch
makes sense.

It would be nice to have a bit more explanation in the commit message of
the second message; at least to point out that (iiuc) this is not a
really a ruby specific thing, just a standard ld.so feature.

d



[PATCH] notmuch compact support (v4)

2013-10-10 Thread Ben Gamari
David Bremner  writes:

> Ben Gamari  writes:
>
>> Here is yet another iteration of my "notmuch compact" patchset. It has been
>> rebased on top of master and the interface reworked as suggested by Jani.
>>
>
> Sorry, first version of this reply didn't go to the list.
>
> I haven't had time to do a review, but I did try them out, and they
> seemed not to eat my database.
>
> What about a test for the test suite? 
>
I'll implement something along these lines and send a patch shortly.

Cheers,

- Ben
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20131010/fd0fcea2/attachment-0001.pgp>


[PATCH 7/6] emacs: Improved `notmuch-describe-keymap' documentation

2013-10-10 Thread David Bremner
Austin Clements  writes:

> +Each string gives a human-readable description of the key and a
> +one-line description of the bound function.  See `notmuch-help'
> +for an overview of how this documentation is extracted.
> +
> +UA-KEYS should be a key sequence bound to `universal-argument'.
> +It will be used to describe bindings of commands that support a
> +prefix argument.  PREFIX and TAIL are used internally."

pushed, 

d


[PATCH 1/3] cli: add insert --must-index option

2013-10-10 Thread David Bremner
Peter Wang  writes:

> On Tue, 10 Sep 2013 09:06:00 +0100, Mark Walters  gmail.com> wrote:
>> 
>> Alternatively maybe add notmuch_database_destroy_with_flush or something
>> which does give a return value. notmuch_database_close is only called 3
>> times and notmuch_database_destroy lots of times so changing close is
>> much less intrusive than changing destroy. But I don't know whether we
>> would break any  bindings or external programs etc.
>> 
>> What do you think?
>
> I think notmuch_database_close and notmuch_database_destroy should
> return the status, and we update the three language bindings
> and bump the soname.
>

I'm not opposed to doing an SONAME bump for 0.17. Are there other ABI
breaking changes that we have been holding back on? Can these maybe go
through at the same time?

d


[PATCH] notmuch compact support (v4)

2013-10-10 Thread David Bremner
Ben Gamari  writes:

> Here is yet another iteration of my "notmuch compact" patchset. It has been
> rebased on top of master and the interface reworked as suggested by Jani.
>

Sorry, first version of this reply didn't go to the list.

I haven't had time to do a review, but I did try them out, and they
seemed not to eat my database.

What about a test for the test suite? 

 d


Re: [PATCH 1/3] cli: add insert --must-index option

2013-10-10 Thread David Bremner
Tomi Ollila  writes:
>> I'm not opposed to doing an SONAME bump for 0.17. Are there other ABI
>> breaking changes that we have been holding back on? Can these maybe go
>> through at the same time?
>
> Maybe something along these lines...
>
> (Quick draft for the API part; to start discussion before working too much
> for something that is going to be dropped...)
>
>  notmuch_status_t
> -notmuch_database_create (const char *path, notmuch_database_t **database);
> +notmuch_database_create (const char *path,
> +  notmuch_loghook_t *loghook,
> +  notmuch_database_t **database);

Another idea floated (by Austin?) was to pass in an options struct, to
allow future options to be added without changing the function
signature. I guess with some care this could be done in an upwardly
compatible way.

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


Re: [PATCH 1/3] cli: add insert --must-index option

2013-10-10 Thread Tomi Ollila
On Thu, Oct 10 2013, David Bremner  wrote:

> Peter Wang  writes:
>
>> On Tue, 10 Sep 2013 09:06:00 +0100, Mark Walters  
>> wrote:
>>> 
>>> Alternatively maybe add notmuch_database_destroy_with_flush or something
>>> which does give a return value. notmuch_database_close is only called 3
>>> times and notmuch_database_destroy lots of times so changing close is
>>> much less intrusive than changing destroy. But I don't know whether we
>>> would break any  bindings or external programs etc.
>>> 
>>> What do you think?
>>
>> I think notmuch_database_close and notmuch_database_destroy should
>> return the status, and we update the three language bindings
>> and bump the soname.
>>
>
> I'm not opposed to doing an SONAME bump for 0.17. Are there other ABI
> breaking changes that we have been holding back on? Can these maybe go
> through at the same time?

Maybe something along these lines...

(Quick draft for the API part; to start discussion before working too much
for something that is going to be dropped...)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index 9dab555..ae52dab 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -106,6 +106,17 @@ typedef enum _notmuch_status {
 NOTMUCH_STATUS_LAST_STATUS
 } notmuch_status_t;
 
+/* Structure to provide logging interface to the notmuch library
+ *
+ * ...
+ */
+
+typedef struct _notmuch_loghook {
+void (*func)(struct _notmuch_loghook *, int level, int status,
+const char * format, ...);
+} notmuch_loghook_t;
+
+
 /* Get a string representation of a notmuch_status_t value.
  *
  * The result is read-only.
@@ -159,7 +170,9 @@ typedef struct _notmuch_filenames notmuch_filenames_t;
  * NOTMUCH_STATUS_XAPIAN_EXCEPTION: A Xapian exception occurred.
  */
 notmuch_status_t
-notmuch_database_create (const char *path, notmuch_database_t **database);
+notmuch_database_create (const char *path,
+notmuch_loghook_t *loghook,
+notmuch_database_t **database);
 
 typedef enum {
 NOTMUCH_DATABASE_MODE_READ_ONLY = 0,
@@ -200,6 +213,7 @@ typedef enum {
 notmuch_status_t
 notmuch_database_open (const char *path,
   notmuch_database_mode_t mode,
+  notmuch_loghook_t *loghook,
   notmuch_database_t **database);
 
 /* Close the given notmuch database.

>
> d

Tomi

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


Re: [PATCH] notmuch compact support (v4)

2013-10-10 Thread Ben Gamari
David Bremner  writes:

> Ben Gamari  writes:
>
>> Here is yet another iteration of my "notmuch compact" patchset. It has been
>> rebased on top of master and the interface reworked as suggested by Jani.
>>
>
> Sorry, first version of this reply didn't go to the list.
>
> I haven't had time to do a review, but I did try them out, and they
> seemed not to eat my database.
>
> What about a test for the test suite? 
>
I'll implement something along these lines and send a patch shortly.

Cheers,

- Ben


pgp2OBEWreqE1.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 0/3] General fixes

2013-10-10 Thread David Bremner
Felipe Contreras  writes:

> Felipe Contreras (3):
>   query: bind queries to database objects
>   ruby: allow build with RUNPATH
>   ruby: bind database close()/destroy() properly

Hi Felipe;

I agree with the discussion on IRC that the change in the first patch
makes sense.

It would be nice to have a bit more explanation in the commit message of
the second message; at least to point out that (iiuc) this is not a
really a ruby specific thing, just a standard ld.so feature.

d

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


Re: [PATCH 7/6] emacs: Improved `notmuch-describe-keymap' documentation

2013-10-10 Thread David Bremner
Austin Clements  writes:

> +Each string gives a human-readable description of the key and a
> +one-line description of the bound function.  See `notmuch-help'
> +for an overview of how this documentation is extracted.
> +
> +UA-KEYS should be a key sequence bound to `universal-argument'.
> +It will be used to describe bindings of commands that support a
> +prefix argument.  PREFIX and TAIL are used internally."

pushed, 

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


Re: [PATCH 1/3] cli: add insert --must-index option

2013-10-10 Thread David Bremner
Peter Wang  writes:

> On Tue, 10 Sep 2013 09:06:00 +0100, Mark Walters  
> wrote:
>> 
>> Alternatively maybe add notmuch_database_destroy_with_flush or something
>> which does give a return value. notmuch_database_close is only called 3
>> times and notmuch_database_destroy lots of times so changing close is
>> much less intrusive than changing destroy. But I don't know whether we
>> would break any  bindings or external programs etc.
>> 
>> What do you think?
>
> I think notmuch_database_close and notmuch_database_destroy should
> return the status, and we update the three language bindings
> and bump the soname.
>

I'm not opposed to doing an SONAME bump for 0.17. Are there other ABI
breaking changes that we have been holding back on? Can these maybe go
through at the same time?

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


Re: [PATCH] notmuch compact support (v4)

2013-10-10 Thread David Bremner
Ben Gamari  writes:

> Here is yet another iteration of my "notmuch compact" patchset. It has been
> rebased on top of master and the interface reworked as suggested by Jani.
>

Sorry, first version of this reply didn't go to the list.

I haven't had time to do a review, but I did try them out, and they
seemed not to eat my database.

What about a test for the test suite? 

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


Re: [PATCH 0/2] emacs: show: use interactive instead of current-prefix-arg

2013-10-10 Thread Tomi Ollila
On Wed, Oct 09 2013, Mark Walters  wrote:

> This is a tidied up version of the patch at
> id:1380729013-3942-1-git-send-email-markwalters1...@gmail.com
> (incorporating suggestions from Tomi in
> id:m2siwjhapc@guru.guru-group.fi)
>
> This helps fix a problem in pick but there was reasonable agreement on
> irc that show should not be looking at current-prefix-arg directly.
>
> One test needs to be changed to the new behaviour.

LGTM. Having elide-toggle &optional looks like a very good idea!

Tomi

>
> Best wishes
>
> Mark
>
>
> Mark Walters (2):
>   emacs: show: use interactive instead of current-prefix-arg
>   test: emacs-show: fix use of prefix-arg
>
>  emacs/notmuch-show.el |   12 +++-
>  emacs/notmuch.el  |5 +++--
>  test/emacs-show   |3 +--
>  3 files changed, 11 insertions(+), 9 deletions(-)
>
> -- 
> 1.7.9.1
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch