public-inbox.git
2 years agopublic-inbox v1.2.0 v1.2.0
Eric Wong [Sun, 3 Nov 2019 03:01:40 +0000 (03:01 +0000)]
public-inbox v1.2.0

2 years agobuild: add "git-dist" target for making gzipped tarballs
Eric Wong [Sun, 3 Nov 2019 02:53:39 +0000 (02:53 +0000)]
build: add "git-dist" target for making gzipped tarballs

Since MANIFEST is tied to files tracked by git, adding generated
files such as NEWS to that is more effort than its worth (esp.
when I'm wondering if MakeMaker is useful compared to only using
GNU make).

I also have trouble reading CamelCase, so lower-case names
are nicer and more consistent with previous releases
(which were all generated with "git archive"); but did not
include NEWS.

2 years agodoc: mknews: force plain-text NEWS to UTF-8
Eric Wong [Sun, 3 Nov 2019 02:02:04 +0000 (02:02 +0000)]
doc: mknews: force plain-text NEWS to UTF-8

We'll have non-7-bit ASCII in the 1.2.0 release notes.

2 years agoTODO: update item for multiple Date: headers
Eric Wong [Sun, 3 Nov 2019 01:42:03 +0000 (01:42 +0000)]
TODO: update item for multiple Date: headers

That's the only head-scratcher of the bunch remaining, since
that relies on ranges.

2 years agodoc: add public-inbox.cgi(1) manpage
Eric Wong [Sat, 2 Nov 2019 21:51:08 +0000 (21:51 +0000)]
doc: add public-inbox.cgi(1) manpage

Yet another case of documenting things which should NOT be used :>

2 years agodoc: add public-inbox-purge(1) manpage
Eric Wong [Sat, 2 Nov 2019 21:34:59 +0000 (21:34 +0000)]
doc: add public-inbox-purge(1) manpage

Tools intended for end users need manpages, and doubly so
to convince potential users NOT to use them :)

2 years agohval: replace "'" with "'" for compatibility
Eric Wong [Thu, 31 Oct 2019 09:19:38 +0000 (09:19 +0000)]
hval: replace "'" with "'" for compatibility

While testing 216light.css changes, I managed to hit some cases
where dillo failed to render ' correctly, but I also can't
reproduce it reliably.  Anyways, it's definitely a problem with
some old browsers and newer versions of highlight already work
around it, but Debian 10.x has 3.41, so use "'" to maximize
compatibility.

2 years agocontrib/css/216light: improve contrast a bit
Eric Wong [Thu, 31 Oct 2019 09:19:37 +0000 (09:19 +0000)]
contrib/css/216light: improve contrast a bit

"#ff0" foreground on a "#fff" background is just too difficult
to distinguish, among other things.  So choose slightly darker
colors when using a (painful) "#fff" background.

2 years agoqspawn: psgi_qx: delay callback until waitpid returns
Eric Wong [Thu, 31 Oct 2019 05:36:31 +0000 (05:36 +0000)]
qspawn: psgi_qx: delay callback until waitpid returns

We need to detect "git apply" failures reliably when patches
fail.  This is necessary for solving for blob 81c1164ae5 in
https://public-inbox.org/git/ when at least two messages can
solve for it (and one of them fails):

1. https://public-inbox.org/git/b9fb52b8-8168-6bf0-9a72-1e6c44a281a5@oracle.com/
2. https://public-inbox.org/git/56664222-6c29-09dc-ef78-7b380b113c4a@oracle.com/

2 years agosolvergit: deal with false-positive dfpost: results
Eric Wong [Thu, 31 Oct 2019 03:12:20 +0000 (03:12 +0000)]
solvergit: deal with false-positive dfpost: results

When solving for blob 81c1164ae5 in https://public-inbox.org/git/,
at least two messages get indexed with the dfpost result for
that blob (after fixing MsgIter to decode all text/* parts):

1. https://public-inbox.org/git/b9fb52b8-8168-6bf0-9a72-1e6c44a281a5@oracle.com/
2. https://public-inbox.org/git/56664222-6c29-09dc-ef78-7b380b113c4a@oracle.com/

However, only the first message contains a usable patch.  So
we must adjust SolverGit to account for multiple messages
hitting the same "dfpost:" search result and attempt
"git apply" on all results, not just the first.

In the future, changes to SearchIdx.pm may rid us of invalid
search results and speed up performance (at the expense of
developer/indexing time); but we need to account for old search
indices, first.

2 years agomsgiter: attempt to decode all text/* bodies
Eric Wong [Thu, 31 Oct 2019 03:12:19 +0000 (03:12 +0000)]
msgiter: attempt to decode all text/* bodies

We want to index text/x-patch and text/x-diff, at least,
since "git format-patch" can generate a patch series as
attachments using --attach.

2 years agomsgiter: do not assume UTF-8 if Email::MIME->body_str succeeds
Eric Wong [Thu, 31 Oct 2019 00:33:04 +0000 (00:33 +0000)]
msgiter: do not assume UTF-8 if Email::MIME->body_str succeeds

ISO-2202-JP and other non-UTF-8 messages need to be displayed
correctly.

Fixes: 7d82a8bc04ce ('handle "multipart/mixed" messages which are not multipart')
2 years agosearch: add note about SCHEMA_VERSION 15
Eric Wong [Wed, 30 Oct 2019 21:19:46 +0000 (21:19 +0000)]
search: add note about SCHEMA_VERSION 15

--reindex has gotten better over the years, and having parallel
Xapian DB directories would exceed all available disk space for
some users with giant inboxes.

2 years agowwwlisting: fix spelling and clarify sub location
Eric Wong [Wed, 30 Oct 2019 20:46:25 +0000 (20:46 +0000)]
wwwlisting: fix spelling and clarify sub location

Spell "Schwartzian" correctly, and clarify the location of
"modified" since we have multiple subs named "modified"

2 years agoMerge branch 'learn'
Eric Wong [Wed, 30 Oct 2019 20:46:44 +0000 (20:46 +0000)]
Merge branch 'learn'

* learn:
  doc: add public-inbox-learn(1) manpage
  mda: support multiple List-ID matches
  mda: prepare for multiple destinations
  inboxwritable: add assert_usable_dir sub
  mda: skip MIME parsing if spam
  mda: hoist out mda_filter_adjust
  filter/base: remove MAX_MID_SIZE constant
  mda: hoist out List-ID handling and reuse in -learn
  learn: hoist out remove_or_add subroutine
  learn: GIT_COMMITTER_<NAME|EMAIL> may be "" or "0"
  learn: update usage statement
  learn: only map recipient list on "ham" or "rm"
  learn: support multiple To/Cc headers

2 years agodoc: add public-inbox-learn(1) manpage
Eric Wong [Mon, 28 Oct 2019 10:45:28 +0000 (10:45 +0000)]
doc: add public-inbox-learn(1) manpage

Tools intended for end users need manpages.

2 years agomda: support multiple List-ID matches
Eric Wong [Mon, 28 Oct 2019 10:45:26 +0000 (10:45 +0000)]
mda: support multiple List-ID matches

While it's not RFC2919-conformant, mail software can
theoretically set multiple List-ID headers.  Deliver to all
inboxes which match a given List-ID since that's likely the
intended.

Cc: Eric W. Biederman <ebiederm@xmission.com>
Link: https://public-inbox.org/meta/87pniltscf.fsf@x220.int.ebiederm.org/
2 years agomda: prepare for multiple destinations
Eric Wong [Mon, 28 Oct 2019 10:45:25 +0000 (10:45 +0000)]
mda: prepare for multiple destinations

Multiple List-ID headers will be supported in the next commit

2 years agoinboxwritable: add assert_usable_dir sub
Eric Wong [Mon, 28 Oct 2019 10:45:24 +0000 (10:45 +0000)]
inboxwritable: add assert_usable_dir sub

And use it for mda, since "0" could be a usable directory
if somebody insists on using relative paths...

2 years agomda: skip MIME parsing if spam
Eric Wong [Mon, 28 Oct 2019 10:45:23 +0000 (10:45 +0000)]
mda: skip MIME parsing if spam

We don't want to waste cycles parsing the message for MIME bits
if it's spam.

2 years agomda: hoist out mda_filter_adjust
Eric Wong [Mon, 28 Oct 2019 10:45:22 +0000 (10:45 +0000)]
mda: hoist out mda_filter_adjust

It makes it easier to document the default -mda behavior is
stricter than normal, including "public-inbox-learn ham"

2 years agofilter/base: remove MAX_MID_SIZE constant
Eric Wong [Mon, 28 Oct 2019 10:45:21 +0000 (10:45 +0000)]
filter/base: remove MAX_MID_SIZE constant

We don't need it in the filter, here, since we have
one in the MDA package.

2 years agomda: hoist out List-ID handling and reuse in -learn
Eric Wong [Mon, 28 Oct 2019 10:45:20 +0000 (10:45 +0000)]
mda: hoist out List-ID handling and reuse in -learn

It's now possible to inject false-positive ham into an inbox
the same way -mda does via List-ID.

2 years agolearn: hoist out remove_or_add subroutine
Eric Wong [Mon, 28 Oct 2019 10:45:19 +0000 (10:45 +0000)]
learn: hoist out remove_or_add subroutine

We'll be reusing it for List-ID processing in the next commit.

2 years agolearn: GIT_COMMITTER_<NAME|EMAIL> may be "" or "0"
Eric Wong [Mon, 28 Oct 2019 10:45:18 +0000 (10:45 +0000)]
learn: GIT_COMMITTER_<NAME|EMAIL> may be "" or "0"

Users may be zeroes or blanks.

2 years agolearn: update usage statement
Eric Wong [Mon, 28 Oct 2019 10:45:17 +0000 (10:45 +0000)]
learn: update usage statement

Use <foo|bar> since that seems to be the favored notation
for required command args (taking a hint from git(1) manpage).
While we're at it, remove the space after '<' for the redirect
to match git.git coding style.

2 years agolearn: only map recipient list on "ham" or "rm"
Eric Wong [Mon, 28 Oct 2019 10:45:16 +0000 (10:45 +0000)]
learn: only map recipient list on "ham" or "rm"

It's assumed that "spam" can end up anywhere due to Bcc:, so we
need to scan every single inbox.  However, "rm" is usually more
targeted and and "ham" obviously only belongs in some inboxes.

2 years agolearn: support multiple To/Cc headers
Eric Wong [Mon, 28 Oct 2019 10:45:15 +0000 (10:45 +0000)]
learn: support multiple To/Cc headers

It's possible to specify these headers multiple times, and
PublicInbox::MDA->precheck takes that into account, so
-learn should, too.

2 years agoMerge remote-tracking branch 'origin/multi-mid'
Eric Wong [Wed, 30 Oct 2019 08:47:23 +0000 (08:47 +0000)]
Merge remote-tracking branch 'origin/multi-mid'

* origin/multi-mid:
  view: show X-Alt-Message-ID in permalink view, too
  index: allow search/lookups on X-Alt-Message-ID
  linkify: support adding "(raw)" link for Message-IDs
  view: improve warning for multiple Message-IDs
  view: move '<' and '>' outside <a>
  view: display redundant headers in permalink
  search: support multiple From/To/Cc/Subject headers

2 years agoHACKING: add a note about avoiding recursion
Eric Wong [Thu, 24 Oct 2019 21:09:42 +0000 (21:09 +0000)]
HACKING: add a note about avoiding recursion

Bad things happen when user data can control our stack size.

2 years agoview: show X-Alt-Message-ID in permalink view, too
Eric Wong [Thu, 24 Oct 2019 00:12:41 +0000 (00:12 +0000)]
view: show X-Alt-Message-ID in permalink view, too

Since we index X-Alt-Message-ID (because we need to placate some
NNTP clients), we now display it as well, since that Message-ID
could be the X-Alt-Message-ID that the reader is actually
interested in.

2 years agoindex: allow search/lookups on X-Alt-Message-ID
Eric Wong [Thu, 24 Oct 2019 00:12:40 +0000 (00:12 +0000)]
index: allow search/lookups on X-Alt-Message-ID

Since we replace extra Message-ID headers with X-Alt-Message-ID
to placate NNTP clients, we should allow searching and indexing
on X-Alt-Message-ID just like we do with Message-ID.

2 years agolinkify: support adding "(raw)" link for Message-IDs
Eric Wong [Thu, 24 Oct 2019 00:12:39 +0000 (00:12 +0000)]
linkify: support adding "(raw)" link for Message-IDs

And use it for the per-message permalink display.

2 years agoview: improve warning for multiple Message-IDs
Eric Wong [Thu, 24 Oct 2019 00:12:38 +0000 (00:12 +0000)]
view: improve warning for multiple Message-IDs

"refer" is not the correct term, here; since that would mean
multiple messages have the current message in the "References:"
header, and that's a normal occurence.

Instead, we need to warn the reader that the given message
itself has multiple Message-IDs.

2 years agoview: move '<' and '>' outside <a>
Eric Wong [Thu, 24 Oct 2019 00:12:37 +0000 (00:12 +0000)]
view: move '<' and '>' outside <a>

Browsers may underline '<' and '>' in links, which may be
confused with '≤' and '≥'.  So have the Message-ID header
display follow what we do with In-Reply-To headers and move the
"&lt;" and "&gt;" outside of <a> in the HTML.

2 years agoview: display redundant headers in permalink
Eric Wong [Thu, 24 Oct 2019 00:12:36 +0000 (00:12 +0000)]
view: display redundant headers in permalink

Mail headers can contain multiple headers of any type, so ensure
we don't hide any information we're getting in the per-message
permalink views.

This means it's possible to have multiple From, Date, To, Cc,
Subject, and In-Reply-To headers displayed.

The thread indices are a special case, I guess, since we run
out of space on the line if the headers too long and tools like
mutt only show the first one.

2 years agosearch: support multiple From/To/Cc/Subject headers
Eric Wong [Thu, 24 Oct 2019 00:12:35 +0000 (00:12 +0000)]
search: support multiple From/To/Cc/Subject headers

We can easily support searching on messages with
multiple From/To/Cc/Subject headers just like we
do with multiple Message-ID headers.

This matches the normal mutt pager display behavior.

2 years agoMerge branch 'regen'
Eric Wong [Tue, 22 Oct 2019 07:45:38 +0000 (07:45 +0000)]
Merge branch 'regen'

* regen:
  v2writable: use msgmap as multi_mid queue
  v2writable: move git->cleanup to the correct place
  v2writable: reindex handles 3-headered monsters
  v2writable: improve "num_for" API and disambiguate
  v2writable: set unindexed article number

2 years agodoc: clean-doc: remove generated standards.txt
Eric Wong [Tue, 22 Oct 2019 01:31:53 +0000 (01:31 +0000)]
doc: clean-doc: remove generated standards.txt

I need to remove all the generated documentation files
before running "git-set-file-times" for rsync to our
website.

2 years agosyscall: get rid of sendfile wrappers for now
Eric Wong [Mon, 21 Oct 2019 11:22:29 +0000 (11:22 +0000)]
syscall: get rid of sendfile wrappers for now

I'm not sure they'll make a measurable difference or will
be worth the effort in the future given the prevalance
of HTTPS and giant socket buffers.

Using Inline::C for this may make more sense in the
future, too, especially if we want to be able to use
GnuTLS.

2 years agohval: remove new_oneline
Eric Wong [Mon, 21 Oct 2019 11:22:28 +0000 (11:22 +0000)]
hval: remove new_oneline

commit 476fc666c223f0fb ('reduce "PublicInbox::Hval->new_oneline" use')
was mis-titled, since it completely eliminated ->new_oneline use.

2 years agogit: remove src_blob_url
Eric Wong [Mon, 21 Oct 2019 11:22:27 +0000 (11:22 +0000)]
git: remove src_blob_url

This was intended for solver, but it's unused since
commit 915cd090798069a4
("solver: switch patch application to use a callback")

2 years agowatchmaildir: remove redundant _path_to_mime
Eric Wong [Mon, 21 Oct 2019 11:22:26 +0000 (11:22 +0000)]
watchmaildir: remove redundant _path_to_mime

InboxWritable::maildir_path_load exists and we may support
it for use with standalone scripts.

2 years agoinboxwritable: import_maildir uses maildir_path_load
Eric Wong [Mon, 21 Oct 2019 11:22:25 +0000 (11:22 +0000)]
inboxwritable: import_maildir uses maildir_path_load

I'm not sure if this will get used anywhere, but at least
call a function which exists in dead code.

2 years agowww: remove unused ctx_get sub
Eric Wong [Mon, 21 Oct 2019 11:22:24 +0000 (11:22 +0000)]
www: remove unused ctx_get sub

This hasn't been used since commit 48b21cb662c1e17b7 in 2016:
("declare Inbox object for reusability")

2 years agooveridx: remove unused delete_articles sub
Eric Wong [Mon, 21 Oct 2019 11:22:23 +0000 (11:22 +0000)]
overidx: remove unused delete_articles sub

This hasn't been used since commit 1b7e935ab1690e28
("searchidx: fix incremental index with indexlevel=basic on v1")

2 years agov2writable: use msgmap as multi_mid queue
Eric Wong [Mon, 21 Oct 2019 22:57:50 +0000 (22:57 +0000)]
v2writable: use msgmap as multi_mid queue

Instead of storing Message-IDs in the Msgmap object, we can
store the blob OID.

For initial indexing of mirrors, this lets us preserve
$sync->{regen} by storing the intended article number in
the queue.

On --reindex, the article number we store in Msgmap is ignored
but only used for ordering purposes.

This also allows us to avoid ENOMEM errors if somebody abuses
our system by reusing Message-IDs; but we now risk ENOSPC
instead (but systems tend to have more FS storage than RAM).

2 years agov2writable: move git->cleanup to the correct place
Eric Wong [Mon, 21 Oct 2019 19:19:00 +0000 (19:19 +0000)]
v2writable: move git->cleanup to the correct place

We need to stop the git process to avoid leaking FDs
to Xapian if we recurse ->index_sync on reindex.

2 years agov2writable: reindex handles 3-headered monsters
Eric Wong [Sun, 20 Oct 2019 22:05:05 +0000 (22:05 +0000)]
v2writable: reindex handles 3-headered monsters

And maybe 8-headered ones, too...

I noticed --reindex failing on the linux-renesas-soc mirror due
one 3-headed monster of a message having 3 sets of headers;
while another normal message had a Message-ID that matched one
of the 3 IDs of the 3-headed monster.

We still try to do the majority of indexing backwards, but we
defer indexing multi-Message-ID'd messages until the end to
ensure we get all the "good" messages in before we process the
multi-headered ones.

Link: https://public-inbox.org/meta/20191016211415.GA6084@dcvr/
2 years agov2writable: improve "num_for" API and disambiguate
Eric Wong [Sun, 20 Oct 2019 07:27:52 +0000 (07:27 +0000)]
v2writable: improve "num_for" API and disambiguate

Make it obvious that we're not the Msgmap sub and return an
array because it's less awkward than providing a modifiable ref
to a function to write to.

2 years agov2writable: set unindexed article number
Eric Wong [Sun, 20 Oct 2019 07:22:07 +0000 (07:22 +0000)]
v2writable: set unindexed article number

We'll actually use the keys of this hash in future commits.

2 years agodoc: update 1.2 work-in-progress release notes
Eric Wong [Mon, 21 Oct 2019 00:17:19 +0000 (00:17 +0000)]
doc: update 1.2 work-in-progress release notes

Will be updating this further after some reindex and
multi-header bugs are fixed.

2 years agoTODO: DHT (distributed hash table) for Message-IDs
Eric Wong [Sun, 20 Oct 2019 00:21:26 +0000 (00:21 +0000)]
TODO: DHT (distributed hash table) for Message-IDs

This would encourage SPOF avoidance.  It would also make it
easier to do "Certificate Transparency"-style attestation of
messages.

2 years agoexamples/grok-pull.post_update_hook: fix config detection
Eric Wong [Fri, 18 Oct 2019 07:54:25 +0000 (07:54 +0000)]
examples/grok-pull.post_update_hook: fix config detection

We need to account for both the old ("mainrepo") and new
("inboxdir") names.  But "dir" was just a search+replace
error and we don't use that outside of "coderepo.dir".

2 years agoTODO: add a few more items around coderepos
Eric Wong [Tue, 15 Oct 2019 20:18:58 +0000 (20:18 +0000)]
TODO: add a few more items around coderepos

Going where no email client/tool has gone before...

2 years agodoc: v2-format: get man output under 80 cols
Eric Wong [Tue, 15 Oct 2019 18:34:39 +0000 (18:34 +0000)]
doc: v2-format: get man output under 80 cols

We need to better ensure our manpage output is readable with a
standard terminal width.  And fix some wording while we're at
it:

* use "inbox" instead of "list" for our storage
* replace the last "$PART" reference with "$SHARD"

2 years agopublic-inbox-v2-format(5): fix formatting
Alyssa Ross [Mon, 7 Oct 2019 20:27:26 +0000 (20:27 +0000)]
public-inbox-v2-format(5): fix formatting

This was being rendered as a paragraph, so line breaks weren't
preserved and it was unreadable in man.

2 years agoMerge remote-tracking branch 'origin/inboxdir'
Eric Wong [Thu, 17 Oct 2019 08:19:11 +0000 (08:19 +0000)]
Merge remote-tracking branch 'origin/inboxdir'

* origin/inboxdir:
  config: remove redundant inboxdir check
  config: support "inboxdir" in addition to "mainrepo"
  examples/grok-pull.post_update_hook: use "inbox_dir"

2 years agodoc: enable "check-man" target via "check" in gmake
Eric Wong [Thu, 17 Oct 2019 08:10:27 +0000 (08:10 +0000)]
doc: enable "check-man" target via "check" in gmake

man(1) on FreeBSD supports pathnames as operands just
fine, so there's hope other BSDs follow suit and we
can enable this check target everywhere.

2 years agodoc: avoid [<directory>] arg for git-clone(1)
Eric Wong [Wed, 16 Oct 2019 11:14:51 +0000 (11:14 +0000)]
doc: avoid [<directory>] arg for git-clone(1)

While it is possible to host source code from the root of a URL
using git-http-backend(1), the lack of pathname in the URL can
also be confusing to users.  So just add the path name of the
project into the URL itself so users can invoke "git clone"
with one command-line argument instead of two.

Of course, previously documented URLs continue to work as normal.

2 years agodoc: update public-inbox-overview(7) for v2
Eric Wong [Wed, 16 Oct 2019 11:14:50 +0000 (11:14 +0000)]
doc: update public-inbox-overview(7) for v2

The overview was v1-specific and probably confusing/misleading
to new users since v2 is favored.

Hopefully improve wording while we're at it and avoid
overloading terms like "parts" (which could be confused with
Xapian "shards").

Using the word "directly" after "Mirroring mailing lists"
did not make sense to me, either.

2 years agodoc: check-man: use COLUMNS env for width
Eric Wong [Wed, 16 Oct 2019 11:14:49 +0000 (11:14 +0000)]
doc: check-man: use COLUMNS env for width

That's the environment documented in ncurses(3) and man(1) from
the man-db.nongnu.org distribution of man.

2 years agoconfig: remove redundant inboxdir check
Eric Wong [Wed, 16 Oct 2019 09:58:08 +0000 (09:58 +0000)]
config: remove redundant inboxdir check

This was causing compatibility problems for old configs
when using public-inbox-nntpd.

2 years agoconfig: support "inboxdir" in addition to "mainrepo"
Eric Wong [Wed, 16 Oct 2019 08:59:55 +0000 (08:59 +0000)]
config: support "inboxdir" in addition to "mainrepo"

"mainrepo" ws a bad name and artifact from the early days when I
intended for there to be a "spamrepo" (now just the
ENV{PI_EMERGENCY} Maildir).  With v2, "mainrepo" can be
especially confusing, since v2 needs at least two git
repositories (epoch + all.git) to function and we shouldn't
confuse users by having them point to a git repository for v2.

Much of our documentation already references "INBOX_DIR" for
command-line arguments, so use "inboxdir" as the
git-config(1)-friendly variant for that.

"mainrepo" remains supported indefinitely for compatibility.
Users may need to revert to old versions, or may be referring
to old documentation and must not be forced to change config
files to account for this change.

So if you're using "mainrepo" today, I do NOT recommend changing
it right away because other bugs can lurk.

Link: https://public-inbox.org/meta/874l0ice8v.fsf@alyssa.is/
2 years agoexamples/grok-pull.post_update_hook: use "inbox_dir"
Eric Wong [Wed, 16 Oct 2019 08:59:54 +0000 (08:59 +0000)]
examples/grok-pull.post_update_hook: use "inbox_dir"

Move away from using "mainrepo" since it's confusing to
new users, especially with v2.

2 years agodoc: check-man: ignore backspace char
Eric Wong [Wed, 16 Oct 2019 08:18:23 +0000 (08:18 +0000)]
doc: check-man: ignore backspace char

man(1) on FreeBSD unconditionally emits backspace characters
for the bold effect despite its output being piped to awk(1).

Also tested with the man-db.nongnu.org version provided with
Debian (and presumably most other Linux systems).

2 years agomda: support --no-precheck option
Eric Wong [Wed, 16 Oct 2019 00:39:56 +0000 (00:39 +0000)]
mda: support --no-precheck option

Since -mda now supports List-ID to better support mirroring of
existing mailing lists, it probably makes sense to support
disabling the precheck function to provide more accurate (though
potentially spammier) mirrors of lists

2 years agoMerge branch 'listid'
Eric Wong [Wed, 16 Oct 2019 00:30:28 +0000 (00:30 +0000)]
Merge branch 'listid'

* listid:
  wwwtext: show listid config directive(s)
  mda, watch: wire up List-ID header support
  config: allow "0" as a valid mainrepo path
  config: avoid unnecessary '||' use
  config: simplify lookup* methods
  config: we always have {-section_order}
  Config.pm: Add support for mailing list information

2 years agoadmin: show failing directory
Eric Wong [Mon, 7 Oct 2019 20:52:31 +0000 (20:52 +0000)]
admin: show failing directory

Since public-inbox-index may be run against a large list of
(intended) inboxes from the command-line, it's helpful to show
which directory fails the resolution.

2 years agodoc: "check-man" target to ensure we stay <=80 cols
Eric Wong [Tue, 15 Oct 2019 20:19:36 +0000 (20:19 +0000)]
doc: "check-man" target to ensure we stay <=80 cols

This should prevent future documentation changes from exceeding
the limit of standard terminals.

2 years agodoc: check-NEWS.atom fails gracefully on FreeBSD make(1)
Eric Wong [Tue, 15 Oct 2019 21:12:27 +0000 (21:12 +0000)]
doc: check-NEWS.atom fails gracefully on FreeBSD make(1)

We should also note that the package "xmlstarlet" on FreeBSD
installs a command "xml" (but not "xmlstarlet") on FreeBSD.

2 years agowwwtext: show listid config directive(s)
Eric Wong [Tue, 15 Oct 2019 06:39:07 +0000 (06:39 +0000)]
wwwtext: show listid config directive(s)

We want to share this piece for potential mirror-ers just
like watchheader.

2 years agomda, watch: wire up List-ID header support
Eric Wong [Tue, 15 Oct 2019 03:40:19 +0000 (03:40 +0000)]
mda, watch: wire up List-ID header support

This also adds watchheader tests for -watch, which we never
had before :x

2 years agoconfig: allow "0" as a valid mainrepo path
Eric Wong [Tue, 15 Oct 2019 01:38:25 +0000 (01:38 +0000)]
config: allow "0" as a valid mainrepo path

It's probably wrong to use relative path names, but things are
all relative these days anyways with shared and networked FSes.

2 years agoconfig: avoid unnecessary '||' use
Eric Wong [Tue, 15 Oct 2019 01:18:54 +0000 (01:18 +0000)]
config: avoid unnecessary '||' use

'//' is available in Perl 5.10+ which allows `0' and `""' (empty
string) to remain unclobbered.

We also don't need '||=' for initializing our internal caches.

2 years agoconfig: simplify lookup* methods
Eric Wong [Tue, 15 Oct 2019 01:11:58 +0000 (01:11 +0000)]
config: simplify lookup* methods

This ensures we always process inboxes in section order and
reduces the amount of code we have to maintain for each lookup.

Avoiding the cost of inboxes object creation is not worth the
code overhead; and we can implement a config cache via Storable
easily for large configs and -mda users.

2 years agoconfig: we always have {-section_order}
Eric Wong [Tue, 15 Oct 2019 00:38:06 +0000 (00:38 +0000)]
config: we always have {-section_order}

Rewrite a bunch of tests to use ordered input (emulating
"git config -l" output) so we can always walk sections in
the order they were given in the config file.

2 years agoConfig.pm: Add support for mailing list information
Eric W. Biederman [Fri, 17 May 2019 00:22:46 +0000 (19:22 -0500)]
Config.pm: Add support for mailing list information

The world has turned since I first started following mailing lists and
to my surprise every mailing list that I am subscribed to properly
sets the "List-ID:" mailing list header.  So instead of doing
something clever and flexible I am adding support for looking up
public inbox mailing lists by their mailing list name.

That makes the work needed for each email trivial and easy to understand.
- Parse the "List-ID:" header.
- Lookup in the configuration which mailbox is connected to that
  "List-ID:"
- Deliver the mail to that mailbox.

To that end this change enhances PublicInbox to have an additional
mailbox configuration parameter "listid" that holds the mailing list
name.

A method is added to the PublicInbox config object called
lookup_list_id that given a mailing list name will return the
PublicInbox in the configuration that is configured to handle that
mailing list.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
[ew: avoid autovivification of $ibx->{listid} for t/config.t]

2 years agoPublicInbox::Import Smuggle a raw message into add
Eric W. Biederman [Tue, 15 Jan 2019 22:36:42 +0000 (16:36 -0600)]
PublicInbox::Import Smuggle a raw message into add

I don't trust the MIME type to not munge my email messages in horrible
ways upon occasion.  Therefore  allow for passing in the raw message
value instead of trusting the mime object to preserve it.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
[ew: use "//" from Perl 5.10+ for defined check]

2 years agodoc: remove unnecessary dependency on RelNotes directory
Eric Wong [Tue, 15 Oct 2019 07:33:46 +0000 (07:33 +0000)]
doc: remove unnecessary dependency on RelNotes directory

It was causing unnecessary rebuilds of NEWS* files

2 years agoINSTALL: recommend inotify|kqueue modules for -watch
Eric Wong [Tue, 15 Oct 2019 03:59:26 +0000 (03:59 +0000)]
INSTALL: recommend inotify|kqueue modules for -watch

Jan Kiszka reported high polling frequency when using -watch.

It turns out OS-specific packages for Filesys::Notify::Simple do
not pull in interfaces to use kqueue or inotify, which are
required to perform power-efficient event-based wakeups on
Maildir writes.

Fix the name of the Filesys::Notify::Simple for FreeBSD while
we're at it.

Link: https://public-inbox.org/meta/c85803c6-6d77-a300-491a-9f310dd284c1@web.de/
2 years agoTODO: add an item for Python pygments
Eric Wong [Tue, 8 Oct 2019 21:53:21 +0000 (21:53 +0000)]
TODO: add an item for Python pygments

Pygments seems to be a popular highlighter and widely available,
so we'll be providing support for that at some point...

Link: https://public-inbox.org/meta/20190926131836.GB10467@chatter.i7.local/
Link: https://public-inbox.org/meta/874l0zt7sd.fsf@alyssa.is/
2 years agoTODO: add item for config linter and grapher
Eric Wong [Thu, 10 Oct 2019 08:42:52 +0000 (08:42 +0000)]
TODO: add item for config linter and grapher

It'll be useful for tools and users to test and perhaps
visualize configs before reloading -httpd/-nntpd/-watch.

2 years agot/git-http-backend: disable worker processes
Eric Wong [Fri, 13 Sep 2019 08:57:02 +0000 (08:57 +0000)]
t/git-http-backend: disable worker processes

We want to ensure we run lsof(8) on the worker (if needed),
and not the master, which doesn't serve requests.

This was originally on top of a test-only patch in
https://public-inbox.org/meta/20190913015043.17149-1-e@80x24.org/
In any case, no point in spawning extra processes for this test.

2 years agodoc: explain publicinbox.<name>.watchheader
Alyssa Ross [Wed, 9 Oct 2019 13:21:14 +0000 (13:21 +0000)]
doc: explain publicinbox.<name>.watchheader

It wasn't clear to me exactly what this does -- in particular, what
happens if it isn't specified?  Does it support multiple values?  A
very brief explanation can answer both of these questions without
making somebody look at the code.

2 years agodoc: use local modules to generate NEWS*
Eric Wong [Wed, 9 Oct 2019 06:49:31 +0000 (06:49 +0000)]
doc: use local modules to generate NEWS*

We shouldn't need installed modules to generate NEWS* files.

2 years agoINSTALL: note that we prefer GNU make
Eric Wong [Tue, 8 Oct 2019 02:41:22 +0000 (02:41 +0000)]
INSTALL: note that we prefer GNU make

ExtUtils::MakeMaker uses non-POSIX '::', at least; and
our own Documentation/include.mk and our postamble are
written for GNU make.

GNU make is also more widely-installed and available than any
other make; even if I'm not generally a fan of GNU-isms.

2 years agodoc: PublicInbox::SaPlugin::ListMirror manpage
Eric Wong [Tue, 8 Oct 2019 08:58:06 +0000 (08:58 +0000)]
doc: PublicInbox::SaPlugin::ListMirror manpage

This is a plugin for SpamAssassin that happens to be quite
useful in keeping spam off lists I mirror.  Hopefully more
people can find it useful now that it has a manpage.

2 years agoextmsg: drop unused $have_mm variable
Eric Wong [Tue, 8 Oct 2019 21:42:12 +0000 (21:42 +0000)]
extmsg: drop unused $have_mm variable

We rely on Inbox::mm nowadays.

2 years agoexamples: add grok-pull post_update_hook example
Eric Wong [Sun, 6 Oct 2019 23:56:51 +0000 (23:56 +0000)]
examples: add grok-pull post_update_hook example

This requires the latest (to be in 1.2) -init changes for
synchronization and has no dependencies on GNU or bash-isms
so it should run on *BSD systems without GNU tools.

It does attempt to use curl on <$INBOX_URL/_/text/config/raw>,
but curl is fairly standard nowadays, and falls back to using
an invalid address to initialize.

2 years agodoc: generate NEWS, NEWS.atom, and NEWS.html
Eric Wong [Sun, 6 Oct 2019 23:31:36 +0000 (23:31 +0000)]
doc: generate NEWS, NEWS.atom, and NEWS.html

We'll use our Documentation/RelNotes directory and internal APIs
to generate these files for website use (the website should be
completely reproducible).

2 years agoMakefile.PL: add dependency on MANIFEST contents
Eric Wong [Sun, 6 Oct 2019 23:01:49 +0000 (23:01 +0000)]
Makefile.PL: add dependency on MANIFEST contents

This prevents breakage when running installed scripts when a
user fetches from git and forgets to run "perl Makefile.PL"
before "make install".

2 years agoinit: implement locking
Eric Wong [Thu, 3 Oct 2019 07:21:59 +0000 (07:21 +0000)]
init: implement locking

First, we use flock(2) to wait on parallel public-inbox-init(1)
invocations while we make multiple changes using git-config(1).
This flock allows -init processes to wait on each other if using
reasonable POSIX filesystems.

Then, we also need a git-config(1)-compatible lock to prevent
user-invoked git-config(1) processes from clobbering our
changes while we're holding the flock.

2 years agodoc: add manpage for public-inbox-init(1)
Eric Wong [Thu, 3 Oct 2019 07:21:58 +0000 (07:21 +0000)]
doc: add manpage for public-inbox-init(1)

This old command was lacking a manpage, so (finally) create one.

2 years agoinit: favor --skip-epoch instead of --skip
Eric Wong [Thu, 3 Oct 2019 07:21:57 +0000 (07:21 +0000)]
init: favor --skip-epoch instead of --skip

Since I intend to add support for --skip-artnum, disambiguating
the long option name makes sense.  We'll support --skip
indefinitely for compatibility.

2 years agot/search: bail out on `git init --shared' failures
Eric Wong [Thu, 3 Oct 2019 07:57:29 +0000 (07:57 +0000)]
t/search: bail out on `git init --shared' failures

We can save future testers some time if we bail out early
on "git init --shared" failures, since things like seccomp
or non-POSIX FSes would trigger failures.

BAIL_OUT has been in Test::Simple since Perl v5.10.0, so it's
old-enough to call for our purposes.

Thanks-to: Alyssa Ross <hi@alyssa.is>
Reviewed-by: Alyssa Ross <hi@alyssa.is>
Tested-by: Alyssa Ross <hi@alyssa.is>
Link: https://public-inbox.org/meta/878sq2hd08.fsf@alyssa.is/
2 years agot/search: show file modes as octal on failures
Eric Wong [Thu, 3 Oct 2019 07:38:17 +0000 (07:38 +0000)]
t/search: show file modes as octal on failures

This ought to make permissions errors on odd systems
easier to diagnose in the future.

2 years agotests: recommend running create-certs.pl with $^X
Alyssa Ross [Wed, 2 Oct 2019 21:36:38 +0000 (21:36 +0000)]
tests: recommend running create-certs.pl with $^X

This is better than recommending running the script directly because
it will ensure the correct version of perl is used.

2 years agoHACKING: document Perl character class gotcha
Eric Wong [Wed, 2 Oct 2019 19:32:42 +0000 (19:32 +0000)]
HACKING: document Perl character class gotcha

It took me years to discover this change in Perl 5.6,
maybe other potential hackers are in the same boat.

2 years agolistener: warn on some accept()/accept4() errors
Eric Wong [Tue, 1 Oct 2019 23:18:02 +0000 (23:18 +0000)]
listener: warn on some accept()/accept4() errors

We need to warn when hitting file or socket memory limits
or misconfigurations which clear O_NONBLOCK to make it easier
to diagnose configuration problems.  We'll also warn on
some other errors in case bugs creep in...