Eric Wong [Mon, 6 May 2019 23:42:31 +0000 (23:42 +0000)]
spawn (Inline::C): fix off-by-one error
Noticed while testing on FreeBSD 11.2 amd64 with the optional
Inline::C extension using clang 6.0.0. The end result on
FreeBSD was spawning processes failed badly and things were
immediately unusable with this enabled.
av_len is a misleading API, and I failed to read the API
comments in perl:/av.c which state:
> Note that, unlike what the name implies, it returns
> the highest index in the array, so to get the size of
> the array you need to use "av_len(av) + 1".
> This is unlike "sv_len", which returns what you would expect.
If this bug affected anybody, it would've only affected users
using both the optional Inline::C module AND set the
PERL_INLINE_DIRECTORY environment variable.
That said, I've never seen any evidence of it on Debian
GNU/Linux + gcc on any x86 variant. That includes full 64-bit
systems, a full 32-bit system, a 64-bit system with 32-bit
userspace, across multiple gcc versions since 2016.
Eric Wong [Sat, 27 Apr 2019 21:46:54 +0000 (21:46 +0000)]
extmsg: escape ampersands in @EXT_URL array
We already escape the user-provided Message-IDs (so there's no
security problem AFAIK), but the URL templates which exist in
our source code were not escaped properly.
Eric Wong [Fri, 26 Apr 2019 07:42:24 +0000 (07:42 +0000)]
viewdiff: do not break out of DSTATE_CTX on /^$/
It seems a common case for mangled patches is editors or MUAs
dropping trailing whitespace, and lines matching /^ $/ gets
the space dropped to only match /^$/.
Eric Wong [Thu, 25 Apr 2019 07:57:06 +0000 (07:57 +0000)]
cgit: improve handling of cgit data path
Document `publicinbox.cgitdata' config directive, but allow it
to be unspecified and/or missing for installations which do not
wish to serve static data at all.
For users installing cgit from source to their home directory,
we can usually infer the cgit data path based on the cgit.cgi
binary path, even.
Eric Wong [Wed, 24 Apr 2019 19:52:14 +0000 (19:52 +0000)]
wwwhighlight: do linkification, too
Otherwise, there's no reason to use this API over highlight(1).
Maybe this can be an option in the future; but I'm struggling to
find a reason to not do it by default.
Eric Wong [Thu, 18 Apr 2019 08:25:56 +0000 (08:25 +0000)]
www: support listing of inboxes
We will still return a 404 by default to '/' for compatibility
with users of Plack::App::Cascade or similar. Inboxes are
sorted by modification times to help users detect activity
(similar to the /$INBOX/ topic view).
New configuration options:
* publicinbox.wwwlisting - configure the listing type
* publicinbox.<name>.hide - hide a particular inbox from the listing
See changes to public-inbox-config.pod for full descriptions
of the new options.
Eric Wong [Wed, 17 Apr 2019 22:05:38 +0000 (22:05 +0000)]
start depending on Perl 5.10.1+
I mainly want to start using the '//' (defined-or) operator to
simplify code, and Perl 5.10.1 is roughly a decade old at this
point.
"given/when" would've be nice, but it's future is in doubt AFAIK.
I also started using the 'parent' module in WwwHighlight, and
'autodie' in UserContent.pm, both of which were only distributed
with Perl since 5.10.1; and testing with ancient
versions/distros is time-consuming.
Anyways, I think this a small-enough jump to not break any
existing installations, given we already depend on fairly
recent versions of git and Xapian.
Maybe we can use more newish Perl features in the future...
Eric Wong [Thu, 18 Apr 2019 00:58:06 +0000 (00:58 +0000)]
inbox: add `modified' sub
For inboxes with SQLite enabled (all v2, and probably most v1);
we can use the overview DB to get the timestamp of the latest
message. It's faster than scanning git branches for commit times,
but not always the same.
Eric Wong [Wed, 17 Apr 2019 10:49:15 +0000 (10:49 +0000)]
git: calculate modified time of repository
This will be used for generating an HTML listing for v1 inboxes,
at least. The logic for this follows that of grokmirror,
and we may dynamically generate manifest.js.gz natively...
Eric Wong [Mon, 15 Apr 2019 07:32:49 +0000 (07:32 +0000)]
HACKING: stop advertising mailing list subscription info
It's still available, but no point in advertising something
which increases the dependency on a centralized subscriber list.
In fact, it's actively against the goal of promoting resistance
against centralization.
Eric Wong [Tue, 16 Apr 2019 01:10:09 +0000 (01:10 +0000)]
cleanup: use '$ibx' consistently when referring to Inbox refs
'$inbox' is more human-readable, so that is for the more
human-readable name in most cases. Making our variable naming
more consistent should make the code easier-to-review and
harder to screw up.
Eric Wong [Fri, 5 Apr 2019 20:04:27 +0000 (20:04 +0000)]
config: support more cgit directives for project lists
Hopefully this gets us closer to matching cgit upstream behavior
(which also lacks tests). We'll still need to support macro
expansion at some point for compatibility...
Eric Wong [Fri, 5 Apr 2019 20:04:26 +0000 (20:04 +0000)]
cgit: serve static css, logo, favicon directly
We can reduce the configuration needed to run cgit by reusing
the static file handling logic of the dumb git HTTP protocol.
I hate logos and icons, so don't expect public-inbox.org or
80x24.org to ever have those to waste users' bandwidth with :P
But I expect other users to find this useful.
Eric Wong [Sun, 10 Mar 2019 22:02:29 +0000 (22:02 +0000)]
cgit: support running cgit as a standalone CGI
We depend on git-http-backend for smart HTTP clone support,
however; since cgit does not support smart clones natively.
WWW.pm will be able to cascade down to this as a 404 handler in
the future.
Eric Wong [Sun, 10 Mar 2019 07:51:45 +0000 (07:51 +0000)]
githttpbackend: move more psgi.input handling into subroutine
This will be useful for other CGI wrappers we make.
This also fixes a bug with some PSGI servers which did not
present a real IO::Handle in the psgi.input env field.
Eric Wong [Mon, 25 Feb 2019 05:14:10 +0000 (05:14 +0000)]
spawn: support RLIMIT_CPU, RLIMIT_DATA and RLIMIT_CORE
We'll be spawning cgit and git-diff, which can take gigantic
amounts of CPU time and/or heap given the right (ermm... wrong)
input. Limit the damage that large/expensive diffs can cause.
Eric Wong [Thu, 14 Feb 2019 02:29:10 +0000 (02:29 +0000)]
viewvcs: preliminary support for showing non-blobs
Eventually, we'll have special displays for various git objects
(commit, tree, tag). But for now, we'll just use git-show
to spew whatever comes from git.
Eric Wong [Fri, 8 Mar 2019 22:52:17 +0000 (22:52 +0000)]
v2writable: index_sync adds new epochs to alternates
Newly-cloned epochs need to be in alternates file of
all.git for the web and NNTP interfaces to work. So
allow invocations of "public-inbox-index" to idempotently
ensure the epoch is visible from the all.git repo.
Eric Wong [Wed, 27 Feb 2019 20:25:36 +0000 (20:25 +0000)]
v2writable: fix epoch rollover on incremental imports
All of our internal epoch rollover calculations are done using
the estimated unpacked (and uncompressed) size of the repo. The
importer instance needs to check that unpacked size before
selecting an epoch when an epoch already has packed data.
This bug did not impact the initial mass imports since we only
initialize the Import instance once-per-epoch and did not need
to take existing epochs into account.
Tested manually with -mda on a local clone of LKML
Reported-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Eric Wong [Wed, 13 Feb 2019 22:44:42 +0000 (22:44 +0000)]
ensure bytes::length is available to callers
We were relying on Danga::Socket using the "bytes" pragma,
previously. Nowadays, the "bytes" pragma is not recommended in
general, but bytes::length remains acceptable for getting the
byte-size of a scalar.
Plack::Builder allows "mounting" on with hostnames as well as
path names to enable virtual hosting. This example demonstrates
how port 80/443 for "news.example.com" can redirect browser
requests when somebody attempts to use a "nntp://" URL and
the software assumes "http://"
Eric Wong [Tue, 5 Feb 2019 22:24:19 +0000 (22:24 +0000)]
Merge remote-tracking branch 'origin/help-color'
* origin/help-color:
wwwtext: inline sample CSS and use highlight
hlmod: support "```$LANG" blocks in text
hlmod: do_hl* performs src_escape immediately
hlmod: make into a singleton
hlmod: hoist out do_hl_lang sub
viewvcs: cleanup utf8 handling
Eric Wong [Tue, 5 Feb 2019 21:33:16 +0000 (21:33 +0000)]
solvergit: include the $oid_want tmpdir name
This can help admins diagnose problems with SolverGit, since
qspawn logs the failed "git apply" command-line in stderr.
(or it can waste admins' time because sometimes there's crap
mail clients which mangle patches)
Eric Wong [Tue, 5 Feb 2019 11:25:11 +0000 (11:25 +0000)]
TODO: add item for "scraper" importers
The git-users mailing list is on Google Groups with obfuscated
addresses and censored archives. We should allow users to
import them soon, as obfuscated/censored archives are better
than not having archives at all when Google decides to shut down
yet-another-service.
There's also some mangling that (most) instances of Mailman do
(e.g. cgit), but being able to follow such groups over NNTP
and use our search functionality is still useful and better
than what typical Mailman installations provide.
Eric Wong [Tue, 5 Feb 2019 05:28:03 +0000 (05:28 +0000)]
wwwtext: inline sample CSS and use highlight
For user documentation regarding CSS; showing users the sample
CSS with comments is probably more helpful than having
standalone documentation on CSS classes.
Eric Wong [Tue, 5 Feb 2019 05:24:39 +0000 (05:24 +0000)]
hlmod: support "```$LANG" blocks in text
This is compatible with Markdown; but we still keep the WYSIWYG
nature of plain-text with this. This is only intended for use
with our documentation. Enabling any type of Markdown support
for emails can lead to incompatibilities or interopability
problems with alternative implementations.
Eric Wong [Sat, 2 Feb 2019 06:02:41 +0000 (06:02 +0000)]
hlmod: hoist out do_hl_lang sub
We'll want to use to support highlighting syntax used by
Markdown and possibly other markup languages (while retaining
the raw plain-text layout and formatting).
Eric Wong [Fri, 1 Feb 2019 22:12:52 +0000 (22:12 +0000)]
viewvcs: cleanup utf8 handling
Favor in-place utf8::decode since it's a bit faster without
method dispatch overhead; and don't care about validity just
yet.
HlMod->do_hl itself should return "utf8" strings, since other
parts of our code can use it, so it's not the job of ViewVCS to
post-process HlMod output.
Eric Wong [Wed, 9 Jan 2019 11:43:27 +0000 (11:43 +0000)]
newswww: add /$MESSAGE_ID global redirector endpoint
This is the fallback for the normal WWW endpoint.
Adding this to the top-level seems to be alright, since lynx and
w3m both understand nntp://<HOSTNAME>/<Message-ID> anyways.
If newsgroup and inbox names conflict, then consider it the
fault of the original sender.
Since NewsWWW is intended to support buggy linkifiers in mail clients,
they can interpret nntp:// URLs as http://<HOSTNAME>/<Message-ID>
Inbox ordering from the config file is preserved since
commit cfa8ff7c256e20f3240aed5f98d155c019788e3b
("config: each_inbox iteration preserves config order"),
so admins can rely on that to configure how scanning
works.
Requested-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
cf. https://public-inbox.org/meta/20190107190719.GE9442@pure.paranoia.local/
nntp://news.public-inbox.org/20190107190719.GE9442@pure.paranoia.local
Eric Wong [Fri, 1 Feb 2019 07:36:02 +0000 (07:36 +0000)]
viewdiff: support renames and long paths in diffstat anchors
This is best-effort, but works well-enough in practice for
projects which use shell-friendly filenames as well as the
long path names for some Linux kernel selftests.
Eric Wong [Fri, 1 Feb 2019 03:06:47 +0000 (03:06 +0000)]
view: simplify quote splitting
Perl "split" can capture and group in the regexp itself,
so rely on that to shorten our code.
Comparing the /T/ HTML output of a thread from hell (on LKML with
1356 messages) reveals no difference in the rendered result.
Only the HTML source differs in newline placement before/after
the closing </span>
This allows a minor speedup on my X32 Thinkpad @ 1.6GHz with
the aforementioned LKML thread from hell:
Eric Wong [Thu, 31 Jan 2019 10:45:55 +0000 (10:45 +0000)]
viewdiff: diffstat links to diff anchors
This can be helpful for reviewing larger patches which span
across several files on the permalink (/$MESSAGE_ID/) HTML
page.
More work will be needed to get this working for the /T/ and /t/
pages which show multiple emails, as the filename-based anchors
will conflict at the moment.
Eric Wong [Thu, 31 Jan 2019 08:52:49 +0000 (08:52 +0000)]
doc/config: user documentation for limiters
I've relied on this feature to keep the VPS behind
https://public-inbox.org/git/ from OOM-ing since 2016,
so document it to ensure others can make use of low-end
servers like I do.
More limiters may become configurable for viewvcs and
solver functionality (or we continue using the default
one).
Eric Wong [Thu, 31 Jan 2019 04:10:29 +0000 (04:10 +0000)]
viewvcs: support streaming large blobs
Forking off git-cat-file here for streaming large blobs is
reasonably efficient, at least no worse than using
git-http-backend for serving clones. So let our limiter
framework deal with it.
git itself isn't great for large files, and AFAIK there's no
stable/widely-available mechanisms for reading smaller chunks
of giant blobs in git itself.
Tested with some giant GPU headers in the Linux kernel.