From: David Bremner Date: Wed, 29 Mar 2017 23:58:34 +0000 (-0300) Subject: Merge branch 'release' X-Git-Tag: 0.25_rc0~87 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=e1c1d33f3726f5cadb2f92d23735dcd1102fbc88;hp=949a5ac4d40fae1ab28e1e310c1b3cf130782d33 Merge branch 'release' Another regexp search fix. --- diff --git a/NEWS b/NEWS index 3756590e..b5101218 100644 --- 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 ----- diff --git a/lib/regexp-fields.cc b/lib/regexp-fields.cc index 9dcf9732..1651677c 100644 --- a/lib/regexp-fields.cc +++ b/lib/regexp-fields.cc @@ -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)); diff --git a/test/T650-regexp-query.sh b/test/T650-regexp-query.sh index 61739e87..9599c104 100755 --- a/test/T650-regexp-query.sh +++ b/test/T650-regexp-query.sh @@ -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 < 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 < 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