Commit Graph

1294 Commits

Author SHA1 Message Date
e647ca924d server: make index log back-off a bit more concise 2025-06-30 21:50:16 +03:00
0d7ddba9fd fix typo 2025-07-01 00:48:40 +08:00
507925ca4b indexer sleep exp backoff 2025-07-01 00:34:36 +08:00
7f274fe518 mu-test: fix logging verbosity
We were logging _everything since the g_log_set_handler was only set for the
default domain, not "mu". Let's fix this.
2025-06-16 10:57:36 +03:00
eb75141d0a mu_utils: add to_string_char
Like to_string_gchar, but for malloc/free strings.
2025-06-14 13:14:03 +03:00
151917ce51 mu-maildir.cc: fix typo
Use the right #define in the dirent check. Seems we were always following the
slow path.
2025-06-10 10:04:53 +03:00
1527976729 mu-cfind/contacts-cache: refactor matching in for_each
Move some of the code in from the command-line tool to contacts-cache, for
possible re-use. Clean up a bit while doing so.
2025-06-10 10:04:53 +03:00
9496d6523d lib: improve xapianizer / xapian_term 2025-05-26 09:17:37 +03:00
668d5ffb99 contacts/contacts-cache: cleanups
refactor code a bit; move sorting to Contact

remove unneeded hashing in Contact (just use the email address)
2025-05-26 09:17:37 +03:00
cc1112d342 tests: skip some slow tests when valgrinding 2025-05-24 21:04:49 +03:00
e367f5b0d1 mu-scanner: improve ignore_dentry check 2025-05-24 19:18:52 +03:00
452969355c mu-test: add valgrind check
Make it a bit easier to skip some tests when running under valgrind.
2025-05-24 19:18:10 +03:00
ec3b55f2ab message: retain non-file flags when moving
The content-flags won't change, and the unread-flag can be re-calculated.

Add a unit test, and some small doc improvements.

Fixes #2831.
2025-05-24 17:17:00 +03:00
f75e1203d4 mu: rename --my-address into --personal-address
This makes things a bit more uniform with all the places where we use
"personal".

--my-address remains as an alias for the command-line option.

Add unit test.

Resolves #2806.
2025-05-24 17:17:00 +03:00
a7778fc333 test-store: don't break on slow systems
The 'circular-symlink' test.
2025-04-13 20:34:44 +03:00
a2a1838da4 mu-server: cleanup find prop handling
Rework the overly long find-handler.

Improve parsing of options, and return better return properties (for use
in mu4e).
2025-04-12 15:07:28 +07:00
17b85e8390 test-circular-symlink: loosen test a bit
Work-around some weirdness. No energy to do a root-cause analysis ;)

Fixes #2832.
2025-04-12 00:56:43 +07:00
507ea8e18e mu-sexp: don't require > c++17 2025-03-23 20:22:56 +02:00
44ba631a34 mu-find: implement format=json2
Implement a new experimental json2 format for mu-find, which gets rid of
the ":" prefixes for fields, i.e., "subject" instead of ":subject".
Document it as well.
2025-03-23 19:47:09 +02:00
4cda859eb8 mu-sexp: tighten definition of plistp
In a plist, we also require the first of each two element pairs to start
with ':'

Fixes #2830.
2025-03-23 19:47:09 +02:00
c91e4ef515 mu-sexp: fix c++23 warning for suffix operator
Space between operator"" and _xxx is deprecated.
2025-03-23 19:47:09 +02:00
18092c7ff9 indexer: minor tweaking 2025-02-23 11:39:21 +02:00
cdb619e4f5 Improve performance of index cleanup: use readdir(3), not access(2)
This change makes index cleanup ~4x faster by changing how we
determine whether a file mentioned by the database still exists on
disk.  Previously, we'd call access(2) for each file the database
mentioned.  Doing so produced a lot of system call overhead.  Now, we
read the directory entries of the directories containing the files
whose existence we're checking, build a hash table from what we find,
then do the existence check against this hash table instead of
entering the kernel.

The semantics of the cleanup check do change subtly, however.
Previously, we checked whether the mentioned file was *readable*.
Now we check merely that it exists.  Extant but unreadable files in
maildirs should be rare.

BEFORE:

$ time mu index --lazy-check
lazily indexing maildir /home/dancol/Mail -> store /home/dancol/.cache/mu/xapian
/ indexing messages; checked: 0; updated/new: 0; cleaned-up: 0

real    0m19.310s
user    0m1.803s
sys     0m12.999s

AFTER:

$ time mu --debug index --lazy-check
lazily indexing maildir /home/dancol/Mail -> store /home/dancol/.cache/mu/xapian
- indexing messages; checked: 0; updated/new: 0; cleaned-up: 0

real    0m4.584s
user    0m2.433s
sys     0m2.133s
2025-02-23 11:39:17 +02:00
7baf1bf5e5 mu: remove empty refs + unit-test
Some message can have an _empty_ message-id, e.g. with:
  In-Reply-To: <>
which we weren't filter out.

This would yield and _empty_ Thread-Id, in mu-message.cc

And this would make mu-query believe it had no matches in the first
query, in Query::Private::run_related, and effectively throw away the
results. (Xapian using empty string both for a "not found" result, and
"found an empty string doesn't help either).

So, avoid having an empty reference. Also add a unit-test.

Fixes #2812.
2025-02-13 22:48:03 +02:00
8372be17dd mu-server: more info for mu4e-analyze-last-query
Include the search parameters besides the query.
2025-02-07 23:43:37 +02:00
aad5fc7df5 mu-server: minor cleanups 2025-02-05 21:07:14 +02:00
c0887603c5 guile: avoid body duplication
In message, don't re-fill when unneeded. Add tests.

Fixes #2802.
2025-02-05 21:16:15 +02:00
09965b2d09 test: add unit-tests for related/new/skip-dups
Test the interaction between related/new/skipped-duplicates. Seems to
work as expected.
2025-02-02 11:38:32 +02:00
e2cd37eaf5 mu-info: add example for ref:, thread: 2025-01-13 22:11:58 +02:00
f54e0c0476 mu-query-parser: cosmetic 2025-01-08 22:12:47 +02:00
5f8e0b71f0 server: make parsed queries available to mu4e
Basically, make the "mu find .... --analyze" information available in
mu4e, through a function mu4e-server-last-query.

This is shows the query as the server saw it, as well as the parse
s-expressions. This can be useful to see how some query is interpreted.
2025-01-08 22:12:47 +02:00
dee7e5951c utils-file: add unit-test for expand_file 2024-12-09 19:41:58 +02:00
0e0d4a0cb6 mu-sexp: add -unix output for json tstamps
The json output (for mu-find etc.) just showed the converted sexp
output, including the clumsy emacs-style tstamps (for changed/date).

Add unix timestamps as well, which are easier to work with outside
emacs.

This handles #2770.
2024-12-07 12:14:55 +02:00
646ad2e840 lib/utils: include fmt/xchar.h
Needed for 'join'
2024-12-06 20:14:11 +02:00
8fefc52eee query: add related: combi-field + test
Add a new combination (pseudo) field "related:", which combines
"message-id" and "references"
2024-12-02 11:43:14 +02:00
ed4d0f5e9d tests: add tests for ref: searching 2024-12-01 23:27:32 +02:00
8c7db59972 fields: make combi-fields introspectable
And add the display of combination-fields to 'mu info fields'.
2024-11-30 22:58:15 +02:00
c872efae34 search: make references searchable
Allow searching for message that have the given message-id in
References: or Reply-To:
2024-11-26 11:21:38 +02:00
831deb2364 lib/store-worker: remove
We're not using it.
2024-11-26 11:21:38 +02:00
d5d57b4327 remove non-single-threaded option
Single-threaded is the build-default, and seems to work well enough for
1.12.7, so remove the option to turn it off.

This is because build-options that influence such low-level/core
behavior are a pain to maintain.
2024-11-26 10:27:52 +02:00
b0d8d42dd2 indexer: make lazy check even lazier
In lazy-mode, we were skipping directories that did not change; however,
this didn't help for the case were users received new messages in big
maildirs.

So, add another check where we compare the ctime of message files with
the time of the last indexing operation. If it's smaller, ignore the
message-file. This is faster than having to consult the Xapian database
for each message.

Note that this requires in mu4e:
      (setq mu4e-index-lazy-check t)
or
   --lazy-check
as a parameter for 'mu index'.
2024-11-10 13:47:54 +02:00
fa59040ebc message: treat pcks7::smt::Unknown as encrypted
GMime isn't more specific, so let's assume it's encrypted; better than
nothing.

Fixes #2784.
2024-11-10 11:07:15 +02:00
d2343c6d62 mu-server: try avoiding xapian multi-threaded access
Try to avoid multi-threaded operations with Xapian.

This remove the thread workers during indexing, and avoids the indexing
background thread. So, mu4e has to wait once again during indexing.

We can improve upon that, but first we need to know if it avoids the
problem of issue #2756.
2024-10-08 11:23:04 +03:00
29dc1cea0c Fix typos. 2024-09-22 17:27:18 +00:00
e9ca3ad9f6 scanner: ignore emacs auto-saves
It's better to _not_ have auto-saves for your draft directory, but if
you do, ignore them at least in mu.

It may still trip up mbsync and friends, but not much we can do about
that.

Clean up the implementation a bit as well.
2024-09-03 23:02:35 +03:00
075394b35f lib: use time_t_max for empty datetime
In Mu::parse_date_time, when provided with an empty string, return
time_t_max instead of G_MAXINT64. For systems with a 64-bit time_t, there
is no difference. With a 32-bit time_t it caused a test to fail:

    not ok /utils/date-basic - ERROR:../mu-1.12.4/lib/utils/tests/test-utils.cc:92
    void test_date_basic(): assertion failed
    (parse_date_time(std::get<0>(test), std::get<1>(test)).value_or(-1)
      == std::get<2>(test)): (18446744073709551615 == 2147483647)

This edge case probably only affected the test, as when other parts of
the application call parse_date_time (e.g. mu-server.cc and
mu-query-processor.cc), they check if the input string is empty first.
2024-08-26 14:46:54 +00:00
c28bfe04e1 message: detect top-level smime parts + test
Fixes #2745
2024-08-22 22:34:34 +03:00
687db1aed6 mu-server: cosmetic 2024-08-21 06:19:35 +03:00
407c6ed4d1 xapian-db: improve errors, fix warnings 2024-08-21 06:18:37 +03:00
d7426238bd Update mu-store-worker.hh, remove duplicate ;
Fix gcc warning:
```
mu4e                           pre-build              [26/198] Compiling C++ object lib/libmu.a.p/mu-query-parser.cc.o               34.390111
mu4e                           pre-build              In file included from ../lib/mu-store.hh:34,                                   34.390132
mu4e                           pre-build                               from ../lib/mu-query-parser.hh:25,                            34.390140
mu4e                           pre-build                               from ../lib/mu-query-parser.cc:20:                            34.390146
mu4e                           pre-build              ../lib/mu-store-worker.hh:162:23: warning: extra ‘;’ [-Wpedantic]              34.390152
mu4e                           pre-build                162 |         Store& store_;;                                                34.390166
mu4e                           pre-build                    |                       ^                                                34.390172
mu4e                           pre-build                    |                       -                                                34.390177
mu4e                           pre-build              [27/198] Compiling C++ object lib/libmu.a.p/mu-contacts-cache.cc.o             34.538682
```
2024-08-08 15:47:38 +08:00