]> git.notmuchmail.org Git - notmuch/commitdiff
Merge branch 'release'
authorDavid Bremner <david@tethera.net>
Wed, 29 Mar 2017 23:58:34 +0000 (20:58 -0300)
committerDavid Bremner <david@tethera.net>
Wed, 29 Mar 2017 23:58:34 +0000 (20:58 -0300)
Another regexp search fix.

NEWS
lib/regexp-fields.cc
test/T650-regexp-query.sh

diff --git a/NEWS b/NEWS
index 3756590e8d8bfed1455483561ee646a8e24457c7..b51012181e3c0f34e2ae40036702d2647350a48d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,27 @@
+Notmuch 0.24.1 (UNRELEASED)
+===========================
+
+General
+-------
+
+Fix regressions in non-regexp search for `from:` and `subject:`.
+
+  The regexp search code in 0.24 introduced a regression in the
+  handling of empty queries and wildcards. These are both corrected in
+  this release.
+
+Command Line Interface
+----------------------
+
+Fix several memory leaks in `notmuch show`.
+
+Update NEWS for 0.24 to mention schema changes.
+
+Library Changes
+---------------
+
+Fix a read-after-free in the library.
+
 Notmuch 0.24 (2017-03-12)
 =========================
 
@@ -18,6 +42,13 @@ Run external `notmuch-` prefixed commands as subcommands
   have notmuch run them as if they were notmuch commands. See the
   `notmuch(1)` man page for details
 
+New default output format to 3
+
+  See devel/schemata for details. Users of the structured output
+  format are reminded of the `--format-version` argument to `notmuch
+  show` and `notmuch search` which can prevent breakage when the
+  default format changes.
+
 Emacs
 -----
 
index 9dcf973263743ea01721bf139569cafa17577943..1651677cd8638b759a9f96838237a98aa2ef5af2 100644 (file)
@@ -148,6 +148,11 @@ RegexpFieldProcessor::RegexpFieldProcessor (std::string prefix, Xapian::QueryPar
 Xapian::Query
 RegexpFieldProcessor::operator() (const std::string & str)
 {
+    if (str.size () == 0)
+       return Xapian::Query(Xapian::Query::OP_AND_NOT,
+                            Xapian::Query::MatchAll,
+                            Xapian::Query (Xapian::Query::OP_WILDCARD, term_prefix));
+
     if (str.at (0) == '/') {
        if (str.at (str.size () - 1) == '/'){
            RegexpPostingSource *postings = new RegexpPostingSource (slot, str.substr(1,str.size () - 2));
index 61739e873eb214364f0f3b60748fa30279580787..9599c104d452f9d8b0f331017b500751e808138f 100755 (executable)
@@ -11,6 +11,24 @@ fi
 
 notmuch search --output=messages from:cworth > cworth.msg-ids
 
+# these headers will generate no document terms
+add_message '[from]="-" [subject]="empty from"'
+add_message '[subject]="-"'
+
+test_begin_subtest "null from: search"
+notmuch search 'from:""' | notmuch_search_sanitize > OUTPUT
+cat <<EOF > EXPECTED
+thread:XXX   2001-01-05 [1/1] -; empty from (inbox unread)
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "null subject: search"
+notmuch search 'subject:""' | notmuch_search_sanitize > OUTPUT
+cat <<EOF > EXPECTED
+thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; - (inbox unread)
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_begin_subtest "xapian wildcard search for from:"
 notmuch search --output=messages 'from:cwo*' > OUTPUT
 test_expect_equal_file cworth.msg-ids OUTPUT