Merge branch 'release'

Another regexp search fix.
This commit is contained in:
David Bremner 2017-03-29 20:58:34 -03:00
commit e1c1d33f37
3 changed files with 54 additions and 0 deletions

31
NEWS
View file

@ -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) 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 have notmuch run them as if they were notmuch commands. See the
`notmuch(1)` man page for details `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 Emacs
----- -----

View file

@ -148,6 +148,11 @@ RegexpFieldProcessor::RegexpFieldProcessor (std::string prefix, Xapian::QueryPar
Xapian::Query Xapian::Query
RegexpFieldProcessor::operator() (const std::string & str) 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 (0) == '/') {
if (str.at (str.size () - 1) == '/'){ if (str.at (str.size () - 1) == '/'){
RegexpPostingSource *postings = new RegexpPostingSource (slot, str.substr(1,str.size () - 2)); RegexpPostingSource *postings = new RegexpPostingSource (slot, str.substr(1,str.size () - 2));

View file

@ -11,6 +11,24 @@ fi
notmuch search --output=messages from:cworth > cworth.msg-ids 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:" test_begin_subtest "xapian wildcard search for from:"
notmuch search --output=messages 'from:cwo*' > OUTPUT notmuch search --output=messages 'from:cwo*' > OUTPUT
test_expect_equal_file cworth.msg-ids OUTPUT test_expect_equal_file cworth.msg-ids OUTPUT