aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2017-03-29 20:58:34 -0300
committerDavid Bremner <david@tethera.net>2017-03-29 20:58:34 -0300
commite1c1d33f3726f5cadb2f92d23735dcd1102fbc88 (patch)
tree6618e2a4142ed707ae96b5a7abf1e215a6195f69
parent949a5ac4d40fae1ab28e1e310c1b3cf130782d33 (diff)
parenta30a78909a501aad3ecf4dd29fe5760ae902aab1 (diff)
Merge branch 'release'
Another regexp search fix.
-rw-r--r--NEWS31
-rw-r--r--lib/regexp-fields.cc5
-rwxr-xr-xtest/T650-regexp-query.sh18
3 files changed, 54 insertions, 0 deletions
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 <<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