]> Sergey Matveev's repositories - public-inbox.git/log
public-inbox.git
19 months agotests: no IPv6 on old Net::NNTP, Mail::IMAPClient, HTTP::Tiny
Eric Wong [Thu, 29 Sep 2022 17:48:31 +0000 (17:48 +0000)]
tests: no IPv6 on old Net::NNTP, Mail::IMAPClient, HTTP::Tiny

The versions of these modules which ship with CentOS 7.x did not
support IPv6 properly.

19 months agogcf2: fix syntax error and require PublicInbox::Git
Eric Wong [Thu, 29 Sep 2022 17:48:30 +0000 (17:48 +0000)]
gcf2: fix syntax error and require PublicInbox::Git

I failed to notice these since I uninstalled libgit2 for
benchmarking and kept it uninstalled since my git(1) install
is faster.

Fixes: 1c0ec857d041 "gcf2: support worktree $GIT_DIR"
19 months agotreewide: use --globoff with curl(1)
Eric Wong [Thu, 29 Sep 2022 17:48:29 +0000 (17:48 +0000)]
treewide: use --globoff with curl(1)

curl 7.29.0 (on CentOS 7.x) seems to mishandle square-bracketed
IPv6 addresses, at least.  Furthermore, we don't actually need
nor use the globbing in curl for lei when forwarding requests
from the lei command-line.  lei has its own globbing and
`--globoff' behavior for externals and none of it is intended
for curl.

19 months agosyscall: initialize buffer for vec()
Eric Wong [Thu, 29 Sep 2022 17:48:28 +0000 (17:48 +0000)]
syscall: initialize buffer for vec()

This is needed for older Perls (tested perl 5.16.3 on CentOS 7).

19 months agogit: reduce early bare-bones memory use
Eric Wong [Mon, 26 Sep 2022 10:17:15 +0000 (10:17 +0000)]
git: reduce early bare-bones memory use

The {-git_path} cache can rely on auto-vivification, and
{alt_st} may not be needed for short-lived repos.  So don't
populate those fields until they're needed, since we can
expect to handle thousands of git repos, too.

19 months agoviewvcs: load blobs asynchronously
Eric Wong [Mon, 26 Sep 2022 10:17:14 +0000 (10:17 +0000)]
viewvcs: load blobs asynchronously

This actually leads to a nice 3-5% speedup under parallel loads
when using git(1) w/o SHA-1 collision detection enabled.  Gcf2
is slower since libgit2 has SHA-1 collision detection enabled
on my system.

Since we're in the area, improve location of comments w.r.t.
cgit CSS class names and note the reliance on scratchpad for
performance in a tight loop.

19 months agogcf2: support worktree $GIT_DIR
Eric Wong [Mon, 26 Sep 2022 10:17:13 +0000 (10:17 +0000)]
gcf2: support worktree $GIT_DIR

We must use `git rev-parse --git-path objects' instead of
blindly appending '/objects' to $GIT_DIR, since appending
doesn't work when $GIT_DIR is a worktree.

19 months agoviewdiff: save memory by eliminating two captures
Eric Wong [Mon, 26 Sep 2022 10:17:12 +0000 (10:17 +0000)]
viewdiff: save memory by eliminating two captures

Avoid relying on $DIGIT captures when @- and @+ to access
last match start and end, respectively.  The elimination of
the post capture ought to allow the use of sv_chop to advance
the string start pointer without memory copies.

This ought to save 1-2MB of memory on my system since I've
noticed the captures was using a big chunk of scratchpad
space.

19 months agot/pop3d: skip all tests if no certs are found
Eric Wong [Wed, 21 Sep 2022 17:02:54 +0000 (17:02 +0000)]
t/pop3d: skip all tests if no certs are found

This test could be written with optional OpenSSL dependencies, but
it's probably not worth it since IO::Socket::SSL seems pretty
common.

Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://public-inbox.org/meta/20220921154741.siubptwcv4463w5l@pengutronix.de/
19 months agowww: viewdiff: fix UTF-8 names inside mbox attachments
Eric Wong [Mon, 12 Sep 2022 22:54:04 +0000 (22:54 +0000)]
www: viewdiff: fix UTF-8 names inside mbox attachments

This avoids `Wide character in print' warnings and ensures the
UTF-8 characters in `Signed-off-by' trailers are properly rendered
in HTML even when attempting to decode and display
application/octet-stream mbox attachments as HTML.

Linkification and reconstruction for coderepos is probably
still broken, but that is a much bigger task to fix, I think.

Fixes: ab9c03ff4aa369b3 ("www: use PerlIO::scalar (zfh) for buffering")
19 months agogit_async_cat: don't use Gcf2 for temporary git dirs
Eric Wong [Mon, 12 Sep 2022 16:04:48 +0000 (16:04 +0000)]
git_async_cat: don't use Gcf2 for temporary git dirs

We don't want to be holding references to temporary directories
longer than necessary, an Gcf is intended to be long-lived.

19 months agosolver: do not show redundant URLs in log
Eric Wong [Sat, 10 Sep 2022 20:10:24 +0000 (20:10 +0000)]
solver: do not show redundant URLs in log

Messages in /all/ can get duplicated at times due to
list-appended signatures or buggy/malicious clients.
They'll all show up based on /$INBOX/$MSGID/,
so deduplicate the URLs to avoid noise.

19 months agoview: fix solver links with multiple messages
Eric Wong [Sat, 10 Sep 2022 20:10:23 +0000 (20:10 +0000)]
view: fix solver links with multiple messages

For redundant messages sharing Message-IDs, the link to solver
(/$INBOX/$OID/s/) was going up too many levels for /$INBOX/$MSGID/
when there were multiple messages sharing the same $MSGID.

Unfortunately, redundant messages are common with /all/
due to signature trailers.  So dynamically assigning {-spfx}
is tricky and error prone from counting `/'.

So simplify the code a bit by setting {-spfx} once per HTTP
request, instead of every single message.

19 months agoviewvcs: switch to `print $zfh'
Eric Wong [Sat, 10 Sep 2022 08:17:29 +0000 (08:17 +0000)]
viewvcs: switch to `print $zfh'

Again, ->zmore has proven expensive due to the overhead of
calling ->deflate on small strings, so print directly to the
file handle and let the PerlIO::scalar layer take care of
buffering.  One of the ->zmore calls was a no-op, even, so
drop that entirely.

19 months agowww_listing: switch to `print $zfh'
Eric Wong [Sat, 10 Sep 2022 08:17:28 +0000 (08:17 +0000)]
www_listing: switch to `print $zfh'

Again, ->deflate (and thus ->zmore) calls are relatively
expensive compared to `print' ops using PerlIO::scalar
behind-the-scenes.  While I can likely optimize the `join' away
here, too, that will happen in a future commit.

19 months agombox*: use multi-arg ->translate and ->write
Eric Wong [Sat, 10 Sep 2022 08:17:27 +0000 (08:17 +0000)]
mbox*: use multi-arg ->translate and ->write

No need to make multiple method calls from here,
now that ->translate and GzipFilter->write both support
multiple args.

19 months agofeed: new_html_i: switch from zmore to `print $zfh'
Eric Wong [Sat, 10 Sep 2022 08:17:26 +0000 (08:17 +0000)]
feed: new_html_i: switch from zmore to `print $zfh'

eml_entry will enable zfh (PerlIO::scalar) buffering, anyways,
so there's no point in calling ->zmore to compress small
strings.  The use of zfh for the skeleton is debatable, but
probably of no consequence given html_footer will hit it,
anyways.

19 months agogzip_filter: write: use multi-arg translate
Eric Wong [Sat, 10 Sep 2022 08:17:25 +0000 (08:17 +0000)]
gzip_filter: write: use multi-arg translate

While we must name this function ->write for PSGI compatibility,
our own uses of it can make it operate more like writev(2)
or `print' in Perl.

19 months agotranslate: support multiple buffer args
Eric Wong [Sat, 10 Sep 2022 08:17:24 +0000 (08:17 +0000)]
translate: support multiple buffer args

This will let us drop some calls to zmore in subsequent commits.

19 months agohttpd/async: describe which ->write subs it can call
Eric Wong [Sat, 10 Sep 2022 08:17:23 +0000 (08:17 +0000)]
httpd/async: describe which ->write subs it can call

I initially wanted to rename GzipFilter->write to
GzipFilter->writev to reflect the multi-argument nature of the
sub, and it wasn't worth the memory to maintain an alias.

19 months agowww_static: switch to `print $zfh', and optimize
Eric Wong [Sat, 10 Sep 2022 08:17:22 +0000 (08:17 +0000)]
www_static: switch to `print $zfh', and optimize

->zmore isn't cheap, and we can be smarter about how
we place newlines to avoid a `join' operation, now.
We can also drop some unused variables, here.

19 months agoviewdiff: diff_header: shorten function, slightly
Eric Wong [Sat, 10 Sep 2022 08:17:21 +0000 (08:17 +0000)]
viewdiff: diff_header: shorten function, slightly

It makes for easier reading with gigantic fonts.

19 months agoviewdiff: diff_before_or_after: avoid extra capture
Eric Wong [Sat, 10 Sep 2022 08:17:20 +0000 (08:17 +0000)]
viewdiff: diff_before_or_after: avoid extra capture

/(.*?)\z/ will capture the "$X insertions(+), $Y deletions(-)"
bit anyways, along with whatever extra notes before the
/^diff --git / line.  So just rely on /(.*?)\z/ and avoid
the special case before it.

19 months agowww: use PerlIO::scalar (zfh) for buffering
Eric Wong [Sat, 10 Sep 2022 08:17:19 +0000 (08:17 +0000)]
www: use PerlIO::scalar (zfh) for buffering

Calling Compress::Raw::Zlib::deflate is fairly expensive.
Relying on the `.=' (concat) operator inside ->zadd operator is
faster, but the method dispatch overhead is noticeable compared
to the original code where we had bare `.=' littered throughout.

Fortunately, `print' and `say' with the PerlIO::scalar IO layer
appears to offer better performance without high method dispatch
overhead.  This doesn't allow us to save as much memory as I
originally hoped, but does allow us to rely less on concat
operators in other places and just pass a list of args to
`print' and `say' as a appropriate.

This does reduce scratchpad use, however, allowing for large
memory savings, and we still ->deflate every single $eml.

19 months agowww: switch to zadd for the majority of buffering
Eric Wong [Sat, 10 Sep 2022 08:17:18 +0000 (08:17 +0000)]
www: switch to zadd for the majority of buffering

This allows us to focus string concatenations in one place to
allow Perl internal scratchpad optimizations to reuse memory.

Calling Compress::Raw::Zlib::deflate repeatedly proves too
expensive in terms of CPU cycles.

19 months agowww: drop {obuf} use entirely, for now
Eric Wong [Sat, 10 Sep 2022 08:17:17 +0000 (08:17 +0000)]
www: drop {obuf} use entirely, for now

This may help us identify hot spots and reduce pad space
as needed.

19 months agoview: switch a few things to ctx->zmore
Eric Wong [Sat, 10 Sep 2022 08:17:16 +0000 (08:17 +0000)]
view: switch a few things to ctx->zmore

Unfortunately, this is actually slower.  However, this
hopefully makes it easier to improve the internals and
make performance improvements down the line.

19 months agoviewdiff: diff_hunk: shorten conditionals, slightly
Eric Wong [Sat, 10 Sep 2022 08:17:15 +0000 (08:17 +0000)]
viewdiff: diff_hunk: shorten conditionals, slightly

I'm not sure if Devel::Size::total_size can be trusted due
to the regexps and crashes[1], but when it works, it's showing
around a 900 byte size reduction, too.

[1] https://rt.cpan.org/Public/Bug/Display.html?id=96421

19 months agoview: html_footer: avoid escaping " in a few places
Eric Wong [Sat, 10 Sep 2022 08:17:14 +0000 (08:17 +0000)]
view: html_footer: avoid escaping " in a few places

qq() is a nice alternative to "" when there's embedded "
characters in HTML entities.

19 months agoview: html_footer: remove obuf dependency
Eric Wong [Sat, 10 Sep 2022 08:17:13 +0000 (08:17 +0000)]
view: html_footer: remove obuf dependency

Another step towards giving us more options for speedups and
memory reductions.

19 months agoview: html_footer: golf out a few lines
Eric Wong [Sat, 10 Sep 2022 08:17:12 +0000 (08:17 +0000)]
view: html_footer: golf out a few lines

We can build `$u' in one line, and drop an unnecessary empty
line to reduce the amount of scrolling required to read this
sub.

19 months agoview: reduce ascii_html calls and {obuf} use
Eric Wong [Sat, 10 Sep 2022 08:17:11 +0000 (08:17 +0000)]
view: reduce ascii_html calls and {obuf} use

We can rely on {-html_tip} for some things at the top of the
page, and reduce ascii_html and obfuscate_addrs calls by
working on the whole buffer at once.

19 months agoview: _th_index_lite: use `//' defined-or op
Eric Wong [Sat, 10 Sep 2022 08:17:10 +0000 (08:17 +0000)]
view: _th_index_lite: use `//' defined-or op

Just something I noticed while evaluating this subroutine
for the buffering overhaul.

19 months agoview: _th_index_lite: avoid one s///, improve symmetry
Eric Wong [Sat, 10 Sep 2022 08:17:09 +0000 (08:17 +0000)]
view: _th_index_lite: avoid one s///, improve symmetry

We can replace an expensive `s///' substitution with a simpler
`chop'.  Furthermore, we can delay the "</b>\n" replacement
to ensure it's on the same line of Perl code as the `<b>'
opening tag for readability.

19 months agoviewdiff: reuse existing string in diff_before_or_after
Eric Wong [Sat, 10 Sep 2022 08:17:08 +0000 (08:17 +0000)]
viewdiff: reuse existing string in diff_before_or_after

Instead of appending to an ever-growing {obuf}, we'll reuse
the existing string (which already has pre-allocated memory).

19 months agoview: attach_link: reduce obuf manipulation
Eric Wong [Sat, 10 Sep 2022 08:17:07 +0000 (08:17 +0000)]
view: attach_link: reduce obuf manipulation

This is another steep towards reducing the maximum size of
an obuf by eventually doing compression earlier while we
render messages as HTML.

And do some golfing while we're at it...

19 months agoview: reduce subroutine calls for submsg_hdr
Eric Wong [Sat, 10 Sep 2022 08:17:06 +0000 (08:17 +0000)]
view: reduce subroutine calls for submsg_hdr

Favor fewer, yet more expensive operations than many smaller
ones.  While we're still directly manipulating ctx->{obuf} after
this, this change makes it easier for us to avoid doing so in
the future.

19 months agoview: remove multipart_text_as_html
Eric Wong [Sat, 10 Sep 2022 08:17:05 +0000 (08:17 +0000)]
view: remove multipart_text_as_html

It seems like a pointless wrapper function that's not saving us
a whole lot.  Drop some direct {obuf} manipulation while we're
at it.

19 months agogzip_filter: ->translate can reuse zmore/zflush
Eric Wong [Sat, 10 Sep 2022 08:17:04 +0000 (08:17 +0000)]
gzip_filter: ->translate can reuse zmore/zflush

We can work towards delaying zlib context allocations in future
commits, too.

19 months agoview: eml_entry: reduce manipulation of ctx->{obuf}
Eric Wong [Sat, 10 Sep 2022 08:17:03 +0000 (08:17 +0000)]
view: eml_entry: reduce manipulation of ctx->{obuf}

This is another step towards avoid unnecessary copies
and pad space waste.

19 months agoview: simplify _parent_headers
Eric Wong [Sat, 10 Sep 2022 08:17:02 +0000 (08:17 +0000)]
view: simplify _parent_headers

Having References but lacking In-Reply-To is an uncommon case
with email, nowadays.  So just rely on ->linkify_mids to handle
linkification and HTML escaping  Furthermore, headers are short
enough to return as-is (and rely on CoW improvements in Perl
5.1x) since linkify_mids needs to operate on an independent
string, anyways.

19 months agowww: viewdiff: use return value for diff_hunk
Eric Wong [Sat, 10 Sep 2022 08:17:01 +0000 (08:17 +0000)]
www: viewdiff: use return value for diff_hunk

It's only a short string, so there's not much copy overhead,
and it'll make future changes easier to reason about.

19 months agowww_listing: avoid unnecessary work for common cases
Eric Wong [Sat, 10 Sep 2022 08:17:00 +0000 (08:17 +0000)]
www_listing: avoid unnecessary work for common cases

We need to branch for non-empty `q=' parameters anyways, but
`q=' is usually empty/unset.  While we're in the area, `chomp'
reads `$/' while `chop' is simpler.  Furthermore, we can shave
a few bytes off the form HTML by omitting spaces before `/>'
and placing `\n' to wrap long lines before attribute names.

19 months agowww_listing: consolidate some ->zmore dispatches
Eric Wong [Sat, 10 Sep 2022 08:16:59 +0000 (08:16 +0000)]
www_listing: consolidate some ->zmore dispatches

`.' concatenation is still faster for small strings, but
passing an array to ->zmore is more efficient for large
search results and full listings.

19 months agoviewvcs: use shorter and simpler ctx->html_done
Eric Wong [Sat, 10 Sep 2022 08:16:58 +0000 (08:16 +0000)]
viewvcs: use shorter and simpler ctx->html_done

We only return 200s for any response large enough to warrant
->html_done, so we can just assume it.  ViewVCS can also take
advantage of it with some tweaking to avoid an extra method
dispatch.

19 months agowww_text: reduce parameter passing for response header
Eric Wong [Sat, 10 Sep 2022 08:16:57 +0000 (08:16 +0000)]
www_text: reduce parameter passing for response header

This is a tiny step in making the code slightly less confusing
by reusing common field names and reducing dependencies on
argument ordering.

19 months agowww_stream: aresponse assumes 200, too
Eric Wong [Sat, 10 Sep 2022 08:16:56 +0000 (08:16 +0000)]
www_stream: aresponse assumes 200, too

There's no reason to be streaming large amounts of HTML for
anything other than a 200 response.

19 months agowww_atom_stream: require 200 response
Eric Wong [Sat, 10 Sep 2022 08:16:55 +0000 (08:16 +0000)]
www_atom_stream: require 200 response

This simplifies parameter passing at the moment.  I can't
imagine an Atom feed reader would be parsing XML for 404s or
other error codes.

19 months agoview: rework single message page to compress earlier
Eric Wong [Sat, 10 Sep 2022 08:16:54 +0000 (08:16 +0000)]
view: rework single message page to compress earlier

We can rely on deflate to compress large thread skeletons on
single message pages.  Subsequent commits will compress bodies,
as well.

19 months agowww: gzip_filter: implicitly flush {obuf} on zmore/zflush
Eric Wong [Sat, 10 Sep 2022 08:16:53 +0000 (08:16 +0000)]
www: gzip_filter: implicitly flush {obuf} on zmore/zflush

This seems like the least disruptive way to allow more use of
->zmore when streaming large messages to sockets.

19 months agoxt: fold perf-obfuscate into perf-msgview, future-proof
Eric Wong [Sat, 10 Sep 2022 08:16:52 +0000 (08:16 +0000)]
xt: fold perf-obfuscate into perf-msgview, future-proof

perf-obfuscate was close enough to perf-msgview that it only
required setting the `obfuscate' field of the inbox.
Then update perf-msgview to account for upcoming internal
changes.  The current use of {obuf} and concat ops results in
excessive scratchpad space and I may be able to even get
speedups by avoiding concat ops.

19 months agolei: fix --help for --jobs with `up' and `q'
Eric Wong [Sat, 10 Sep 2022 01:35:51 +0000 (01:35 +0000)]
lei: fix --help for --jobs with `up' and `q'

The help needs to match on the short option, too, and that
`lei q' option is (like most options) shared with `lei up'.

19 months agolei: bail out earlier on IMAP writer failures
Eric Wong [Sat, 10 Sep 2022 01:18:59 +0000 (01:18 +0000)]
lei: bail out earlier on IMAP writer failures

Excessive IMAP connections can overload IMAP servers and cause
clients to be disconnected without diagnostic messages.
Use $lei->fail on these exceptions to propagate errors to the
CLI ASAP to avoid further errors down the line.

This ought to make problems more apparent for users using IMAP
destinations.

Reported-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://public-inbox.org/meta/CANiDSCsDfutAUMBLPZbxdyka+_jnhv+4YNYdL9QPRoC=wNUGCQ@mail.gmail.com/
19 months agodoc: document --jobs for `lei q' and `lei up'
Eric Wong [Fri, 9 Sep 2022 17:58:25 +0000 (17:58 +0000)]
doc: document --jobs for `lei q' and `lei up'

These may be helpful for users on slow disks or have
IMAP server limitations.

20 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>
20 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.

20 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.