Commit Graph

1369 Commits

Author SHA1 Message Date
d24347bad6 lib: rename support-ngrams => ngrams-enabled
For consistency.
2026-08-20 15:05:30 -07:00
a347d3ada0 properties: support system-properties
Support "system" properties, i.e., library versions, whether
language-detection, scm is supported.

Make these more generic (with display strings), so we can handle them
more automatic int mu-cmd-info.
2026-08-20 15:05:30 -07:00
f3361b9cee server: small tweaks
Handle a few small issues / typos, make the code a little clearer and
add some comments. Remove some dead code.
2026-08-20 15:05:30 -07:00
da2995a768 mu-sexp: improve corner-cases, performance
Some C++20 updates; use the new ascii/ctype functions. Avoid unlimited
recursion. Speed-up conversion to_string

Update unit-tests.
2026-08-20 15:05:30 -07:00
dfdd943817 utils: html-to-text: fix some issues, update tests
Improve handling of some corner-cases, and add more unit-tests for
things that were broken before.
2026-08-20 15:05:30 -07:00
500bf400c3 mu-query-parser: handle corner case / complexity
Some improvements:

- Fix or/xor chains (use left-associativity).
- Fix quote handling
- Make parsing O(n) rather than quadratic; limit recursion depth

And update tests.
2026-08-20 15:05:30 -07:00
809b9e4f4a utils: read_from_stdin: avoid reading nuls
We should read the actual written size, not the allocated size.
2026-08-20 15:05:30 -07:00
7d60d2728a index: generalize pre-fetch paths
We already pre-fetched db file paths for the cleanup-case (since
cdb619e4f), now let's generalize this to all indexing.

For now this is mostly performance-neutral (lazy-rescan is slightly
faster); however, this simplifies the code.
2026-08-20 15:05:30 -07:00
86464cd083 modernization: tweaks for c++20
Update various places for what we can do with C++20:

- ends_with / starts_with
- std::to_array
- using instead of typedef
- designated initializers
- "[[maybe_unused]]" instead of G_GNUC_UNUSED

Also remove some unnecessary 'static'
2026-08-20 15:05:30 -07:00
502c9cd67b lib: use ascii ctype utils
Use the new ascii ctype utils.
2026-08-20 15:05:30 -07:00
f2960a197e utils: add ascii ctype helpers
Add some constexpr ctype helpers that avoid any possible UB (i.e.,
handling casting to unsigned), and explicitly avoid any
locale-specifics.
2026-08-20 15:05:30 -07:00
b0d5dc545e bench: update benchmark runner
Modernize code a bit; and use a temporary dir for the working set.
Typically, this makes the tests run faster (since the temporary dir is
often in-memory), which allows focusing on the part we can most easily
influence.
2026-08-20 15:05:30 -07:00
5fd639b5f3 mu: add keywords unit-test 2026-08-20 15:05:30 -07:00
01c07d8bcc Fix mu tag parsing from Keywords header
Split tags in the Keywords field on commas instead of spaces

https://datatracker.ietf.org/doc/html/rfc5322#section-3.6.5

Fixes #2932
2026-08-20 15:05:30 -07:00
f353e2dacf message: improve attachment heuristics
Do not consider calender-invitations "attachments"; do mark as
"calendar". Do recognize application/ics as calendar messages.

Update mime-object to expose a message part's disposition.

Change the "is-attachment" heuristic to include inline parts if they
have a filename parameter in their content-disposition.

Note that this doesn't change things radically; the delta is +69 and
-202 for ~6500 attachments.
2026-08-20 15:05:29 -07:00
6715ff418a lib/utils: small cleanups
Fix some static analysis warnings
2026-08-20 15:05:29 -07:00
d8afabcc0f lib: remove unused async-queue 2026-08-20 15:05:29 -07:00
339cf0bd65 mu-utils-file: use std::filesystem::remove_all
Instead of the hacky "rm -rf"
2026-08-20 15:05:28 -07:00
3c4b50e7a2 mu-utils-file: remove some unused code 2026-08-20 15:05:28 -07:00
e6e852b7e0 lib: improve error checking 2026-08-20 15:05:28 -07:00
45b9722040 mu/lib: fix some possible quoting issues 2026-08-20 15:05:28 -07:00
5e9cdc6654 message: fix some error paths 2026-08-20 15:05:28 -07:00
dc0ad7dabe mu-store: cosmetics 2026-08-20 15:05:28 -07:00
8914004970 Work around xapian bug
https://trac.xapian.org/ticket/850
2026-08-20 15:05:28 -07:00
31835200bd New incremental cleanup strategy: 63%-88% faster
This change adds a new cleanup mode that avoids cleanup having
re-traverse the directories the index pass just looked at.
Additionally, we efficiently query the Xapian database by walking the
term list instead of doing multiple point-wise path lookups.

I'd noticed that most of my time in mu's cleanup pass consisted of
B-tree lookups in Xapian (one 8KB pread64 at a time).  The point
lookups forced Xapian to traverse from the root of the B-tree to the
leaf for every single message.  Additionally, in order to join on the
message path, we had to do *another* B-tree traversal after locating
each message term.  Now we just walk the terms in order, which is much
more efficient, as we touch each B-tree node only once.

On my system, with 1371861 total messages, the total time of mu
index (no lazy check):

--nocleanup: 3.6s
incremental cleanup: 4.2s (0.6s in cleanup)
legacy cleanup: 5.2s (1.6s in cleanup)

With the new mode, we save 1.0s of the 1.6s cleanup, so we're
~63% faster.

But the incremental cleanup works even better with lazy checking.
If I enable --lazy-check, dirty only my INBOX (360778 messages), and
run index, I get:

--nocleanup: 0.9s
incremental cleanup: 1.1s (0.2s in cleanup)
legacy cleanup: 2.5s (1.6s in cleanup)

We save 1.4s out of 1.6s for ~88% speedup.

This change also fixes a timestamp bug: we should be storing
the *start* time of the index pass in metadata, not the end time, so
that on the next index pass, we notice messages that arrived between
the two times.

All tests pass.  You can set the environment variable
MU_NO_INCREMENTAL_CLEANUP to use the legacy cleanup path instead.
2026-08-20 15:05:28 -07:00
c0253e075e mu-query-parser: update comment 2026-08-20 15:05:28 -07:00
db7bd7a900 mu-utils: replace #define with constexpr for MU_COLOR_ 2026-08-20 15:05:28 -07:00
85f4a4b80a utils: fix typo 2026-08-20 15:05:28 -07:00
ab6017d5a9 utils: rework MU_ENABLE_BITOPS using C++20 code
Instead of macros, we using C++20 concepts to define the helpers to deal with
bitops on enum-class conveniently.

x# Please enter the commit message for your changes. Lines starting
2026-08-20 15:05:28 -07:00
911ade8b73 sexp.hh: silence compiler warnings
Seems they only happen in C++20 mode, not when compiling C++23 mode. So assuming
these are false alarms (old code anyway)
2026-08-20 15:05:28 -07:00
06b4625e61 build: bump to 1.14.0-pre1, bump some required versions
Bump the required versions of some libraries / emacs slightly so we can get rid
of some special-casing and work-arounds. These are mostly based on Ubuntu 24.04
LTS, which is rather conservative; so should hopefully not inconvenience any
users.

- compiler: we now require C++20 instead of C++17
- glib & friends: 2.60 => 2.80
- xapian: 1.4 => 1.4.22
- emacs 26.3 => 28.1

Ubuntu 24.04 actually has Emacs 29.3, but that'd perhaps be too big a jump.
2026-08-20 15:05:28 -07:00
341585ad66 test-store: disable bad test
The "expected-to-fail" test actually passes when root.
2026-08-20 15:05:28 -07:00
dc5bbd9884 labels: improve logging for import
Clear up the code a bit using the new logging functions.

Don't log a failure for "plan A" as an error, it just scares user unnecessarily.
2026-08-20 15:04:27 -07:00
f66b58cd41 utils: rework logging functions
Use a general mu_log which does the formatting, and specific mu_debug, mu_info
etc., to call it.
2026-08-20 15:04:27 -07:00
410ff46881 improve invoking external commands
- don't make assumptions on where programs live (i.e., /bin/sh, /bin/rm,
/bin/mv) are not universal
- dont invoke shell when unnecessary
- improve error-handling
2026-08-20 15:04:27 -07:00
9f69055ef9 test-mu-store: bump timeout in test
Seems some systems are quite slow, so bump the time-out.

Fixes #2886.
2026-08-20 15:04:27 -07:00
804b1180fe mu-server: improve error message for temp-file
Make it clear what exactly could not be created.
2026-08-20 15:04:27 -07:00
9b3e21081e test-mu-message: use join_path for test-path
We were not doing that correctly, missing a "/" between dirname and filename.
2026-08-20 15:04:27 -07:00
5f7686a767 test-utils: fix some clang-tidy warnings 2026-08-20 15:04:27 -07:00
ad327d3acb test-utils: use remove_directory 2026-08-20 15:04:27 -07:00
d258c77661 utils/file: rework remove_directory, add test
Make remove_directory not much less ugly, but at least more robust, e.g., when
the "rm" binary is not at /bin/rm

Add unit test
2026-08-20 15:04:27 -07:00
4acf708eb9 logging: don't g_message with --quiet
When `--quiet` is passed (and not --debug), do not log with g_message at
startup.
2026-08-20 15:04:27 -07:00
976b6210fc message: ensure message text is valid utf8
Seems this is not guaranteed, so convert if needed.
2026-08-20 15:04:27 -07:00
5c6642c9b9 utils: add utf8_clean helper
To morph text into valid utf8 if it isn't already.
2026-08-20 15:04:27 -07:00
056540b8e8 utils: avoid fmt:gmtime/fmt::localtime
They've been deprecated and give build warnings with new enough libfmt.
2026-08-20 15:04:26 -07:00
652b5ccbea labels: tighten labels regexp 2026-08-20 15:04:26 -07:00
461e4f83fe store-test: add more label tests
Ensure removal affects the labels cache.
2026-08-20 15:04:26 -07:00
c547cde73e store: remove some _unlocked functions, update clear_labels
They don't add much value, let's remove.

Rework clear_labels in terms of update_labels.
2026-08-20 15:04:26 -07:00
33ab0acc8d store: update labels when removing messages
This does make removing a bit slower...
2026-08-20 15:04:26 -07:00
3a12c69b10 mu: refactor labels code
Split labels-cache and store-labels.
2026-08-20 15:04:26 -07:00