]> Sergey Matveev's repositories - public-inbox.git/log
public-inbox.git
19 months agoGcf2: Create cache folder if missing
Ricardo Ribalda [Thu, 8 Sep 2022 19:57:31 +0000 (21:57 +0200)]
Gcf2: Create cache folder if missing

The code expects that the folder is already present, this patch creates
it if missing.

Without this path the test fails with:

open(/home/debci/.cache/public-inbox/inline-c/.public-inbox.lock): No such file or directory at /usr/share/perl5/PublicInbox/Gcf2.pm line 20

Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com>
19 months agot/v2mirror: increase timeout for plackup bind+listen
Eric Wong [Thu, 8 Sep 2022 08:16:45 +0000 (08:16 +0000)]
t/v2mirror: increase timeout for plackup bind+listen

This test tends to fail sometimes, likely due to plackup
startup being slow on a cold page cache and having an
overloaded rotational HDD.

19 months agoview: drop unnecessary comma in date range note
Eric Wong [Sun, 4 Sep 2022 16:09:45 +0000 (16:09 +0000)]
view: drop unnecessary comma in date range note

I'm not sure how it got there, but it seems out-of-place in
retrospect.

20 months agoimport: pass --quiet to `git gc' if STDERR isn't a tty
Eric Wong [Fri, 2 Sep 2022 18:26:23 +0000 (18:26 +0000)]
import: pass --quiet to `git gc' if STDERR isn't a tty

No need to pollute non-interactive output for gc use.  This
suppresses notifications from my `lei up --all -q' cronjob.

20 months agolei/store: do not write info/refs file
Eric Wong [Fri, 2 Sep 2022 18:26:22 +0000 (18:26 +0000)]
lei/store: do not write info/refs file

That file is meant for dumb HTTP servers, so avoid wasting two
inodes on something that should never be served for private
email.

20 months agoprepare HTML rendering maintainer tests for upcoming changes
Eric Wong [Sun, 4 Sep 2022 04:27:49 +0000 (04:27 +0000)]
prepare HTML rendering maintainer tests for upcoming changes

There'll be a number of upcoming changes to HTML rendering
of messages to hopefully reduce memory usage and speedups
by writing out to the gzip buffer earlier.

Update the tests now so it'll be easier to test before
and after results.

20 months agosolver: do not count duplicates in patch count
Eric Wong [Fri, 2 Sep 2022 10:11:48 +0000 (10:11 +0000)]
solver: do not count duplicates in patch count

We're considering duplicate patches from cross-posted lists
identical, so don't double-count them when displaying the
"applying [X/Y]" message since (successful) duplicates get
skipped.

20 months agosolver: handle copies properly
Eric Wong [Fri, 2 Sep 2022 10:11:47 +0000 (10:11 +0000)]
solver: handle copies properly

At least enough to get 66 patches applied to handle
/lore/all/34d644a519c/s/?b=target/arm/helper-mve.h
properly.

I noticed this bug due to a:
E: BUG: extra files in index: <100644 e91f526a1a83edb2b56798388a355b1c3729b4bd 0#011target/arm/translate-mve.c>
line in my syslog

However, the $TOTAL in "applying [X/$TOTAL]" in the debug log
is seems off...

20 months agoextmsg: shorten partial Message-IDs minimum to 14
Eric Wong [Fri, 2 Sep 2022 09:12:54 +0000 (09:12 +0000)]
extmsg: shorten partial Message-IDs minimum to 14

Gnus seems to start Message-IDs with 10 random characters
followed by ".fsf@$DOMAIN".  In case of mis-linkification or
mis-selection from stopping at the `@', ensuring the first 14
characters are accepted as a search parameter for the truncated
Message-ID improves usability.

20 months agowww: omit [thread overview] link for unindexed v1
Eric Wong [Fri, 2 Sep 2022 09:10:54 +0000 (09:10 +0000)]
www: omit [thread overview] link for unindexed v1

Unindexed v1 inboxes do not have the thread overview skeleton
at the bottom of /$MSGID/ pages, so do not link to it.
And for rare messages without a Date: header (or any headers!),
this also ensures the [thread overview] is shown regardless.

20 months agowww: fix top nav bar for unindexed v1 inboxes
Eric Wong [Fri, 2 Sep 2022 09:10:53 +0000 (09:10 +0000)]
www: fix top nav bar for unindexed v1 inboxes

For /$INBOX/$MSGID/ pages, we need to point all nav bar links
../ regardless of whether ->over exists.  I've also verified
this doesn't affect /$INBOX/new.html at all.

20 months agowww: always show subject for root of thread skeleton
Eric Wong [Thu, 1 Sep 2022 08:42:55 +0000 (08:42 +0000)]
www: always show subject for root of thread skeleton

For users with short attention spans, the root message of should
have the Subject, since <title> is often truncated in most browsers.

20 months agoTODO: add item for RFC 3676 (format=flowed + DelSP)
Eric Wong [Thu, 1 Sep 2022 18:58:29 +0000 (18:58 +0000)]
TODO: add item for RFC 3676 (format=flowed + DelSP)

I noticed some messages looked wonky in HTML (via w3m) compared
to mutt; and neither Email::MIME, Mail::Box nor gmime seem to
handle this standard...

However, mflow (part of mblaze) seems to be good standalone
C implementation that we can check a Perl5 implementation
against.

20 months agoINSTALL: update for Perl 5.12 dependency and 2022
Eric Wong [Tue, 30 Aug 2022 09:10:23 +0000 (09:10 +0000)]
INSTALL: update for Perl 5.12 dependency and 2022

AFAIK, there's no new distro packages this year...

20 months agoMakefile.PL: update version for upcoming 2.x
Eric Wong [Tue, 30 Aug 2022 09:10:22 +0000 (09:10 +0000)]
Makefile.PL: update version for upcoming 2.x

"1.10" seems awkward and may confuse ASCII-betical sorting, so I
think "2.0" is more appropriate.

20 months agoMakefile.PL: add lei-reindex manpage
Eric Wong [Tue, 30 Aug 2022 09:10:21 +0000 (09:10 +0000)]
Makefile.PL: add lei-reindex manpage

I forgot to add this when I added the new command :x

20 months agoviewvcs: show "blob $OID" rather than "$OID blob"
Eric Wong [Mon, 29 Aug 2022 09:26:47 +0000 (09:26 +0000)]
viewvcs: show "blob $OID" rather than "$OID blob"

This is more consistent with the rest of the output where it's
"$TYPE $OID" rather than "$OID $TYPE".  The former also allows
easy copy+pasting into commands for both "git cat-file blob $OID"
and "lei blob $OID".

20 months agoviewvcs: add glossary for commit
Eric Wong [Mon, 29 Aug 2022 09:26:46 +0000 (09:26 +0000)]
viewvcs: add glossary for commit

IMHO, it's important to let users know on how commits tie trees
and parent commits together.

20 months agoviewvcs: reduce hash assignments for commit info
Eric Wong [Mon, 29 Aug 2022 09:26:45 +0000 (09:26 +0000)]
viewvcs: reduce hash assignments for commit info

This makes some of the associated code less verbose and
easier-to-read IMHO.

20 months agoviewvcs: add tree view
Eric Wong [Mon, 29 Aug 2022 09:26:44 +0000 (09:26 +0000)]
viewvcs: add tree view

This also includes some glossary definitions to help users
unfamiliar with git understand the relationship between
trees and blobs.

20 months agosolver: early make hints detection more robust
Eric Wong [Mon, 29 Aug 2022 09:26:43 +0000 (09:26 +0000)]
solver: early make hints detection more robust

Hints fields can change, so we'll use a simple boolean rather
than checking a static count.  We'll also short-circuit out
reliably regardless of hints when a full OID is given.

20 months agowww: provide text/help/#search anchor
Eric Wong [Mon, 29 Aug 2022 09:26:42 +0000 (09:26 +0000)]
www: provide text/help/#search anchor

This allows jumping to the appropriate section of the "help"
from under the dfblob textarea search.

20 months agowww: atom: fix "changed" href to nowhere
Eric Wong [Mon, 29 Aug 2022 09:26:41 +0000 (09:26 +0000)]
www: atom: fix "changed" href to nowhere

The HTML generated for the Atom feed doesn't have the footer
of /T/ and /t/ HTML-only views, so just make "changed" in
the diffstat go directly to the permalink #related anchor.

Fixes: 66512e177390 ("view: generate query in single-message and commit views")
20 months agoview: cleanups and reuse for {obuf} preparation
Eric Wong [Mon, 29 Aug 2022 09:26:40 +0000 (09:26 +0000)]
view: cleanups and reuse for {obuf} preparation

{obuf} will eventually go away and we'll write directly to
{zbuf}, but as an intermediate step we'll make some changes
to rely less on return values.

While we're in the area, reuse Linkify objects in more places
where possible to save some allocations.

20 months agoview: /$INBOX/: show "messages from $old to $new"
Eric Wong [Mon, 29 Aug 2022 09:26:39 +0000 (09:26 +0000)]
view: /$INBOX/: show "messages from $old to $new"

With the ViewVCS commit view using /$INBOX/?t=YYYYMMDDhhmmss-
links, the use of `t=' may not be immediately obvious to a
reader and confuse them into thinking the inbox hasn't been
updated in a while.

So add a header to the top of the page whenever the `t=' query
parameter is used.

And kill a couple of redundant variable assignments while we're
at it.

20 months agotreewide: ditch inbox->recent method
Eric Wong [Mon, 29 Aug 2022 09:26:38 +0000 (09:26 +0000)]
treewide: ditch inbox->recent method

It's a needless wrapper, nowadays.  Originally, ->over was added
on experimental basis to optimize for /$INBOX/ where Xapian
->search is slower on gigantic (LKML-sized) inboxes.

Nowadays with extindex, ->over is here to stay given NNTP and
IMAP both benefit from it.  So reduce the interpreter stack
overhead and just access ->over directly.

lxs->recent was never used outside of tests, anyways.

And while we're in the area, avoid needlessly bumping the
refcount of $ctx->{ibx} in View::paginate_recent.

20 months agoview: speed up /$INBOX/ landing page by 0.5-1.0%
Eric Wong [Mon, 29 Aug 2022 09:26:37 +0000 (09:26 +0000)]
view: speed up /$INBOX/ landing page by 0.5-1.0%

Array lookups and extra arithmetic in Perl is slower than
bumping the internal array offset inside the interpreter.
Fwiw, using: my ($level, $subj) = splice(@extra, 0, 2)
did not result in a performance improvement.

20 months agoviewvcs: author date links to contemporary messages
Eric Wong [Mon, 29 Aug 2022 09:26:36 +0000 (09:26 +0000)]
viewvcs: author date links to contemporary messages

Sometimes it can be useful to figure out what's going in on the
associated inbox around the time the patch was authored.

20 months agoviewvcs: add patch download link for single-parent commits
Eric Wong [Mon, 29 Aug 2022 09:26:35 +0000 (09:26 +0000)]
viewvcs: add patch download link for single-parent commits

The email signature field will echo the format-patch arguments
used so it can be used as hint for users learning to more of
the git CLI.

20 months agoviewvcs: use array for highlighted blob display
Eric Wong [Mon, 29 Aug 2022 09:26:34 +0000 (09:26 +0000)]
viewvcs: use array for highlighted blob display

This can avoid at least one expensive copy for displaying
large blobs with syntax highlighting.

However, we cannot blindly change everything to arrays, either:
the cost of invoking Compress::Raw::Zlib->deflate must be taken
into account.  Joining short strings via `.=', `.', `join' or
interpolation is typically faster since it avoids ->deflate
method calls (and non-magic perlops are the fastest dispatches
in Perl).

20 months agowww: allow html_oneshot to take an array arg
Eric Wong [Mon, 29 Aug 2022 09:26:33 +0000 (09:26 +0000)]
www: allow html_oneshot to take an array arg

Another step towards making our internal APIs more writev-like
and reducing the copies needed for `join' or `.=' concatenation.

20 months agoviewvcs: delay stringification of solver debug log
Eric Wong [Mon, 29 Aug 2022 09:26:32 +0000 (09:26 +0000)]
viewvcs: delay stringification of solver debug log

This will make future changes easier to work on as we pass more
stuff through $ctx and reduce parameter passing on the Perl stack.

20 months agoviewvcs: share File::Temp::Dir with solver
Eric Wong [Mon, 29 Aug 2022 09:26:31 +0000 (09:26 +0000)]
viewvcs: share File::Temp::Dir with solver

This allows reusing inodes for /$COMMIT_OID/s/ requests.
We'll also replace `log' with `lh' in the field name to
avoid confusion with the `log' perlop.

20 months agosolver: create tmpdir lazily
Eric Wong [Mon, 29 Aug 2022 09:26:30 +0000 (09:26 +0000)]
solver: create tmpdir lazily

"lei blob" doesn't currently need it at all in some cases, and
the next commit will allow viewvcs to share tmpdirs to show
commits as HTML.

20 months agoTODO: add some Xapian-related stuff
Eric Wong [Fri, 26 Aug 2022 18:29:13 +0000 (18:29 +0000)]
TODO: add some Xapian-related stuff

Just to more clearly spell out what needs to be done on
the search side.

20 months agolinkify: avoid digits and dashes in placeholders
Eric Wong [Sun, 28 Aug 2022 03:59:50 +0000 (03:59 +0000)]
linkify: avoid digits and dashes in placeholders

The `highlight' module seems to highlight every digit in
YAML (and possibly other) source files.  This causes problems
in linkify_2 which replaces the placeholders with proper URIs.
I suspect `-' and other punctuation characters will cause
similar problems, so we must stick to [A-Za-z].

Thus transliterate 0-9 to A-J in the hex key to ensure highlight
doesn't see digit characters, and rename the prefix to be
project-name independent.

20 months agowww: fix unindexed v1 inboxes w/ public-inbox-httpd
Eric Wong [Fri, 26 Aug 2022 10:15:45 +0000 (10:15 +0000)]
www: fix unindexed v1 inboxes w/ public-inbox-httpd

Unindexed v1 inboxes were leaving $smsg objects unpopulated when
using public-inbox-httpd (but not generic PSGI servers) and
causing missing HTML content and uninitialized value warnings.

Our existing tests for unindexed v1 inboxes only assumed generic
PSGI servers and synchronous blob retrieval.  Due to changes
several years ago to make git blob retrieval async for slow
storage using public-inbox-httpd, our tests were insufficient to
detect this regression.

So ensure $smsg->populate runs in a few places and rewrite
t/plack.t to test against both generic PSGI and -httpd
implementations.

Fortunately, unindexed v1 inboxes are uncommon, and this
bug was only (finally) discovered while developing other
features.

For ensuring we can test (and not blindly follow) redirects with
-httpd, we now provide our own LWP::UserAgent (used internally
by Plack::Test::ExternalServer) with redirect following
disabled to P:T:ES::test_psgi.

20 months agoview: add "this message" link above dfblob: textarea
Eric Wong [Fri, 26 Aug 2022 03:20:20 +0000 (03:20 +0000)]
view: add "this message" link above dfblob: textarea

When jumping to #related from /T/ or /t/ views, it could be
disconcerting to not have the current message as context.
So add a "this message" link back up to #t as we have always
done with the reply instructions.

20 months agoviewvcs: don't wait on slow disks for git commit titles
Eric Wong [Tue, 23 Aug 2022 08:32:03 +0000 (08:32 +0000)]
viewvcs: don't wait on slow disks for git commit titles

We can easily wire into the DS event loop to take advantage
of epoll/kevent notifications and serve other clients in
the mean time.

20 months agogzip_filter: ->zmore and ->zflush support multiple args
Eric Wong [Tue, 23 Aug 2022 08:32:02 +0000 (08:32 +0000)]
gzip_filter: ->zmore and ->zflush support multiple args

This will make writev-like use easier for the next commit,
and also future changes where I'll rely more on zlib for
buffering.

20 months agoibx_async_cat: access ->{git} directly
Eric Wong [Tue, 23 Aug 2022 08:32:01 +0000 (08:32 +0000)]
ibx_async_cat: access ->{git} directly

This will enable callers to pass non-Inbox-ish hashrefs as the
arg.  This benefits existing Inbox-ish objects, too, as it
avoids a slow method dispatch for both ExtSearch and Inbox.

20 months agoviewvcs: separate email and date with spaces
Eric Wong [Tue, 23 Aug 2022 08:32:00 +0000 (08:32 +0000)]
viewvcs: separate email and date with spaces

Horizontal tabs can be too much for narrow displays, so just add
an extra space to keep the date separate from the email address.

20 months agoviewvcs: show commit titles for parent commits
Eric Wong [Tue, 23 Aug 2022 08:31:59 +0000 (08:31 +0000)]
viewvcs: show commit titles for parent commits

It's hard to know which commit I'm following a link to without
having the title of the commit handy.

20 months agoviewvcs: remove patchid line from commit header
Eric Wong [Tue, 23 Aug 2022 08:31:58 +0000 (08:31 +0000)]
viewvcs: remove patchid line from commit header

I'm considering dropping this entirely since dfpre:, dfpost:
dfn:, and s: can be just as powerful, if not more.  patchid: is
inaccurate if either non-standard diff generation options are
used (e.g. -W or -U6); or if a MUAs mangle whitespace.

We'll keep patchid: at the top search input box for now, but the
textarea at the bottom (and possibly another textarea for a more
exact match) is probably more useful and flexible.

20 months agoviewdiff: linkify diffstats for non-format-patch emails
Eric Wong [Tue, 23 Aug 2022 08:31:57 +0000 (08:31 +0000)]
viewdiff: linkify diffstats for non-format-patch emails

Some folks unfortunately use "git diff --stat -p" to generate
patches.  These messages lack the /^---$/ line and causing
diffstats to not get linkified properly.  We now treat the
/^---$/ as optional and rely on the presence of file lines with
/ \| / proceeding a /\d+ files? changed,/ line.

20 months agoview: generate query in single-message and commit views
Eric Wong [Tue, 23 Aug 2022 08:31:56 +0000 (08:31 +0000)]
view: generate query in single-message and commit views

The dfblob: search prefix is probably under-utilized, but is
extremely powerful IMHO.  To make it easier-to-use, add a search
textarea with it prefilled with values for the existing patch
message.  This allows users to easily run a query for all
patches which alter or result in either pre or post-image
blobs in the current patch.

Behavior changes are as follows: "changed" in the diffstat
jumps to the bottom of the message.  For /T/ and /t/, it
goes to the "related" anchor which is just above the reply
instructions in the single-message view.  For the single
message view, it'll jump to the textarea search form.

I initially wanted to use a normal `<a href=' link, but
figured the textarea is advantageous for two reasons:

1) users should be able to edit the query before submitting
2) crawlers are less likely to waste CPU/disk on forms

It's probably too noisy to add this directly to the /T/ and /t/
views, but seems like a good place to put above the reply
instructions in the single message view.

Note that the queries used by the /$COMMIT_OID/s/ view is
subtly different than the /$MSGID/ view since git will lengthen
its abbreviations over time, while emails are immutable.

I tried adding dfn: (filename) and s: (subject) support, but
couldn't come up with cases where it really made sense for
/$MSGID/.  /$COMMIT_OID/s/ may benefit from it, since patchid:
could be flaky due to non-standard diff generation options.

20 months agoviewvcs: use :utf8 for opening patch, too
Eric Wong [Mon, 22 Aug 2022 06:44:12 +0000 (06:44 +0000)]
viewvcs: use :utf8 for opening patch, too

We'll also force --encoding=UTF-8 for "git show" even
if that's the default in git, since the rest of our code
already assumes UTF-8.

20 months agoviewvcs: start improving display of git commits
Eric Wong [Mon, 22 Aug 2022 02:33:46 +0000 (02:33 +0000)]
viewvcs: start improving display of git commits

For non-merge git commits, we already have ViewDiff for
displaying patch emails, we can reuse it to display non-merge
git commits.

AFAIK, this is the first web-based git repository viewer
to display the output of "git-patch-id --stable".
It currently fills in the search form box with "patchid:",
but maybe it'll do more than that.

More work will be done to support bidirectional mapping
of commits to emails in the future.

20 months agoviewvcs: drop pointless variable assignment
Eric Wong [Mon, 22 Aug 2022 02:33:45 +0000 (02:33 +0000)]
viewvcs: drop pointless variable assignment

Not needed since commit:
41f03a3bd4b13dfa (viewvcs: do not show final error message twice, 2019-01-27)

20 months agoqspawn: improve error reporting and handling
Eric Wong [Mon, 22 Aug 2022 02:33:44 +0000 (02:33 +0000)]
qspawn: improve error reporting and handling

First off, avoid potential circular references (via {qx_arg}) by
dropping the {-qsp} field from $ctx and SolverGit objects.
Instead, we only share a reference to an optional error buffer
string {qsp_err}.

We'll also attempt to call qspawn.wcb if qx_cb fails, and warn
in more places w/o checking for $env since we now rely on warn()
instead of $env->{'psgi.errors'}.

This makes error handling simpler and safer in future callers.

20 months agoqspawn: add type comments in a few places
Eric Wong [Mon, 22 Aug 2022 02:33:43 +0000 (02:33 +0000)]
qspawn: add type comments in a few places

This makes things easier-to-follow in a minimally-typed language.

20 months agowww: /s/: 404 for unconfigured coderepos
Eric Wong [Mon, 22 Aug 2022 02:33:42 +0000 (02:33 +0000)]
www: /s/: 404 for unconfigured coderepos

The $r404 variable is unset if we have a valid inbox, but no
coderepos configured for that inbox, thus we must `r(404)'
explicitly.

20 months agoxt/solver: improve diagnostics
Eric Wong [Mon, 22 Aug 2022 02:33:41 +0000 (02:33 +0000)]
xt/solver: improve diagnostics

I'm making some tweaks to solver and will probably find extra
output useful, and also update to v5.12 while we're at it.

20 months agoconfig: fix confusing space in ->repo_objs
Eric Wong [Mon, 22 Aug 2022 02:33:40 +0000 (02:33 +0000)]
config: fix confusing space in ->repo_objs

It's actually valid Perl to have "$foo ->{field} = ..."
but it's confusing and I noticed it while tracking down
a configuration error.

20 months agowww: support `+' in inbox names
Eric Wong [Sun, 21 Aug 2022 22:21:00 +0000 (22:21 +0000)]
www: support `+' in inbox names

`+' already seemed to works for IMAP mailboxes and NNTP newsgroup
names and git-config doesn't complain, either.  So allow it as
the path components of WWW URLs so projects like `libstdc++' can
use it.

Reported-by: Mark Wielaard <mark@klomp.org>
Tested-by: Mark Wielaard <mark@klomp.org>
Link: https://public-inbox.org/meta/YwKnFCvganW7ErXU@wildebeest.org/
20 months agopublic-inbox 1.9.0 v1.9.0
Eric Wong [Sun, 21 Aug 2022 02:35:27 +0000 (02:35 +0000)]
public-inbox 1.9.0

20 months agodoc: 1.9 release notes update
Eric Wong [Sat, 20 Aug 2022 08:25:32 +0000 (08:25 +0000)]
doc: 1.9 release notes update

Getting close to another release, I think...

20 months agowww: mbox* drop unneeded {base_url} memoizations
Eric Wong [Sat, 20 Aug 2022 08:01:35 +0000 (08:01 +0000)]
www: mbox* drop unneeded {base_url} memoizations

That field is not needed since List-* and Archived-At headers
are no longer appended as of commit:
1bf653ad139bf7bb (nntp+www: drop List-* and Archived-At headers, 2020-12-10)

20 months agowww: use absolute URLs for coderepo URLs
Eric Wong [Sat, 20 Aug 2022 08:01:34 +0000 (08:01 +0000)]
www: use absolute URLs for coderepo URLs

Showing "../../foo.git" looks awkward and isn't conducive to
users who want to "git clone" a URL.

20 months agoview: do not show pagination footer for small inboxes
Eric Wong [Sat, 20 Aug 2022 08:01:33 +0000 (08:01 +0000)]
view: do not show pagination footer for small inboxes

For new public inboxes with few messages, the dead pagination
footer is a worthless and confusing waste of space: "page: \n";
without `next' or `prev' links for users to follow.

20 months agoimap: remove some intermediate arrays
Eric Wong [Sat, 20 Aug 2022 08:01:32 +0000 (08:01 +0000)]
imap: remove some intermediate arrays

We can assign arrays directly without `[]' creating an extra
immortal pad allocation.

20 months agoimport: take advantage of some Perl 5.10.x features
Eric Wong [Sat, 20 Aug 2022 08:01:31 +0000 (08:01 +0000)]
import: take advantage of some Perl 5.10.x features

We can save a few lines of code this way and reduce the
verbosity of some lines we keep.

20 months agolei/store: reindex culls over-indexed messages
Eric Wong [Fri, 19 Aug 2022 09:07:45 +0000 (09:07 +0000)]
lei/store: reindex culls over-indexed messages

I may be the only lei user who has redundantly-indexed messages
needing this, though...

20 months agosmsg: ->populate falls back to old {ds}/{ts} values
Eric Wong [Fri, 19 Aug 2022 09:07:44 +0000 (09:07 +0000)]
smsg: ->populate falls back to old {ds}/{ts} values

This will be useful for re-indexing external messages which
were over-indexed in lei/store.

20 months agotests: add some basic "lei reindex" tests
Eric Wong [Fri, 19 Aug 2022 09:07:43 +0000 (09:07 +0000)]
tests: add some basic "lei reindex" tests

This is a bit hard-to-test, but at least we must ensure
volatile-metadata is preserved.

20 months agolei reindex: account for parallel lei/store users
Eric Wong [Fri, 19 Aug 2022 09:07:42 +0000 (09:07 +0000)]
lei reindex: account for parallel lei/store users

We need to call eidx_init in each git->cat_async callback
since another requestor may've stopped the shard processes.

20 months agolei reindex: new command to reindex lei/store
Eric Wong [Wed, 17 Aug 2022 09:33:17 +0000 (09:33 +0000)]
lei reindex: new command to reindex lei/store

20 months agolei/store: reduce work when accessing mail_sync.sqlite3
Eric Wong [Wed, 17 Aug 2022 09:33:16 +0000 (09:33 +0000)]
lei/store: reduce work when accessing mail_sync.sqlite3

There's no need to initialize eidx if we already have an open
handle for mail_sync.sqlite3

20 months agolei inspect: less scary exception for invalid "docid:" inspect
Eric Wong [Wed, 17 Aug 2022 09:33:15 +0000 (09:33 +0000)]
lei inspect: less scary exception for invalid "docid:" inspect

It still says "Exception:", but doesn't pointlessly print out
the line number and file of the exception when it's a data/input
problem, and not a code problem on our end.

20 months agosearchidx: fix spelling error in comment
Eric Wong [Wed, 17 Aug 2022 09:33:14 +0000 (09:33 +0000)]
searchidx: fix spelling error in comment

20 months agolei: do not wait for sto->done on disconnected EOF
Eric Wong [Tue, 16 Aug 2022 03:44:03 +0000 (03:44 +0000)]
lei: do not wait for sto->done on disconnected EOF

lei-daemon (the top-level daemon process) should not have
synchronous waits, and this was causing a deadlock with
interrupted commands.  There may still be a bug lurking in
lei/store despite this fix, though.  I originally thought commit
fd261b9e65674505 (lei_store_err: use level-trigger for error pipe, 2022-08-15)
was sufficient, but at least this change is needed, as well.

20 months agopop3: speed up STAT slightly (~1%)
Eric Wong [Fri, 12 Aug 2022 22:09:19 +0000 (22:09 +0000)]
pop3: speed up STAT slightly (~1%)

We can calculate the total size of the mailbox while generating
the cache, which allows us to iterate the cache again to
calculate the size of the mailbox slice.  While we're in the
area, simplify the loop and avoid needlessly updating the `$beg'
variable.

This adds a small amount of constant time overhead to DELE,
however that is amortized across multiple requests for fairness.

20 months agolei_store_err: use level-trigger for error pipe
Eric Wong [Mon, 15 Aug 2022 19:28:33 +0000 (19:28 +0000)]
lei_store_err: use level-trigger for error pipe

This fixes deadlocks from errors inside lei/store when multiple
errors are spewed.

20 months agopop3: fix off-by-one error when handling `EXPIRE 0'
Eric Wong [Fri, 12 Aug 2022 21:30:37 +0000 (21:30 +0000)]
pop3: fix off-by-one error when handling `EXPIRE 0'

mark_dele already works on the cache offset, so there's no need
to make further adjustments to the offset (as we do with POP3
sequence numbers).

20 months agopop3: quiet warning for cached active statements
Eric Wong [Fri, 12 Aug 2022 09:14:48 +0000 (09:14 +0000)]
pop3: quiet warning for cached active statements

Setting the $if_active parameter of ->prepare_cached to `1'
seemed to be the best option many years ago, so it's probably
the best option going forward when caching prepared statements.

Fixes: cab36ebd00ca72f8 ("pop3: remove untouched rows on QUIT/disconnect")
20 months agosyscall: add support for riscv64
Eric Wong [Thu, 11 Aug 2022 22:33:12 +0000 (22:33 +0000)]
syscall: add support for riscv64

Tested on gcc92.fsffrance.org from cfarm.

20 months agotests: support require_mods 'v2'
Eric Wong [Thu, 11 Aug 2022 22:33:05 +0000 (22:33 +0000)]
tests: support require_mods 'v2'

This fixes t/v2index-late-dupe.t to be skipped properly on
systems without DBD::SQLite

20 months agodoc: spell out "PROTOCOL" in examples
Eric Wong [Thu, 11 Aug 2022 20:13:11 +0000 (20:13 +0000)]
doc: spell out "PROTOCOL" in examples

"PROTO" is probably ambiguous, and we'll use the same
terminology as used in curl(1) documentation.

20 months agoexamples: add systemd files for -netd
Eric Wong [Thu, 11 Aug 2022 20:13:10 +0000 (20:13 +0000)]
examples: add systemd files for -netd

It's important show that a single systemd service and socket file
can replace all other read-only daemons for ease-of-management.

20 months agoexamples: consolidate systemd socket examples
Eric Wong [Thu, 11 Aug 2022 20:13:09 +0000 (20:13 +0000)]
examples: consolidate systemd socket examples

systemd.socket(5) files can actually contain multiple listen
sockets, so shave down inode overhead and simplify config
file management by consolidating all applicable ports into
a single file for each daemon.

20 months agodoc: drop ancient Apache and WEBrick examples
Eric Wong [Thu, 11 Aug 2022 20:13:08 +0000 (20:13 +0000)]
doc: drop ancient Apache and WEBrick examples

Having old, unmaintained docs for other HTTP servers is likely
harmful at this point.  public-inbox-httpd is specifically
designed to handle git repos on slow storage and stream giant
mbox.gz files fairly to slow clients.

20 months agodevel/syscall-list: support non-Linux, show sizeof(pid_t)
Eric Wong [Thu, 11 Aug 2022 20:33:39 +0000 (20:33 +0000)]
devel/syscall-list: support non-Linux, show sizeof(pid_t)

While I have no intention of using syscall numbers for
non-Linux, sizeof(pid_t) was useful for OpenBSD.  And maybe
Linux can have real competition from other OSes with stable
syscall numbers someday.

20 months agopop3d: enable native fcntl locks on all *BSDs
Eric Wong [Thu, 11 Aug 2022 20:00:21 +0000 (20:00 +0000)]
pop3d: enable native fcntl locks on all *BSDs

...as we've already done for the simpler case of mbox locking in lei.
I've just confirmed NetBSD and OpenBSD share the same "struct flock"
with FreeBSD, and assume DragonflyBSD is the same.  sizeof(pid_t) == 4
in all places I've checked, and it's unlikely we'll need 64-bit
pid_t any time soon...

20 months agowww: inbox: favor "pop3://" over "pop://"
Eric Wong [Thu, 11 Aug 2022 20:00:20 +0000 (20:00 +0000)]
www: inbox: favor "pop3://" over "pop://"

curl only supports "pop3://" and "pop3s://", despite RFC 2384
existing for "pop://".  AFAIK, there's no RFCs for "pop3://"
and "pop3s://", but please let us know if there are.

In any case, real-world cases like curl are more relevant.

20 months agodoc: add WIP 1.9 release notes
Eric Wong [Thu, 11 Aug 2022 17:36:19 +0000 (17:36 +0000)]
doc: add WIP 1.9 release notes

I think "lei reindex" and some doc cleanups will be the last
things before 1.9...

20 months agowww_text: fix #nntp anchor for there's a single NNTP server
Eric Wong [Thu, 11 Aug 2022 15:47:30 +0000 (15:47 +0000)]
www_text: fix #nntp anchor for there's a single NNTP server

We use "Newsgroup" (singular) when there's only one NNTP
server address configured.

20 months agodaemon: rely on $SIG{__WARN__} for error output
Eric Wong [Wed, 10 Aug 2022 15:58:01 +0000 (15:58 +0000)]
daemon: rely on $SIG{__WARN__} for error output

warn/carp usage is unavoidable given Perl itself and standard
libraries, so just rely on localized $SIG{__WARN__} from
60d262483a4d6ddf (daemon: use per-listener SIG{__WARN__} callbacks, 2022-08-08)
for all error reporting.

While we're in the area, make some of the error handling more
consistent between IMAP/NNTP/POP3.

20 months agowww_text: add AUTH=ANONYMOUS to IMAP URLs
Eric Wong [Wed, 10 Aug 2022 07:40:31 +0000 (07:40 +0000)]
www_text: add AUTH=ANONYMOUS to IMAP URLs

While the ';' requires escaping on the command-line, the
presence of ";AUTH=ANONYMOUS" communicates clearly that
anonymous access is supported in accordance to RFC 4505.

20 months agowww_text: clarify the password+username is for POP3
Eric Wong [Wed, 10 Aug 2022 07:40:30 +0000 (07:40 +0000)]
www_text: clarify the password+username is for POP3

NNTP and IMAP can also exist in the same area, so clarify
that the username + password is only for POP3

20 months agowww_text: add #nntp, #pop3, and #imap anchors to help HTML
Eric Wong [Wed, 10 Aug 2022 07:40:29 +0000 (07:40 +0000)]
www_text: add #nntp, #pop3, and #imap anchors to help HTML

This will make it easier to link to these sections in
3rd-party documentation.

20 months agopop3: remove untouched rows on QUIT/disconnect
Eric Wong [Wed, 10 Aug 2022 06:00:53 +0000 (06:00 +0000)]
pop3: remove untouched rows on QUIT/disconnect

Some POP3 clients may connect and never retrieve messages nor
trigger deletes.  In that case, save some storage by removing
unused rows from the `deletes' and `users' tables.

20 months agoimapd|nntpd: drop ->base_url preload
Eric Wong [Mon, 8 Aug 2022 23:53:11 +0000 (23:53 +0000)]
imapd|nntpd: drop ->base_url preload

It was never useful for IMAP, and NNTP hasn't needed it since:
1bf653ad139bf7bb (nntp+www: drop List-* and Archived-At headers, 2020-12-10)

20 months agoimap: mailboxes list across listeners
Eric Wong [Mon, 8 Aug 2022 23:53:10 +0000 (23:53 +0000)]
imap: mailboxes list across listeners

Since IMAP mailbox lists are tied to the PublicInbox::Config
object, we can share them the same way the config object is
shared when an -imapd or -netd instance has multiple listeners.

This ought to reduce memory use and startup time when binding
multiple sockets which share a common config file.

20 months agodaemon: cleanup internal data structures
Eric Wong [Mon, 8 Aug 2022 23:53:09 +0000 (23:53 +0000)]
daemon: cleanup internal data structures

This avoids dangling {''} entries in $xnetd and
%tls_opt hashes.  Furthermore, we can safely undef
%tls_opt once it's associated with each $xnetd object.

20 months agodaemon: use per-listener SIG{__WARN__} callbacks
Eric Wong [Mon, 8 Aug 2022 23:53:08 +0000 (23:53 +0000)]
daemon: use per-listener SIG{__WARN__} callbacks

This allows "-l $ADDRESS?err=/path/to/err.log to isolate normal
warn() (and carp()) messages for a particular listen address to
track down errors more easily.

20 months agodaemon: use default address + well-known ports for scheme
Eric Wong [Mon, 8 Aug 2022 23:53:07 +0000 (23:53 +0000)]
daemon: use default address + well-known ports for scheme

This ensures the "bound $URL" diagnostic message at startup
always shows the URL scheme handled if not relying on socket
inheritance.

This also avoids duplicate/unused data structures when binding
sockets ourselves, as bound socket names can expand from short
names to longer names (e.g. "0:119" => "0.0.0.0:119").

20 months agoREADME: recommend AUTH=ANONYMOUS on IMAP URLs
Eric Wong [Mon, 8 Aug 2022 23:16:48 +0000 (23:16 +0000)]
README: recommend AUTH=ANONYMOUS on IMAP URLs

public-inbox-imapd prioritizes AUTH=ANONYMOUS clients, nowadays,
since it's a good heuristic for legitimate client traffic.

20 months agoimap: prioritize AUTH=ANONYMOUS clients
Eric Wong [Mon, 8 Aug 2022 23:16:47 +0000 (23:16 +0000)]
imap: prioritize AUTH=ANONYMOUS clients

...by deprioritizing clients using a username + password.

As IMAP provides AUTH=ANONYMOUS for designating anonymous
access, we'll rely on it as a heuristic for favoring "good"
clients.  Clients using a username + password seem to (more
often than not) be malicious and looking for info which doesn't
belong in public inboxes.

This copies the technique used by WWW + -httpd to deprioritize
expensive mbox.gz downloads.

20 months agoimap: only give AUTH=ANONYMOUS clients prefetch
Eric Wong [Mon, 8 Aug 2022 23:16:46 +0000 (23:16 +0000)]
imap: only give AUTH=ANONYMOUS clients prefetch

Looking at IMAP traffic on public-inbox.org, it seems there is a
fair amount of traffic coming from malicious clients assuming
the IMAP server is compromised and searching for private
information.  Since AUTH=ANONYMOUS clients are more likely to
be legitimate clients looking for publicly-archived mail,
give them priority.

20 months agoimap: limit ibx_async_prefetch to idle git processes
Eric Wong [Mon, 8 Aug 2022 23:16:45 +0000 (23:16 +0000)]
imap: limit ibx_async_prefetch to idle git processes

This improves fairness while having no measurable performance
impact for a single uncached IMAP client (mutt) opening a folder
for the first time.

I noticed this problem with the public-inbox.org IMAP server where
a few IMAP clients were unfairly monopolizing the -netd process.