about summary refs log tree commit homepage
DateCommit message (Collapse)
2020-01-05search: 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.
2020-01-04tests: 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.
2020-01-04viewdiff: 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.
2020-01-04searchidx: 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 :>
2020-01-04searchidx: index_text: use Xapian parameter names
Use the parameter names from the Search::Xapian::TermGenerator manpage for our local variables instead of confusing names...
2020-01-04searchidx: simplify quote-splitting in index_body
We now use the same regexp View::add_text_body uses.
2020-01-04searchidx: 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.
2020-01-04searchidx: 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.
2020-01-04searchidx: 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/
2020-01-04solver: 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.
2020-01-04solver: 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.
2020-01-04solver: 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"
2020-01-04xt/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.
2020-01-03qspawn: 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.
2020-01-03solver: 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
2020-01-03solver: 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.
2020-01-03build: 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.
2020-01-03examples: 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.
2020-01-02config: 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.
2020-01-02wwwlisting: 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.
2020-01-02doc: 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.
2020-01-02build: fix xapian-* manpage generation
extman.perl requires the name of its target
2020-01-02doc/txt2pre: flush output before utime()
Otherwise our utime() change is overridden when the flush happens at exit.
2020-01-02doc: 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...
2020-01-02build: 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.
2020-01-02doc: 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.
2020-01-01wwwstatic: 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/ :>
2020-01-01wwwstatic: 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.
2020-01-01wwwstatic: do not open() files for HEAD requests
open() is a much more expensive syscall than stat(), so avoid it
2020-01-01wwwstatic: 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.
2020-01-01www: move more logic into path_info_raw
It'll be easier to reuse in future code.
2020-01-01wwwstatic: implement Last-Modified and If-Modified-Since
We're already serving static files for cgit, and will serve more static files, soon.
2020-01-01cgit: 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.
2020-01-01filter/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.
2020-01-01githttpbackend: 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...
2020-01-01http: update comment about psgix.io usage
We've been using async_pass for a while.
2020-01-01wwwstatic: 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.
2020-01-01spamcheck/spamc: pass GLOB handles instead of FD numbers
The spawn() interface improvements[1] propagate to popen_rd, too, so we can avoid weird dances to keep the GLOB handle references live and just pass the handle around. [1] commit 267371b1273b518215939e817e53733584b68af7 ("spawn: allow passing GLOB handles for redirects")
2020-01-01nntp: handle 2-digit year "70" properly
Time::Local has the concept of a "rolling century" which is defined at 50 years on either side of the current year. Since it's now 2020 and >50 years since the Unix epoch, the year "70" gets interpreted by Time::Local as 2070-01-01 instead of 1970-01-01. Since NNTP servers are unlikely to store messages from the future, we'll feed 4-digit year to Time::Local::{timegm,timelocal} and hopefully not have to worry about things until Y10K. This fixes test failures on t/v2writable.t and t/nntpd.t since 2020-01-01.
2019-12-30spawn: better error handling
Since vfork always shares memory between the child and parent, we can propagate errors to the parent errno using shared memory instead of just dumping to stderr and hoping somebody sees it.
2019-12-30spawn: support chdir via -C option
This simplifies our admin module a bit and allows solver to be used with v1 inboxes using git versions prior to v1.8.5 (but still >= git v1.8.0).
2019-12-30spawn: allow passing GLOB handles for redirects
We can save callers the trouble of {-hold} and {-dev_null} refs as well as the trouble of calling fileno().
2019-12-29search: load_xapian: return true on success
This was causing -xcpdb and other admin modules to fail outside of tests (or when testing with the slow TEST_RUN_MODE=0).
2019-12-28Merge branch 'no-closure'
* no-closure: (30 commits) search: retry_reopen passes user arg to callback solvergit: allow passing arg to user-supplied callback viewvcs: avoid anonymous sub for HTML response wwwattach: avoid anonymous sub for msg_iter view: msg_iter calls add_body_text directly searchview: remove anonymous sub when sorting threads by relevance view: thread_html: pass named sub to WwwStream searchview: pass named subs to Www*Stream wwwtext: avoid anonymous sub in response contentid: no anonymous sub view: msg_html: stop using an anonymous sub view: avoid anon sub in stream_thread config: each_inbox: pass user arg to callback feed: avoid anonymous subs mboxgz: pass $ctx to callback to avoid anon subs www: lazy load Plack::Util githttpbackend: split out wwwstatic qspawn: psgi_return: allow non-anon parse_hdr callback qspawn: drop "qspawn.filter" support, for now qspawn: psgi_qx: eliminate anonymous subs ...
2019-12-28ds: use MSG_MORE when wbuf is empty during long responses
HTTP::getline_pull and NNTP::long_step will both populate {wbuf} manually to avoid recursion, so we need to account for an empty-but-present {wbuf} while dispatching msg_more().
2019-12-28search: retry_reopen passes user arg to callback
This allows callers to pass named (not anonymous) subs. Update all retry_reopen callers to use this feature, and fix some places where we failed to use retry_reopen :x
2019-12-28solvergit: allow passing arg to user-supplied callback
This allows us to get rid of the requirement to capture on-stack variables with an anonymous sub, as illustrated with the update to viewvcs to take advantage of this. v2: fix error handling for missing OIDs
2019-12-27viewvcs: avoid anonymous sub for HTML response
No need to create a new sub for every HTML page we render with our VCS viewer.
2019-12-27wwwattach: avoid anonymous sub for msg_iter
We can pass arguments to msg_iter for msg_iter to pass to our user-supplied callback, now.
2019-12-27view: msg_iter calls add_body_text directly
No need to waste several kilobytes creating an anonymous sub for every invocation of msg_iter.