Eric Wong [Mon, 4 Nov 2019 03:01:34 +0000 (03:01 +0000)]
t/httpd-corner.t: drop unnecessary bytes:: for length()
We don't need to force byte semantics for a buffer we clearly
create (via ->read) with byte semantics. Since we didn't
"use bytes" in t/httpd-corner.t, it was inadvertantly made
available by IPC::Run (which goes away, next).
Eric Wong [Mon, 4 Nov 2019 03:01:33 +0000 (03:01 +0000)]
t/*.t: remove IPC::Run dependency for git commands
One small step towards making tests easier-to-run. We can rely
on "local $ENV{GIT_DIR}" for potentially shell-unsafe path
names, and the rest of our path names are relative and don't
contain characters which require escaping.
Eric Wong [Fri, 8 Nov 2019 20:20:17 +0000 (20:20 +0000)]
edit: propagate correct editor exit code
exit($?) is never correct, since ($? >> 8) is needed to extract
the correct exit code, as other information (e.g. such as signal)
is encoded in $? in addition to the exit code.
Eric Wong [Mon, 4 Nov 2019 11:13:47 +0000 (11:13 +0000)]
tests: rely on PublicInbox::Git for pathname safety
It's possible (but unlikely) a user will put spaces in TMPDIR
and cause File::Temp::tempdir() to return a temporary directory
with spaces in the filename, making it unsafe for shell
expansion.
PublicInbox::Git didn't exist when t/mda.t was written, and
I just forgot about PublicInbox::Git->qx for t/plack.t :x
Eric Wong [Sun, 3 Nov 2019 06:48:58 +0000 (06:48 +0000)]
searchidxshard: reuse $SIG{__WARN__} callback from Admin
We don't want to define $SIG{__WARN__} in the worker to call an
existing non-default callback. Instead update ->{current_info}
the same way the V2Writable master process does.
I noticed this while reindexing with a large XAPIAN_FLUSH_THRESHOLD
and seeing the wrong epoch on my terminal from a shard because the
shard worker was spawned while reindexing a higher-numbered epoch.
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.
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.
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.
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):
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):
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.
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.
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
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.
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.
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.
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
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.
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.
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.
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
"<" and ">" outside of <a> in the HTML.
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.
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
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).
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.
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".
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"
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.
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.
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
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
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.
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.
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.
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]
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]
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.
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.
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.
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.