Eric Wong [Fri, 24 Jan 2020 09:43:49 +0000 (09:43 +0000)]
http: eliminate short-lived cyclic ref for psgix.io
While there is no known actual leak due to reference cycles,
here, eliminating a potential source of leaks is helpful.
Eric Wong [Fri, 24 Jan 2020 22:09:33 +0000 (22:09 +0000)]
spelling: favor `publicly' over `publically'
While both can be correct, the former seems more common,
is shorter, and is also consistent with the spelling found
in the AGPL-3.0 text.
Eric Wong [Fri, 24 Jan 2020 22:09:32 +0000 (22:09 +0000)]
website: omit technical/ and other subdirs
We don't need to clutter the website with unnecessary technical
information. Anybody who reads the technical/ directory should
be looking at our source code, anyways; and we also have cgit
and gitweb mirrors.
Eric Wong [Fri, 24 Jan 2020 22:09:31 +0000 (22:09 +0000)]
doc: INSTALL describe required deps for released versions
1.3.0 isn't out, yet, and sometimes folks will rely on
INSTALL on our website while installing older versions,
so try to clarify that.
Eric Wong [Fri, 24 Jan 2020 22:09:30 +0000 (22:09 +0000)]
website: re-add top-level files
I noticed the TODO was out-of-date on the website, among some
other things. This was broken in moving GNU-isms in the
Makefile to Perl.
Eric Wong [Fri, 24 Jan 2020 22:09:29 +0000 (22:09 +0000)]
doc: avoid needless rebuilds of NEWS
Repeatedly rebuilding `NEWS' because the mtime of `NEWS'
is synched to the latest release .eml is a bit annoying,
but necessary to save bandwidth for the website.
So we'll also update the mtime of the source .eml file when
reading them. It's kinda gross to be setting mtimes of source
.eml files in Documentation/RelNotes/, but I can't think of
anything better at the moment...
Eric Wong [Sat, 25 Jan 2020 02:47:08 +0000 (02:47 +0000)]
mbox: handle empty subjects after dropping "Re:" prefix
We can't pass empty strings to `to_filename' without
triggering warnings, and `to_filename' on an empty string
makes no sense.
Eric Wong [Thu, 23 Jan 2020 23:05:59 +0000 (23:05 +0000)]
contentid: ignore duplicate References: headers
OverIdx::parse_references already skips duplicate
References (which we use in SearchThread for rendering).
So there's no reason for our content deduplication logic
to care if a Message-Id in the Reference header is mentioned
twice.
Eric Wong [Thu, 23 Jan 2020 23:05:58 +0000 (23:05 +0000)]
wwwstream: shorten cloneurl uniquification
Another place where List::Scalar::uniq doesn't make sense,
but there's a small op reduction to be had anyways.
Eric Wong [Thu, 23 Jan 2020 23:05:57 +0000 (23:05 +0000)]
mid: shorten uniq_mids logic
We won't be able to use List::Util::uniq here, but we can still
shorten our logic and make it more consistent with the rest of
our code which does similar things.
Eric Wong [Thu, 23 Jan 2020 23:05:56 +0000 (23:05 +0000)]
inbox: simplify filtering for duplicate NNTP URLs
And add a note to remind ourselves to use List::Util::uniq
when it becomes common.
Eric Wong [Thu, 23 Jan 2020 23:05:55 +0000 (23:05 +0000)]
nntp: simplify setting X-Alt-Message-ID
We can cut down on the number of operations required
using "grep" instead of "foreach".
Eric Wong [Thu, 23 Jan 2020 23:05:54 +0000 (23:05 +0000)]
contentid: use map to generate %seen for Message-Ids
This use of map {} is a common idiom as we no longer consider
the Message-ID as part of the digest.
Eric Wong [Sun, 19 Jan 2020 09:40:52 +0000 (09:40 +0000)]
hval: from_attr: move to unit test
We don't call from_attr anywhere outside of tests, so don't
bloat normal processes with it.
Eric Wong [Sun, 19 Jan 2020 09:40:51 +0000 (09:40 +0000)]
hval: to_attr: support wide characters
We need to escape wide characters when making attribute names from
filename-looking things in diffstats.
Eric Wong [Tue, 14 Jan 2020 07:56:26 +0000 (07:56 +0000)]
doc: some 1.3.0 release notes updates
Eric Wong [Sun, 12 Jan 2020 21:17:56 +0000 (21:17 +0000)]
sigfd: simplify loop and improve documentation
We can use the return value of sysread to bound our loop instead
of repeatedly shortening the string. Furthermore add some
comments which can be easily checked against the signalfd(2)
manpage.
Eric Wong [Sun, 12 Jan 2020 21:17:55 +0000 (21:17 +0000)]
ds: flatten $EXPMAP, delete entries on close
We can reduce the amount of small arrayrefs in memory
by flattening $EXPMAP. This forces us to properly clean
up references during deferred close handling, so NNTP
(and soon HTTP) connections no longer linger until expiry.
Eric Wong [Sun, 12 Jan 2020 21:17:54 +0000 (21:17 +0000)]
ds: rely on autovivification for $later_queue
No reason to have an empty arrayref lying around when not
everybody needs it.
Re-indent the later-related subs since we're changing a
bunch of lines, anyways.
Eric Wong [Sun, 12 Jan 2020 21:17:53 +0000 (21:17 +0000)]
ds: rely on autovivication for waitpid bits
No need to create an arrayref until we need it, and fix up a
comment while we're in the area. Some aesthetic changes while
we're at it:
- Rename $WaitPids to $wait_pids to make it clear this is
unique to our implementation and not in Danga::Socket.
- rewrite dwaitpid() to reduce indentation level
Eric Wong [Sun, 12 Jan 2020 21:17:52 +0000 (21:17 +0000)]
ds: rely on autovivification for nextq
Another place we can delay creating arrays until needed.
Eric Wong [Sun, 12 Jan 2020 21:17:51 +0000 (21:17 +0000)]
ds|http|nntp: simplify {wbuf} population
We can rely on autovification to turn `undef' value of {wbuf}
into an arrayref.
Furthermore, "push" returns the (new) size of the array since at
least Perl 5.0 (I didn't look further back), so we can use that
return value instead of calling "scalar" again.
Eric Wong [Sun, 12 Jan 2020 21:17:50 +0000 (21:17 +0000)]
ds: guard ToClose against DESTROY side-effects
This does not affect our current code, but theoretically a
DESTROY callback could call PublicInbox::DS::close to enqueue
elements into the ToClose array. So take a similar strategy as
we do with other queues (e.g. $nextq) by swapping references to
arrays, rather than operating on the array itself.
Since close operations are relatively rare, we can rely on
auto-vivification via "push" ops to create the array on an
as-needed basis.
Since we're in the area, clean up the PostLoopCallback
invocation to use the ternary operator rather than a confusing
(to me) combination of statements.
Finally, add a prototype to strengthen compile-time checking,
and move it in front of our only caller to make use of
the prototype.
Eric Wong [Sun, 12 Jan 2020 21:17:49 +0000 (21:17 +0000)]
ds: remove Timer->cancel and Timer class+bless
It doesn't seem needed at the moment, and we can re-add it
in the future if needed.
Eric Wong [Sun, 12 Jan 2020 21:17:48 +0000 (21:17 +0000)]
ds: add an in_loop() function for Inbox.pm use
Inbox.pm accessing the $in_loop variable directly raises
warnings when Inbox is loaded without DS.
Eric Wong [Sun, 12 Jan 2020 21:17:47 +0000 (21:17 +0000)]
ds: add_timer: rename from AddTimer, remove a parameter
The class parameter is pointless, especially for an internal
sub which only has one external caller in a test. Add a sub
prototype while we're at it to get some compile time checking.
Eric Wong [Sun, 12 Jan 2020 21:17:46 +0000 (21:17 +0000)]
ds: new: avoid redundant check, make clobbering fatal
"fileno(undef)" already dies under "use strict", so there's no
need to check for it ourselves. As far as "fileno($closed_io)"
or "fileno($fake_io)" goes, we'll let epoll_ctl detect the
error, instead.
Our design should make DescriptorMap entries impossible to clobber,
so make it fatal via confess in case it does happen, because
inadvertantly clobbering a FD would be very bad. While we're at
it, remove a redundant return statement and rely on implicit
returns.
Eric Wong [Sat, 11 Jan 2020 22:35:03 +0000 (22:35 +0000)]
use popen_rd for bidirectional pipes
popen_rd accepts arbitrary redirects, so we can reuse its
code to setup the pipe end we want to read, saving each
caller a few lines of code compared to calling pipe+spawn.
Eric Wong [Sat, 11 Jan 2020 22:35:02 +0000 (22:35 +0000)]
t/solver_git: avoid uninitialized warnings in hostname generation
Outside of tests, this is only relevant for non-PSGI use, which
may happen someday...
Fixes: cb1c874520153f5c ("inbox: use PublicInbox::Git::host_prefix_url for base_url")
Eric Wong [Sat, 11 Jan 2020 22:35:01 +0000 (22:35 +0000)]
xt/git_async_cmp: do not slurp large OID list into memory
I somehow thought "foreach (<$cat>)" could work like
"while (<$cat>)" when it came to iterating over file
handles...
Eric Wong [Sat, 11 Jan 2020 22:35:00 +0000 (22:35 +0000)]
xapcmd: use popen_rd for running xapian-compact
public-inbox-compact wrapper displays progress by default,
anyways, and there's not a lot of output, so simplify our
code by using popen_rd instead of spawn + optional pipe.
While we're at it use "while (<HANDLE>)" to display
progress as it happens, since "foreach (<$HANDLE>)"
slurps the contents into an array, first.
Eric Wong [Sat, 11 Jan 2020 22:34:59 +0000 (22:34 +0000)]
cgit: drop cgit_parse_hdr wrapper
Unlike PublicInbox::GitHTTPBackend::git_parse_hdr,
cgit_parse_hdr does nothing interesting besides calling
parse_cgi_headers. So just make a reference to
PublicInbox::GitHTTPBackend::parse_cgi_headers and call it.
Eric Wong [Sat, 11 Jan 2020 22:34:58 +0000 (22:34 +0000)]
solver: path_a may be undef from /dev/null
This avoids uninitialized variable warnings when viewing
newly-created files.
Eric Wong [Sat, 11 Jan 2020 22:34:57 +0000 (22:34 +0000)]
git: packed_bytes: use GLOB_NOSORT
File::Glob is loaded by the perl for the "glob()" op, anyways,
so call bsd_glob with the GLOB_NOSORT to avoid needless sorting
of the output.
Eric Wong [Sat, 11 Jan 2020 22:34:56 +0000 (22:34 +0000)]
git: modified: don't slurp `rev-parse --branches'
While v1 inboxes typically only have one branch, code repositories
may have dozens or even hundreds. Slurping those into memory is
a waste.
Eric Wong [Sat, 11 Jan 2020 22:34:55 +0000 (22:34 +0000)]
config: do not slurp entire cgitrc at once
cgitrc files can have hundreds or thousands of lines in them and
slurping them into memory is a waste. "while (<$fh>)" only
reads one line at a time, whereas "for (<$fh>)" reads the entire
contents of the file into a temporary array.
Eric Wong [Fri, 10 Jan 2020 22:55:30 +0000 (22:55 +0000)]
examples/unsubscribe.milter: support unique mailto:
Instead of providing a generic "mailto:foo+unsubscribe@example.com"
address in List-Unsubscribe which requires confirmation, replace it
with a mailto: header with a unique subject which contains the same
unique ID we put in the https:// URL.
This makes it easier for some MUAs without https:// support to
unsubscribe with a single action via the List-Unsubscribe header.
Eric Wong [Fri, 10 Jan 2020 22:55:29 +0000 (22:55 +0000)]
examples/unsubscribe.milter: skip gmane-mx
Mail to gmane is being delivered to gmane-mx.org, nowadays, and
we don't want ordinary readers to be able to trigger unconfirmed
unsubscription off any mailing lists which go through our
unsubscribe.milter.
https://lars.ingebrigtsen.no/2020/01/06/whatever-happened-to-news-gmane-org/
Eric Wong [Sat, 11 Jan 2020 06:28:16 +0000 (06:28 +0000)]
www: discard multipart parent on iteration
We're often iterating through messages while writing to another
buffer in our WWW interface, causing memory usage to multiply.
Since we know we won't need to keep the MIME object around in
some cases, and can tell msg_iter to clobber the on-stack
variable while it operates on subparts of multipart messages.
With xt/mem-msgview.t switched to multipart from the previous
commit, this shows a 13 MB memory reduction on that test.
Eric Wong [Sat, 11 Jan 2020 06:28:15 +0000 (06:28 +0000)]
xt/mem-msgview.t: change to test one multipart message
A single multipart message is far more common than
a reused Message-ID, so rewrite the test to only have
a single multipart message. Memory improvements will
be implemented in the next commit.
Eric Wong [Fri, 10 Jan 2020 08:49:32 +0000 (08:49 +0000)]
make Filesys::Notify::Simple optional
It's only used by us in public-inbox-watch, and maybe not
for long. It's in most installations because Plack pulls it
in though, but Plack is no longer required.
Eric Wong [Fri, 10 Jan 2020 08:49:31 +0000 (08:49 +0000)]
make Plack optional for non-WWW and non-httpd users
Some users just want to run -mda, -watch, and/or -nntpd.
Let them run just those without forcing them to pull in a
bunch of dependencies.
Eric Wong [Fri, 10 Jan 2020 20:35:33 +0000 (20:35 +0000)]
doc: technical/ds.txt: describe PublicInbox::DS divergences
Danga::Socket 1.62 was released a few months back and
the maintainer indicated it would be the last release.
We've diverged significantly in incompatible ways...
While most of this should've already been documented in
commit messages, putting it all into one document could
make it easier-to-digest.
It's also a strange design for anybody used to conventional
event loops. Maybe this is an unconventional project :P
Eric Wong [Fri, 10 Jan 2020 09:14:19 +0000 (09:14 +0000)]
spawn (and thus popen_rd) die on failure
Most spawn and popen_rd callers die on failure to spawn,
anyways, and some are missing checks entirely. This saves
us a bunch of verbose error-checking code in callers.
This also makes popen_rd more consistent, since it already
dies on pipe creation failures.
Eric Wong [Fri, 10 Jan 2020 09:14:18 +0000 (09:14 +0000)]
git: remove ->commit_title method
We haven't used it in SolverGit, yet, and I'll be reworking it
to work with ->cat_async, instead.
Eric Wong [Fri, 10 Jan 2020 09:14:17 +0000 (09:14 +0000)]
git: ->modified uses cat_async
While v1 inboxes are typically only a single branch, coderepos
will have many branches and being able to pipeline requests
to "git cat-file --batch" can help us mask seek times.
Eric Wong [Fri, 10 Jan 2020 09:14:16 +0000 (09:14 +0000)]
allow HTTP_HOST to be '0' via defined() checks
'0' is a valid value for HTTP_HOST, and maybe some folks
will want to hit that as port 80 where the HTTP client won't
send the ":$PORT" suffix.
Eric Wong [Fri, 10 Jan 2020 09:14:15 +0000 (09:14 +0000)]
inbox: use PublicInbox::Git::host_prefix_url for base_url
Better not to duplicate the same logic across different classes.
Also, our git wrapper class is a strange place for
host_prefix_url, but it needs to be usable for coderepos, so
it's there, for now...
Eric Wong [Thu, 9 Jan 2020 11:14:52 +0000 (11:14 +0000)]
qspawn: catch transient errors on pipe, EPOLL_CTL_ADD
popen_rd dies on pipe()/pipe2() failure due to FD exhaustion.
EPOLL_CTL_ADD (via PublicInbox::HTTPD::Async->new) may also fail
due to memory exhaustion or exceeding the value of
/proc/sys/fs/epoll/max_user_watches
Eric Wong [Thu, 9 Jan 2020 11:14:51 +0000 (11:14 +0000)]
http: log response_write errors
Application-supplied callbacks may error out, try to log them
so the PSGI app developer can figure out what went wrong.
Eric Wong [Thu, 9 Jan 2020 11:14:50 +0000 (11:14 +0000)]
listener: EPOLL_CTL_ADD errors are non fatal
EPOLL_CTL_ADD may fail with transient ENOMEM or ENOSPC errors,
so don't tear down the process when that happens.
Eric Wong [Wed, 8 Jan 2020 10:44:09 +0000 (10:44 +0000)]
nntp: correctly log long response errors
We cannot safely call "fileno(undef)" without bringing down the
entire -nntpd process :x. To ensure no logging regression, we
now stash the FD for the duration of the long response to ensure
the error can be matched to the original command in logs.
Fixes: 207b89615a1a0c06 ("nntp: remove cyclic refs from long_response")
Eric Wong [Wed, 8 Jan 2020 10:44:08 +0000 (10:44 +0000)]
daemon: ignore SIGPIPE while running
This is only needed for IO::Poll users, since users with
(signalfd || EVFILT_SIGNAL) support run with SIGPIPE (and
all other signals) blocked.
Fixes: 81a9a43fb858d197 ("daemon: use sigprocmask to block signals at startup")
Eric Wong [Sun, 5 Jan 2020 23:23:36 +0000 (23:23 +0000)]
syscall: modernize away from pre-Perl-5.6 conventions
"use vars" was superseded by "our" in Perl 5.6, and we
can "use parent qw(Exporter)" in favor of manipulating
@ISA directly (or the bigger "use base ...");
While we're at it, avoid multiple invocations of constant->import
by passing a hashref as a "use" parameter.
Eric Wong [Sun, 5 Jan 2020 23:23:35 +0000 (23:23 +0000)]
treewide: "require" + "use" cleanup and docs
There's a bunch of leftover "require" and "use" statements we no
longer need and can get rid of, along with some excessive
imports via "use".
IO::Handle usage isn't always obvious, so add comments
describing why a package loads it. Along the same lines,
document the tmpdir support as the reason we depend on
File::Temp 0.19, even though every Perl 5.10.1+ user has it.
While we're at it, favor "use" over "require", since it it gives
us extra compile-time checking.
Eric Wong [Sun, 5 Jan 2020 23:23:34 +0000 (23:23 +0000)]
admin: do not lazy-load Inbox or Config packages
No point in lazy-loading these, since they're always loaded
anyways and would not have portability problems on systems with
minimal dependencies.
Eric Wong [Sun, 5 Jan 2020 23:23:33 +0000 (23:23 +0000)]
altid: use msgmap at compile time
AltId requires Msgmap to work, which requires SQLite. Search
also requires SQLite3 (for Over), nowadays, so there's no reason
for us to lazy-load Msgmap and SQLite anymore.
Eric Wong [Sun, 5 Jan 2020 23:23:32 +0000 (23:23 +0000)]
view: update POSIX::strftime usage
The POSIX module is always loaded, so import `strftime' into the
namespace so we can use it and take advantage of compile-time
arg checking. While we're at it, update and reorder caller
functions to use prototypes, too.
Eric Wong [Sun, 5 Jan 2020 23:23:31 +0000 (23:23 +0000)]
hval: export prurl and add prototype
This allows to do some compile-time checking and fills in a
missing "use" in PublicInbox::NewsWWW, allowing it to be used
standalone and independently of PublicInbox::WWW
Eric Wong [Mon, 6 Jan 2020 04:47:52 +0000 (22:47 -0600)]
t/nntp.t: fix parse_time test for non-GMT local time
Yes, there's actually other timezones!
Eric Wong [Mon, 6 Jan 2020 05:31:07 +0000 (05:31 +0000)]
wwwstatic: use sprintf for Perl <5.22 compatibility
We only declare a Perl 5.10.1+ requirement, and POSIX::lround
was not added until 5.21.4 (5.22.0 for stable releases).
Eric Wong [Sun, 5 Jan 2020 09:51:16 +0000 (09:51 +0000)]
view: msg_html: reduce memory use on reused MIDs
In rare cases where Message-IDs get reused, we do not want to
hold onto the large Email::MIME objects in memory after showing
the first message. So discard each message as soon as we're
done using it so we can save memory for the next message.
The new and expensive xt/mem-msgview.t test shows a nearly 14MB
reduction for two ~7MB messages. run_script() also gets
upgraded to make it easier to pass large inputs via IO GLOBs.
Eric Wong [Sat, 4 Jan 2020 22:54:00 +0000 (22:54 +0000)]
tests: remove some "git config" calls after "git init"
Creating a hash and iterating through it just to run "git
config" is ugly and slow. Just write out the text file in a
human-friendly way since the git-config file format is stable
and won't break randomly.
Eric Wong [Sat, 4 Jan 2020 22:14:22 +0000 (22:14 +0000)]
search: remove lookup_article
It was no longer used outside of tests, so don't penalize
regular users with the extra function. Just inline it for
t/search.t.
Eric Wong [Sat, 4 Jan 2020 21:37:52 +0000 (21:37 +0000)]
tests: fix running without SQLite or Xapian
PublicInbox::Search always loads DBD::SQLite, so we
can't blindly "use" it in t/xcpdb-reshard.t. We also
need to account for that in TestCommon.
Eric Wong [Sat, 4 Jan 2020 09:16:21 +0000 (09:16 +0000)]
viewdiff: do not anchor spaces after filenames in diffstat
Viewing a CSS-less page in a browser which underlines links
can show a long line of underscores after diffstats. Not all
browsers underline links by default, though.
Eric Wong [Fri, 3 Jan 2020 08:46:03 +0000 (08:46 +0000)]
searchidx: remove_message: pedantic fix for v1
It shouldn't be possible for v1 inboxes to have multiple matches
for a given Message-ID, so the sub would only get called once,
but strange things could happen in 2112 :>
Eric Wong [Fri, 3 Jan 2020 08:46:02 +0000 (08:46 +0000)]
searchidx: index_text: use Xapian parameter names
Use the parameter names from the Search::Xapian::TermGenerator
manpage for our local variables instead of confusing names...
Eric Wong [Fri, 3 Jan 2020 08:46:01 +0000 (08:46 +0000)]
searchidx: simplify quote-splitting in index_body
We now use the same regexp View::add_text_body uses.
Eric Wong [Fri, 3 Jan 2020 08:46:00 +0000 (08:46 +0000)]
searchidx: add_message: fix and make use of prototypes
Procedural function calls allow prototype checking, and
our add_message prototype was totally wrong to begin with.
Convert most of the "$self->index_*" calls to "index_*($self"
While we're at it, use "//=" to avoid some "unless" statements.
Eric Wong [Fri, 3 Jan 2020 08:45:59 +0000 (08:45 +0000)]
searchidx: split off index_xapian for msg_iter
This ought to save some memory, but it's probably lost in the
noise given the cost of indexing. Regardless it still reduces
the indentation level and makes future changes easier to read.
Eric Wong [Fri, 3 Jan 2020 08:45:58 +0000 (08:45 +0000)]
searchidx: index_diff: allow /^$/ line as diff context
As discovered by solver bug hunting, "git apply" also handles
the case where blank lines w/o leading space are treated as diff
context, apparently because GNU diff once did it:
https://public-inbox.org/git/
b507b465f7831612b9d9fc643e3e5218b64e5bfa/s/
Eric Wong [Sat, 4 Jan 2020 04:19:33 +0000 (04:19 +0000)]
solver: allow literal '\r' character in diff lines
While filenames are escaped, the actual diff contents may
contain an unescaped "\r" carriage return byte not in front
of the "\n" line feed. So just allow "\r" to appear in the
middle of a line.
Eric Wong [Sat, 4 Jan 2020 03:34:15 +0000 (03:34 +0000)]
solver: minor cleanups to diff extraction
Initialize the $di hashref at use to make it more obvious it's
a local variable. We can also use the :utf8 IO layer via
open+print to save ourselves the trouble of converting the UTF-8
patch to an octet stream.
Eric Wong [Sat, 4 Jan 2020 03:34:14 +0000 (03:34 +0000)]
solver: do not enforce order on extended headers
This is needed to work with patches with many renames,
such as what makes "git/
eebf7a8/s/?b=t%2Ftest-lib.sh"
Eric Wong [Sat, 4 Jan 2020 03:34:13 +0000 (03:34 +0000)]
xt/solver.t: real-world regression tests
There's a lot of test cases which we should probably
make self-contained at some point, but right now it's
easier to just mark them off in a maintainer test.
Eric Wong [Thu, 2 Jan 2020 09:24:59 +0000 (09:24 +0000)]
qspawn: use per-call quiet flag for solver
solver can spawn multiple processes per HTTP request, but
"git apply" failures are needlessly noisy due to corrupt
patches. We also don't want to silence "git ls-files"
or "git update-index" errors using $env->{'qspawn.quiet'},
either, so this granularity is needed.
Admins can check for 500 errors in access logs to detect
(and reproduce) solver failures, anyways, so there's no
need to log every time "git apply" rejects a corrupt patch.
Eric Wong [Fri, 3 Jan 2020 00:56:05 +0000 (00:56 +0000)]
solver: extract_diff: deal with missing "diff --git" line
Rewrite the patch extraction loop using a single regexp which
accounts for missing "diff --git ..." lines and is capable of
extracting pathnames off the "+++ b/foo" line.
This fixes the solving of blob "
96f1c7f" off
<
2841d2de-32ad-eae8-6039-
9251a40bb00e@tngtech.com>
in git@vger archives.
v2:
* Fix regressions in git@vger archives:
- git/
776fa90f7f/s/?b=contrib/git-jump/git-jump
(fallback to "old mode" properly)
- git/
5cd8845/s/?b=submodule.c
(no leading space in context)
* use "state" in a Perl <5.28.0-compatible way
Eric Wong [Thu, 2 Jan 2020 09:24:57 +0000 (09:24 +0000)]
solver: try the next patch on apply failures
Sometimes a patch is corrupted and resent to create the same
OID. We need to account for that case and actually move onto
the next patch instead of blindly trying "git ls-files" to get
nothing out of it.
Eric Wong [Thu, 2 Jan 2020 23:29:28 +0000 (23:29 +0000)]
build: allow "check" to work in non-git subdirs of worktrees
Some people will place the contents of an unpacked tarball
inside another directory controlled by git (e.g. a ports tree
or even git-versioned home directory). "git ls-files" will
succeed in those cases, so we must check for the existence
of a ".git" dir, instead.
Eric Wong [Thu, 2 Jan 2020 20:09:39 +0000 (20:09 +0000)]
examples: add empty "lib" dir to placate plackup
This is necessary for Filesys::Notify::Simple 0.13 using
Linux::Inotify2, since 0.13 started croaking on
inotify_add_watch failures.
Eric Wong [Thu, 2 Jan 2020 03:09:30 +0000 (03:09 +0000)]
config: support multi-value inbox.*.*url
Since the beginning of this project, we've implicitly supported
inboxes with multiple URLs by relying on the Host: header sent
by the client ($env->{HTTP_HOST}).
We now offer the option to explicitly configure multiple URLs for
every inbox along with the ability to do a best-effort match for
matching hostnames.
Eric Wong [Thu, 2 Jan 2020 03:09:29 +0000 (03:09 +0000)]
wwwlisting: show configured "infourl" properly
git's config file keys lack underscores, but my mind is wired
for underscores :x. Fix the whitespace around the info URL
while we're at it, so that it shows up right under the inbox
description.
Eric Wong [Wed, 1 Jan 2020 09:57:55 +0000 (09:57 +0000)]
doc: fix a few spelling errors in user-facing docs
Found by codespell, there's a few more in comments and some
debatable ones, but user-facing stuff is more important.
Eric Wong [Wed, 1 Jan 2020 09:57:54 +0000 (09:57 +0000)]
build: fix xapian-* manpage generation
extman.perl requires the name of its target
Eric Wong [Wed, 1 Jan 2020 09:57:53 +0000 (09:57 +0000)]
doc/txt2pre: flush output before utime()
Otherwise our utime() change is overridden when the flush
happens at exit.
Eric Wong [Wed, 1 Jan 2020 09:57:52 +0000 (09:57 +0000)]
doc: release notes: set Date for 1.2.0, start 1.3.0
Seems like a lot's happened since 1.2, but it's mostly
internal stuff...
Eric Wong [Wed, 1 Jan 2020 09:57:51 +0000 (09:57 +0000)]
build: remove NEWS from dist-git target
mknews doesn't require any optional dependencies a user wouldn't
normally have. We can save storage and bandwidth costs by
letting cgit serve the exact tar.gz which "git archive | gzip -n"
generates.
Eric Wong [Wed, 1 Jan 2020 09:57:50 +0000 (09:57 +0000)]
doc: allow NEWS file to be built without Plack::Util
Plack pulls in a lot of dependencies which can be time-consuming
to install. It should not be necessary for somebody who just
wants to run -mda/-watch and -nntpd and forego WWW.
Eric Wong [Wed, 1 Jan 2020 10:38:59 +0000 (10:38 +0000)]
wwwstatic: add directory listing + index.html support
It's now possible to use WwwStatic as a standalone PSGI
app to serve static files and recreate the award-winning
web design of https://public-inbox.org/ :>
Eric Wong [Wed, 1 Jan 2020 10:38:58 +0000 (10:38 +0000)]
wwwstatic: avoid TOCTTOU for FIFO check
We can use Perl's sysopen function to pass O_NONBLOCK to open(2)
and avoid blocking on FIFOs. This avoids a TOCTTOU race where
somebody can change a regular to FIFO in between the stat(2) and
open(2) syscalls.
Eric Wong [Wed, 1 Jan 2020 10:38:57 +0000 (10:38 +0000)]
wwwstatic: do not open() files for HEAD requests
open() is a much more expensive syscall than stat(),
so avoid it
Eric Wong [Wed, 1 Jan 2020 10:38:56 +0000 (10:38 +0000)]
wwwstatic: move r(...) functions here
Remove redundant "r" functions for generating short error
responses. These responses will no longer be cached by clients,
which is probably a good thing since most errors ought to be
transient, anyways. This also fixes error responses for our
cgit wrapper when static files are missing.
Eric Wong [Wed, 1 Jan 2020 10:38:55 +0000 (10:38 +0000)]
www: move more logic into path_info_raw
It'll be easier to reuse in future code.
Eric Wong [Wed, 1 Jan 2020 10:38:54 +0000 (10:38 +0000)]
wwwstatic: implement Last-Modified and If-Modified-Since
We're already serving static files for cgit, and will serve more
static files, soon.
Eric Wong [Tue, 31 Dec 2019 10:30:13 +0000 (10:30 +0000)]
cgit: type declaration for PublicInbox::Git
AFAIK this doesn't do anything for Perl internally since
PublicInbox::Git doesn't "use fields", but it makes it easier for
humans readers to follow and ensure we're not passing unblessed
or non-ref scalars to PublicInbox::GitHTTPBackend::serve.
Eric Wong [Tue, 31 Dec 2019 10:30:12 +0000 (10:30 +0000)]
filter/base: export REJECT as a constant
And update callers to use it, as it makes the code a bit cleaner.
Probably irrelvant, but it should be faster, too, as
"perl -I lib -w -MO=Deparse $FILE" shows REJECT() calls are
constant-folded.
Eric Wong [Tue, 31 Dec 2019 10:30:11 +0000 (10:30 +0000)]
githttpbackend: remove ancient compatibility check
The ref() call could be hitting memory leaks on Perl 5.16.x.
It's been 3 years (2016-12-25) since
292ca34140489da2
("githttpbackend: simplify compatibility code") back when
this project was barely known and probably nobody used
examples/public-inbox.psgi...
Eric Wong [Tue, 31 Dec 2019 10:30:10 +0000 (10:30 +0000)]
http: update comment about psgix.io usage
We've been using async_pass for a while.
Eric Wong [Tue, 31 Dec 2019 10:30:09 +0000 (10:30 +0000)]
wwwstatic: getline: die on missing psgix.io
"psgix." extensions aren't guaranteed, so make we should
try and support some theoretical generic PSGI servers
without "psgix.io" on errors by die-ing.
While we're at it, make the error handling path more obvious by
sharing more code between the EOF and errno ($!) cases.