Commit graph

5284 commits

Author SHA1 Message Date
David Bremner
cb84f84878 lib: handle empty string in regexp field processors
The non-field processor behaviour is is convert the corresponding
queries into a search for the unprefixed terms. This yields pretty
surprising results so I decided to generate a query that would match
the terms (i.e. none with that prefix) generated for an empty header.
2017-03-29 20:44:32 -03:00
David Bremner
bc0c051e04 test: add known broken test for null from: and subject: query
These queries currently fail with field processors enabled because the
code expects a non-empty string.
2017-03-29 20:44:09 -03:00
David Bremner
949a5ac4d4 configure: change default bash completion location to /usr/share
At least Fedora and Debian now use
/usr/share/bash-completion/completions now. Apparently
/etc/bash_completion.d will be phased out at some point in the future.
2017-03-25 12:01:22 -03:00
David Bremner
d877240f4e Merge branch 'release'
wildcard search fixes, plus release busywork
2017-03-25 11:51:03 -03:00
David Bremner
bf84665cc0 debian: start changelog for 0.24.1-1 2017-03-25 11:22:55 -03:00
David Bremner
d9ec7e3483 version: bump to 0.24.1
The release is not yet finalized, but start the busywork needed.
2017-03-25 11:20:56 -03:00
Mikhail
9b7dbed58e tests: add compatibility layer
Make test-lib-common.sh load test-lib-<$PLATFORM>.sh to create
additional shim for platform specifics.

Use test-lib-FREEBSD.sh to call GNU utilities instead of native ones.

- amended by db following Tomi's suggestions
2017-03-25 07:56:52 -03:00
David Bremner
38a56b98f9 lib: only trigger phrase processing for regexp fields when needed
The argument is that if the string passed to the field processor has
no spaces, then the added quotes won't have any benefit except for
disabling wildcards. But disabling wildcards doesn't seem very useful
in the normal Xapian query parser, since they're stripped before
generating terms anyway. It does mean that the query 'from:"foo*"' will
not be precisely equivalent to 'from:foo' as it is for the non
field-processor version.
2017-03-24 09:24:13 -03:00
David Bremner
497b83780e test: add known broken tests wildcard search in from and subject
This was broken by the addition of regexp searching. The detection of
wildcards is not currently done in the recursive call to parse_query,
because of quoting issues.
2017-03-24 09:24:13 -03:00
David Bremner
e1ddd27968 debian rename libnotmuch4 to libnotmuch5
follow the SONAME bump
2017-03-22 09:29:02 -03:00
David Bremner
a35040eec7 python: bump SOVERSION to 5
Otherwise hilarity ensues when the python bindings try to use the new
API against the old shared library.
2017-03-22 09:25:59 -03:00
David Bremner
242d5a3ed5 lib: make notmuch_query_add_tag_exclude return a status value
Since this is an ABI breaking change, but we already bumped the SONAME
for the next release
2017-03-22 08:47:13 -03:00
David Bremner
3721bd45d7 lib: replace deprecated n_q_count_threads with status returning version
This function was deprecated in notmuch 0.21.  We re-use the name for
a status returning version, and deprecate the _st name.
2017-03-22 08:35:07 -03:00
David Bremner
5ce8e0b11b lib: replace deprecated n_q_count_messages with status returning version
This function was deprecated in notmuch 0.21.  We re-use the name for
a status returning version, and deprecate the _st name. One or two
remaining uses of the (removed) non-status returning version fixed at
the same time
2017-03-22 08:35:07 -03:00
David Bremner
86cbd215eb lib: replace deprecated n_q_search_messages with status returning version
This function was deprecated in notmuch 0.21.  We re-use the name for
a status returning version, and deprecate the _st name.
2017-03-22 08:35:07 -03:00
David Bremner
1e982de508 lib: replace n_query_search_threads with status returning version
This function was deprecated in notmuch 0.21. We finally remove the
deprecated API, and rename the status returning version to the simpler
name. The status returning is kept as a deprecated alias.
2017-03-22 08:28:09 -03:00
David Bremner
fc63c15833 lib: bump SONAME to libnotmuch5
We plan a sequence of ABI breaking changes. Put the SONAME change in a
separate commit to make reordering easier.
2017-03-22 08:27:58 -03:00
David Bremner
8ef0d05ad7 debian: changelog stanza for 0.23.7-2 2017-03-19 09:39:06 -03:00
Tomi Ollila
930920d510 lib/message.cc: fix Coverity finding (use after free)
The object where pointer to `data` was received was deleted before
it was used in _notmuch_string_list_append().

Relevant Coverity messages follow:

3: extract
Assigning: data = std::__cxx11::string(message->doc.()).c_str(),
which extracts wrapped state from temporary of type std::__cxx11::string.

4: dtor_free
The internal representation of temporary of type std::__cxx11::string
is freed by its destructor.

5: use after free:
Wrapper object use after free (WRAPPER_ESCAPE)
Using internal representation of destroyed object local data.

(cherry picked from commit 06adc27668)
2017-03-19 09:36:51 -03:00
David Bremner
c39f6361d0 rename libutil.a to libnotmuch_util.a
Apparently some systems (MacOS?) have a system library called libutil
and the name conflict causes problems. Since this library is quite
notmuch specific, rename it to something less generic.
2017-03-18 21:37:43 -03:00
David Bremner
a8a2705222 Merge branch 'release'
Merge in memory fixes
2017-03-18 21:02:42 -03:00
Tomi Ollila
06adc27668 lib/message.cc: fix Coverity finding (use after free)
The object where pointer to `data` was received was deleted before
it was used in _notmuch_string_list_append().

Relevant Coverity messages follow:

3: extract
Assigning: data = std::__cxx11::string(message->doc.()).c_str(),
which extracts wrapped state from temporary of type std::__cxx11::string.

4: dtor_free
The internal representation of temporary of type std::__cxx11::string
is freed by its destructor.

5: use after free:
Wrapper object use after free (WRAPPER_ESCAPE)
Using internal representation of destroyed object local data.
2017-03-18 20:59:46 -03:00
David Bremner
eafa8c62b3 cli/show: unref crlf filter.
Mimic the handling of the other filter g_objects. This cleans up a
fair sized memory leak.
2017-03-18 20:55:15 -03:00
David Bremner
b4cedc7824 cli/show: fix usage of g_mime_content_type_to_string
It returns an "allocated string", which needs to be freed.
2017-03-18 20:55:15 -03:00
David Bremner
2ae6b8cb68 cli/show: fix some memory leaks in format_part_text
Mimic Jeff Stedfast's changes to format_headers_sprinter, clean up use
of internet_address_list_to_string and
g_mime_message_get_date_as_string.
2017-03-18 20:55:15 -03:00
Jeffrey Stedfast
195361c8cd fix memory leaks in notmuch-show.c:format_headers_sprinter()
Internet_address_list_to_string() and
g_mime_message_get_date_as_string() return allocated string buffers
and not const, so from what I can tell from taking a look at the
sprinter-sexp.c’s sexp_string() function, the code leaks the
recipients_string as well as the date string.
2017-03-18 20:55:15 -03:00
David Bremner
2571d535a3 perf-test/mem: add simple memory tests for notmuch search
Just copy and replace from the show tests. Currently these show no
major leaks.
2017-03-18 20:43:19 -03:00
David Bremner
b5d08ebdb9 perf-test: add simple memory tests for notmuch-show
These are probably too slow to run with the full corpus
2017-03-18 13:40:25 -03:00
David Bremner
0c8ce66ef4 perf-test: use 'eval' in memory_run
This allows the use of redirection in the tests
2017-03-18 13:34:32 -03:00
Tomi Ollila
9c3a27dee9 test-databases: use wget or curl to download test databases
Often Linux systems are shipped with wget(1) by default (and no curl).

Many BSDs, macOS, and e.g. some Linux minimal/container images
comes with curl(1) (and no wget).

Attempting to download with curl if wget is not available increases
the likelihood for this to succeed.
2017-03-15 22:06:12 -03:00
David Bremner
62822a4e2d lib: clamp return value of g_mime_utils_header_decode_date to >=0
For reasons not completely understood at this time, gmime (as of
2.6.22) is returning a date before 1900 on bad date input. Since this
confuses some other software, we clamp such dates to 0,
i.e. 1970-01-01.
2017-03-15 21:58:25 -03:00
David Bremner
8e7812d824 lib: add known broken test for parsing bad dates.
This reproduces the symptoms of bug report
id:20150422065630.6330.90536@hoothoot
2017-03-15 21:52:34 -03:00
John Byrnes
f0d06c8ca3 emacs: use epg-gpg-program
Adjusted notmuch-crypto gpg call-process function to respect
the GPG program set by the EasyPG epg-gpg-program variable.

This is to correct a problem observed on NixOS where only gpg2 is
installed by default. The Notmuch Emacs frontend fails when trying to
access someone's key to verify their signature when it cannot find the
GPG binary.
2017-03-13 21:12:14 -03:00
David Bremner
c0c5645538 Merge branch 'release'
final 0.24 release
2017-03-12 22:43:11 -03:00
David Bremner
e60b44ecf8 build: replace remaining uses of SHA1_FILE
oops. If only there was some editor facility that allowed replacing
all instances of a string.
2017-03-12 22:31:16 -03:00
David Bremner
4a1af272f0 debian: changelog stanza for 0.24-1 2017-03-12 22:15:05 -03:00
David Bremner
7e82eea6a5 NEWS: set release date 2017-03-12 22:10:36 -03:00
David Bremner
339dfd4241 version: bump to 0.24 2017-03-12 22:08:54 -03:00
Tomi Ollila
936c35da86 fix out of tree tests
Use $NOTMUCH_SRCDIR/ instead of $TEST_DIRECTORY/../ (in those 2 places)
where reference to source directory instead of build directory is
required.
2017-03-12 09:19:23 -03:00
Tomi Ollila
35cdebdad0 fix out of tree build
In addition to use ${srcdir} and deliver ${NOTMUCH_SRCDIR} where needed,
source from ruby bindings had to be copied to the out-of-tree target
directory -- if the source files in source directory were referenced
in build and there were also built object files there, those could have
been considered as target files (and then not found when attempting
to create bindings/ruby/notmuch.so).
2017-03-12 09:17:29 -03:00
Tomi Ollila
18914c725b configure: add ${NOTMUCH_SRCDIR} -- absolute path to notmuch source
The ${srcdir} -- usually relative path to notmuch source -- works fine
in current ./configure and all makefiles. To have simple access to
notmuch source in tests and out of tree builds holding absolute path to
the source directory is useful.
2017-03-12 09:16:54 -03:00
Jani Nikula
d56a801b67 lib/database: reduce try block scope to things that really need it
No need to maintain the pure C stuff within a try block, it's arguably
confusing. This also reduces indent for a bunch of code. No functional
changes.
2017-03-10 09:21:05 -04:00
Tomi Ollila
d6a735423b test: atomicity.py: improve exit probability on failure
Some gdb python exceptions on some os environments (e.g. macOS
Sierra, non-codesigned gdb) do not make gdb exit (but to drop down
to nonexistent command line?).
Mitigate this chance by explict SystemExit on all exceptions.
The contents of output file 'gdb.out' is unchanged.
2017-03-10 08:21:28 -04:00
Tomi Ollila
ae05839028 support make goals after initial {'', dist, data}clean goal(s)
Now make goal combinations starting with *clean goals,
ending with *clean coals, and having non-*clean goals in between
should work. What does not expected to work are
non-*clean - *clean - *non-clean goal combinations.

Also, if first goals are *clean goals, re-creation of Makefile.config
is inhibited when Makefile.config exists and ./configure is newer.
2017-03-10 08:04:27 -04:00
Jani Nikula
ed22cd8bf1 cli: do not initialize zero values with designated initializers
Let the language initialize defaults to zero when some values are
initialized to non-zero values. No functional changes.
2017-03-10 07:56:11 -04:00
Jani Nikula
069362ee10 cli: simplify mime node walk
The function is more straighforward to read when it's clear that the
only non-NULL return is at one place. No functional changes.
2017-03-10 07:55:15 -04:00
Jani Nikula
8481372956 cli/show: move formatter structs closer to where they're needed
The formatter structs are only needed for the formatter array
initialization. Move them closer to use. This also lets us drop some
forward declarations. No functional changes.
2017-03-10 07:53:38 -04:00
Jani Nikula
f2160ae540 cli/show: group --entire-thread option handling into one place
The --entire-thread option handling is split around, making the logic
harder to follow than necessary. Put it in one place. While at it,
make the true/false values match notmuch_bool_t values for
simplicity. No functional changes.
2017-03-10 07:52:29 -04:00
Jani Nikula
16f0507962 cli/show: rename format_sel to simply format
Now that the format pointer is a temporary variable, and named
formatter, shorten format_sel to format. No functional changes.
2017-03-10 07:48:14 -04:00
Jani Nikula
0bb3b3b8e8 cli/show: use a table for choosing the formatter
Continue detangling format pointer and format selection variables. No
functional changes.
2017-03-10 07:48:06 -04:00