Incrementally mirror lore.kernel.org (public-inbox) mailing-list archives into Maildir folders for offline reading in Mutt (or any Maildir-aware client).
Each run fetches only the messages that have arrived since the last run and merges them into the existing Maildir.
- Downloads the gzipped mboxrd archive for a date/time range, streaming it through gzip inflate and an mbox splitter in one pass.
- Converts each message to a Maildir file,
delivering to
new/with the file mtime taken from theDate:header. - Tracks how far each list has been synced and, on the next run, fetches only what is new — de-duplicating the small overlap so nothing is delivered twice.
- Initializes a brand-new list from any starting point, chunking a large back-catalog into bounded, resumable downloads.
lko-sync - config-driven incremental sync of one or more lists
lko-fetch - fetch one received-time range into a Maildir
lko-convert - convert a local mbox file into a Maildir (deliver-everything)
- A C++20 compiler, CMake ≥ 3.16
- libcurl, zlib, OpenSSL
cmake -S . -B build
cmake --build build -jRun the tests with ctest --test-dir build (unit + fetch-unit; the network
determinism test is tests/determinism.sh, run manually).
lko-sync reads a TOML file (see config.example.toml).
You own this file; the tool never rewrites it. All mutable state lives inside each
list's own Maildir (see State).
base_url = "https://lore.kernel.org"
[[list]]
name = "dpdk-dev"
maildir = "/home/you/.mail/lore/dpdk-dev"
margin = 3600 # optional, default 3600
init_chunk_days = 180 # optional, default 180
start = 2026-01-01 # required for the first run of a new listTop-level keys
| Key | Required | Default | Meaning |
|---|---|---|---|
base_url |
no | https://lore.kernel.org |
public-inbox base URL. |
Per-[[list]] keys
| Key | Required | Default | Meaning |
|---|---|---|---|
name |
yes | — | Lore list name (path segment in the URL). |
maildir |
yes | — | Target Maildir root (created if missing). |
margin |
no | 3600 |
Seconds of received-time overlap re-fetched each run. |
init_chunk_days |
no | 180 |
Window size (days) for chunking a large initial catch-up. |
start |
first run only | — | Initial watermark, used until state exists. A TOML date (midnight UTC) or an integer Unix epoch. |
lko-sync <config.toml> [list-name ...]
lko-sync --help
All three binaries accept --help (or -h) to print full usage. Sync every list
in the config, or only the named ones:
lko-sync ~/.config/lko_mail_fetcher/config.toml # all lists
lko-sync ~/.config/lko_mail_fetcher/config.toml dpdk-dev # just oneA per-list failure (network error, etc.) is reported and does not stop the other lists; the failing list's watermark is left unchanged, so it retries next time.
Add a [[list]] block with a start date and run lko-sync. If the gap between
start and now is larger than init_chunk_days, the download is split into
bounded windows and reported per chunk:
dpdk-dev: initializing 2024-03-01.. in 5 chunks of 180 days
dpdk-dev: [1/5] 2024-02-29..2024-08-27 +8102 (dup 0)
dpdk-dev: [2/5] 2024-08-26..2025-02-22 +7431 (dup 9)
dpdk-dev: [3/5] 2025-02-21..2025-08-21 +6905 (dup 4)
dpdk-dev: [4/5] 2025-08-20..2026-02-16 +7260 (dup 11)
dpdk-dev: [5/5] 2026-02-15..now +5980 (dup 2)
dpdk-dev: delivered=35678 dup=26 window=5980 last_sync=1785668925
Adjacent chunks overlap by margin, so the small dup counts are messages in
that overlap that were correctly de-duplicated rather than delivered twice.
Because each chunk commits its watermark, an interrupted initialization resumes
from the last completed chunk on the next run. (See Limitations for the
mid-chunk case.)
Each list's Maildir contains a hidden .lko-state file (in the Maildir root,
alongside cur/new/tmp), atomically written:
last_sync <unix-epoch>
<sha256 of a message from the last run>
<sha256 ...>
You normally only need lko-sync. The other two are building blocks used by the
tests (both also keep state in the target Maildir's .lko-state):
# Convert a local mbox (deliver every message; no dedup):
lko-convert path/to/archive.mbox ~/.mail/lore/scratch
gunzip -c archive.mbox.gz | lko-convert - ~/.mail/lore/scratch
# Fetch one received-time range (rt_to=0 => open-ended):
lko-fetch https://lore.kernel.org dpdk-dev 1785369600 0 ~/.mail/lore/dpdk-devThe following libraries are used by this tool:
- toml++ - config