]> Sergey Matveev's repositories - public-inbox.git/log
public-inbox.git
7 years agonote the source code is AGPL for cloning
Eric Wong [Tue, 29 Nov 2016 21:40:35 +0000 (21:40 +0000)]
note the source code is AGPL for cloning

This should be adequate warning for folks who may be
uncomfortable or uncertain about even possessing AGPL
source code due to employer agreements and such.

Disclaimer: I remain completely in favor of AGPL and strong
copyleft, and am more than willing to risk my own future on it.
However, I refuse to even nudge people into downloading AGPL
source code if it presents any legal risk to them.

7 years agoavoid IO::File for anonymous temporary files
Eric Wong [Sat, 26 Nov 2016 08:52:50 +0000 (08:52 +0000)]
avoid IO::File for anonymous temporary files

We do not need to import IO::File into the main programs
since Perl 5.8+ supports literal "undef" for generating
anonymous temporary file handles.

7 years agogithttpbackend: error checking for input handling
Eric Wong [Sat, 26 Nov 2016 08:34:34 +0000 (08:34 +0000)]
githttpbackend: error checking for input handling

This was sloppy code, all calls need to be checked
for failure.

7 years agoview: fix spaces in mailto: link
Eric Wong [Tue, 22 Nov 2016 02:49:40 +0000 (02:49 +0000)]
view: fix spaces in mailto: link

Some mail clients do not seem to handle '+' as a space in query
parameters for the mail subject, use the more common '%20' for
compatibility.

7 years agoindex: allow indexing before configuration
Eric Wong [Fri, 4 Nov 2016 21:11:35 +0000 (21:11 +0000)]
index: allow indexing before configuration

One may build the initial index on a powerful host and transfer
it to a weaker one for incremental indexing.  Thus there is
no requirement to have a configured public-inbox for building
the index unless a user needs altid support or some such.

7 years agoimport: failed GC runs are non-fatal
Eric Wong [Sun, 16 Oct 2016 00:36:14 +0000 (00:36 +0000)]
import: failed GC runs are non-fatal

We should not completely kill a process if "git gc --auto"
errors out due to a warning or whatnot.

7 years agothread: reinstates stable ordering when ghosts are present
Eric Wong [Fri, 14 Oct 2016 09:00:01 +0000 (09:00 +0000)]
thread: reinstates stable ordering when ghosts are present

This reverts commit 3c9dd6619f825f0515e7e4afa1bd55c99c1a68d3
("thread: fix sorting without topmost")
and reinstates the "topmost" routine for sorting purposes.

7 years agothread: fix parent/child relationships
Eric Wong [Thu, 13 Oct 2016 03:59:03 +0000 (03:59 +0000)]
thread: fix parent/child relationships

The ordering change in add_child is critical if $self == $parent
as the {children} hash was lost before this change.

has_descendent can be simplified by walking upwards from the child
instead of downwards from the parent.

This fixes threading regressions introduced in
commit 30100c46326e2eac275e0af13116636701d2537e
("thread: use hash + array instead of hand-rolled linked list")

7 years agothread: reduce indentation level
Eric Wong [Thu, 13 Oct 2016 03:59:02 +0000 (03:59 +0000)]
thread: reduce indentation level

This should reduce differences from the original Mail::Thread
code and hopefully make things easier-to-follow.

7 years agothread: remove weaken dependency
Eric Wong [Wed, 5 Oct 2016 23:47:32 +0000 (23:47 +0000)]
thread: remove weaken dependency

We have to walk through all the messages after threading
anyways to build the rootset, so we can just delete all
the parent references at that point.

7 years agot/thread-cycle: test self-referential messages
Eric Wong [Wed, 5 Oct 2016 23:47:31 +0000 (23:47 +0000)]
t/thread-cycle: test self-referential messages

Some broken (or malicious) mailers may include a generated
Message-ID in its References header, so be prepared for it.

7 years agoview: remove redundant children array in thread views
Eric Wong [Wed, 5 Oct 2016 23:47:30 +0000 (23:47 +0000)]
view: remove redundant children array in thread views

Each node has an entire arrayref of its children nowadays, so
there's no need to waste time and memory creating another one.

7 years agothread: use hash + array instead of hand-rolled linked list
Eric Wong [Wed, 5 Oct 2016 23:47:29 +0000 (23:47 +0000)]
thread: use hash + array instead of hand-rolled linked list

This starts to show noticeable performance improvements when
attempting to thread over 400 messages; but the improvement
may not be measurable with less.

However, the resulting code is much shorter and (IMHO)
much easier to understand.

7 years agothread: fix sorting without topmost
Eric Wong [Wed, 5 Oct 2016 23:47:28 +0000 (23:47 +0000)]
thread: fix sorting without topmost

This bug was hidden, and we may not be able to efficiently
implement a topmost subroutine with the hash-based (vs
linked-list) based container for threading in the next
commit.

7 years agothread: inline and remove recurse_down logic
Eric Wong [Wed, 5 Oct 2016 23:47:27 +0000 (23:47 +0000)]
thread: inline and remove recurse_down logic

We no longer recurse, and it's too hard to come up with
a new name for a sub we will only use once.

7 years agothread: order_children no longer cares about depth
Eric Wong [Wed, 5 Oct 2016 23:47:26 +0000 (23:47 +0000)]
thread: order_children no longer cares about depth

We never use the depth anywhere in this sub

7 years agothread: avoid incrementing undefined value
Eric Wong [Wed, 5 Oct 2016 23:47:25 +0000 (23:47 +0000)]
thread: avoid incrementing undefined value

It is pointless to increment when setting a true value is
simpler as there is no need to read before writing.

7 years agothread: remove iterate_down
Eric Wong [Wed, 5 Oct 2016 23:47:24 +0000 (23:47 +0000)]
thread: remove iterate_down

Unnecessary subs and complexity.  This was hiding the fact
that $before is never used.

7 years agothread: simplify
Eric Wong [Wed, 5 Oct 2016 23:47:23 +0000 (23:47 +0000)]
thread: simplify

Single use subroutines actually make the code more complex in
this case, and there's never a {seen} field in $self.

7 years agothread: remove rootset accessor method
Eric Wong [Wed, 5 Oct 2016 23:47:22 +0000 (23:47 +0000)]
thread: remove rootset accessor method

It doesn't buy us much and copying to a new array is slower;
but probably not measurable in real-world use.

7 years agothread: remove Email::Abstract wrapping
Eric Wong [Wed, 5 Oct 2016 23:47:21 +0000 (23:47 +0000)]
thread: remove Email::Abstract wrapping

This roughly doubles performance due to the reduction in
object creation and abstraction layers.

7 years agoinbox: deal with ghost smsg
Eric Wong [Wed, 5 Oct 2016 23:47:20 +0000 (23:47 +0000)]
inbox: deal with ghost smsg

smsg will be undef for ghost messages in a subsequent commit

7 years agothread: remove accessor usage in internals
Eric Wong [Wed, 5 Oct 2016 23:47:19 +0000 (23:47 +0000)]
thread: remove accessor usage in internals

This improves top-level index generation performance by 3-4%.

7 years agothread: pass array refs instead of entire arrays
Eric Wong [Wed, 5 Oct 2016 23:47:18 +0000 (23:47 +0000)]
thread: pass array refs instead of entire arrays

Copying large arrays is expensive, so avoid it.
This reduces /$INBOX/ time by around 1%.

7 years agothread: remove Mail::Thread dependency
Eric Wong [Wed, 5 Oct 2016 23:47:17 +0000 (23:47 +0000)]
thread: remove Mail::Thread dependency

Introduce our own SearchThread class for threading messages.
This should allow us to specialize and optimize away objects
in future commits.

7 years agoview: remove "subject dummy" references
Eric Wong [Wed, 5 Oct 2016 23:47:16 +0000 (23:47 +0000)]
view: remove "subject dummy" references

We will not care for inexact threading by subject or pruning.

7 years agohelp: document new search prefixes
Eric Wong [Tue, 13 Sep 2016 01:18:30 +0000 (01:18 +0000)]
help: document new search prefixes

Support (and document) 'a:' after all, as "mairix -h" uses it,
so this should reduce the learning curve for mairix users.

7 years agonntp: cleanup: move use statements out of sub scope
Eric Wong [Fri, 9 Sep 2016 18:43:55 +0000 (18:43 +0000)]
nntp: cleanup: move use statements out of sub scope

This clarifies the code somewhat, and we don't care to lazy-load
in NNTP.pm anyways since this is only used for a long-lived
daemon.

7 years agoTODO: updates for done items
Eric Wong [Fri, 9 Sep 2016 09:05:18 +0000 (09:05 +0000)]
TODO: updates for done items

The existing string -> number date range Xapian query is good
enough, and having too much flexibility is probably bad for
caching (as well as increasing our attack surface, because
parsing queries is tricky).

Tags-as-skiplists are probably not worth the effort given
Xapian, and we may have to import old messages after-the-fact,
anyways, and message delivery for mirrors is never orderly.

Other items are all done and need to be maintained (like the
search engine docs for the mairix-compatibility features that
just got pushed out)

7 years agot/httpd-unix: warn about connection failure
Eric Wong [Fri, 9 Sep 2016 03:09:00 +0000 (03:09 +0000)]
t/httpd-unix: warn about connection failure

Output $! for diagnostic purposes since I've noticed this on
two slow machines, today (and seemingly, never prior).

7 years agosearch: index attachment filenames
Eric Wong [Fri, 9 Sep 2016 00:01:31 +0000 (00:01 +0000)]
search: index attachment filenames

And while we're at it, ensure searching inside displayable
attachment bodies works.

7 years agosearch: match the behavior of WWW for indexing text
Eric Wong [Fri, 9 Sep 2016 00:01:30 +0000 (00:01 +0000)]
search: match the behavior of WWW for indexing text

The basic rule is that if it is displayable via our WWW
interface, it should be indexable text for Xapian search.

7 years agosearch: avoid mindlessly calling body_set
Eric Wong [Fri, 9 Sep 2016 00:01:29 +0000 (00:01 +0000)]
search: avoid mindlessly calling body_set

It's not worth entering a complex codepath in Email::MIME to
save some (probably immeasurable amount of) memory, here.  We've
already stopped doing this in our WWW code a while back, too.
If we really cared enough about it, we'd prioritize work on a
streaming replacement for Email::MIME.

7 years agosearch: fix compatibility with Debian wheezy
Eric Wong [Fri, 9 Sep 2016 00:01:28 +0000 (00:01 +0000)]
search: fix compatibility with Debian wheezy

Specifying the "d:" field only worked for
NumberValueRangeProcessor in older versions of Xapian, such
as the one in Debian wheezy (libsearch-xapian-perl=1.2.10.0-1)

This slipped through since I rarely use wheezy, anymore, and
perhaps nobody else does, either.  Perhaps wheezy support may be
dropped, soon.

Unfortunately, this requires a schema version bump.

7 years agosearch: increase term positions for each quoted hunk
Eric Wong [Fri, 9 Sep 2016 00:01:27 +0000 (00:01 +0000)]
search: increase term positions for each quoted hunk

We pay a storage cost for storing positional information
in Xapian, make good use of it by attempting to preserve
it for (hopefully) better search results.

7 years agosearch: match quote detection behavior of view
Eric Wong [Fri, 9 Sep 2016 00:01:26 +0000 (00:01 +0000)]
search: match quote detection behavior of view

This is stricter than the mutt quote_regexp default
("^([ \t]*[|>:}#])+" on Debian jessie),
but matches what we have in View.pm.

I prefer the stricter quote detection since it is less ambiguous
and less likely to hide/obscure important details.

7 years agosearch: fix space regressions from recent changes
Eric Wong [Fri, 9 Sep 2016 00:01:25 +0000 (00:01 +0000)]
search: fix space regressions from recent changes

As of Xapian 1.0.4 (from 2007) is possible to use
Search::Xapian::QueryParser::add_prefix multiple times with the
same user field name but different term prefixes.

This brings my current git@vger mirror from 6.5GB to 2.1GB
(both sizes are after xapian-compact).

7 years agosearch: more granular message body searching
Eric Wong [Fri, 9 Sep 2016 00:01:24 +0000 (00:01 +0000)]
search: more granular message body searching

"bs:" and "b:" are adapted from mairix(1)

We will also support searching explicitly for quoted vs
non-quoted text via "q:" and "nq:" prefixes since sometimes
readers will not care for quoted text.

In the future, we will support parsing diffs (perhaps when
repobrowse integration is complete).

Note: this roughly doubles the size of the Xapian database due
to the additional information; so this change may not be worth
it.

7 years agosearch: drop longer subject: prefix for search
Eric Wong [Fri, 9 Sep 2016 00:01:23 +0000 (00:01 +0000)]
search: drop longer subject: prefix for search

We only document the "s:" anyways.  While the long name is more
descriptive, the ambiguity makes agnostic caching (by Varnish or
similar) slightly harder and longer URLs are more likely to be
accidentally truncated when shared.

7 years agosearch: allow searching user fields (To/Cc/From)
Eric Wong [Fri, 9 Sep 2016 00:01:22 +0000 (00:01 +0000)]
search: allow searching user fields (To/Cc/From)

Sometimes it can be useful to search based on who the
message was sent to, sent by, or Cc:-ed.  Of course,
headers can be faked, but they usually are not...

Anyways this mostly matches the behavior of mairix(1).

7 years agoimport: run "git gc --auto" when done
Eric Wong [Thu, 8 Sep 2016 22:42:42 +0000 (22:42 +0000)]
import: run "git gc --auto" when done

We need to prevent excessive repository growth for
public-inbox-watch and public-inbox-mda users.

7 years agoimport: hoist out common run_die subroutine
Eric Wong [Thu, 8 Sep 2016 22:41:01 +0000 (22:41 +0000)]
import: hoist out common run_die subroutine

We will be reusing this in the next commit, too.

7 years agodoc: document PERL_INLINE_DIRECTORY usage
Eric Wong [Thu, 8 Sep 2016 20:15:25 +0000 (20:15 +0000)]
doc: document PERL_INLINE_DIRECTORY usage

For now, we will document this since it allows better
performance without the burden of extensions.  Perhaps one day
far in the future Perl can natively support vfork(2) AND that
version of Perl will be widely available, but I suspect that day
is at least a decade away, if not two:

https://rt.perl.org/Ticket/Display.html?id=128227

7 years agoimport: hoist out _check_path function
Eric Wong [Thu, 8 Sep 2016 10:23:34 +0000 (10:23 +0000)]
import: hoist out _check_path function

This reduces duplication, slightly.  We may be using it
yet again in a to-be-introduced function (or we may not
introduce it).

7 years agoview: handle missing Content-Type in message
Eric Wong [Thu, 8 Sep 2016 19:44:16 +0000 (19:44 +0000)]
view: handle missing Content-Type in message

Email::MIME internally assumes "text/plain" for messages
missing a Content-Type, but does not expose that in the
Email::MIME::content_type API method.  We must assume it
ourselves to avoid uninitialized value warnings for the
rare (nowadays) MUAs which do not set it.

7 years agodoc: flesh out public-inbox-index documentation
Eric Wong [Wed, 7 Sep 2016 21:53:11 +0000 (21:53 +0000)]
doc: flesh out public-inbox-index documentation

And include it into the build + website

7 years agodoc: new docs for user-level commands
Eric Wong [Wed, 7 Sep 2016 00:47:15 +0000 (00:47 +0000)]
doc: new docs for user-level commands

Hopefully more folks can download and run public-inbox,
nowadays.

7 years agoconfig: use "publicinboxlimiter" prefix
Eric Wong [Fri, 2 Sep 2016 21:00:50 +0000 (21:00 +0000)]
config: use "publicinboxlimiter" prefix

Just having "limiter" in the prefix may confuse
it with something else.  Use the full prefix to
avoid this confusion.

7 years agoinit: enable pack bitmaps by default
Eric Wong [Fri, 2 Sep 2016 01:06:42 +0000 (01:06 +0000)]
init: enable pack bitmaps by default

We want to encourage users to serve repositories.  So enable
bitmaps by default so performance suffers less with smart HTTP.

7 years agowatch: use "publicinboxwatch" namespace
Eric Wong [Thu, 1 Sep 2016 19:31:12 +0000 (19:31 +0000)]
watch: use "publicinboxwatch" namespace

We'll keep supporting "publicinboxlearn" indefinitely,
but "publicinboxwatch" is probably more appropriate
at the moment.

Noticed while writing documentation.

7 years agodoc: set release and section properly for manpages
Eric Wong [Wed, 31 Aug 2016 19:50:52 +0000 (19:50 +0000)]
doc: set release and section properly for manpages

This will be important as we will have more of them.

7 years agotxt2pre: allow overriding title via env
Eric Wong [Wed, 31 Aug 2016 19:32:12 +0000 (19:32 +0000)]
txt2pre: allow overriding title via env

This will allow reasonable titles to be generated for
manpages.

7 years agotxt2pre: use public-inbox internal APIs
Eric Wong [Wed, 31 Aug 2016 19:25:15 +0000 (19:25 +0000)]
txt2pre: use public-inbox internal APIs

Since this is bundled with the source, we might as well use
internal APIs to avoid having duplicate code (and bugs :P)

7 years agowww: give tor2web some exposure, too
Eric Wong [Tue, 23 Aug 2016 21:23:53 +0000 (21:23 +0000)]
www: give tor2web some exposure, too

Not everybody can run Tor, hopefully more can use Tor2web
even if it compromises their privacy.  This should help
make system more resilient for users unable to use Tor.

7 years agodoc: avoid conflicting with MakeMaker variable names
Eric Wong [Sun, 21 Aug 2016 09:30:00 +0000 (09:30 +0000)]
doc: avoid conflicting with MakeMaker variable names

We want the pod2man(1) executable for handling certain
options.  Also, use the correct year while we're at it :P

7 years agoavoid spaces after shell redirection operators
Eric Wong [Sat, 20 Aug 2016 00:25:16 +0000 (00:25 +0000)]
avoid spaces after shell redirection operators

This makes us closer to git.git style (though I'm not quite sure
why we do this...)

7 years agodoc: mda: remove vestigial pandoc comment
Eric Wong [Sat, 20 Aug 2016 00:25:15 +0000 (00:25 +0000)]
doc: mda: remove vestigial pandoc comment

We use perlpod nowadays since it's Perl, like our code base.

7 years agoREADME: add link to source code mirrors
Eric Wong [Sun, 21 Aug 2016 09:22:14 +0000 (09:22 +0000)]
README: add link to source code mirrors

Centralization sucks, so we mirror everything.

7 years agosearchview: link to internal help text
Eric Wong [Thu, 18 Aug 2016 09:25:21 +0000 (09:25 +0000)]
searchview: link to internal help text

The internal help text links to the Xapian query parser
documentation anyways, but also provides information
on which prefixes exist.

7 years agowww: implement generic help text
Eric Wong [Thu, 18 Aug 2016 04:44:07 +0000 (04:44 +0000)]
www: implement generic help text

Begin documenting some basic help functionality.
I may tweak the anchor names of the various HTML endpoints
to be more consistent with each other (old ones will be
supported for a short while), so I'm not documenting
those, for now.

This may become part of a builtin key-value store for
basic texts, but this probably shouldn't become a wiki
engine, either.

7 years agolinkify: be stricter about matching RFC 3986
Eric Wong [Thu, 18 Aug 2016 02:02:50 +0000 (02:02 +0000)]
linkify: be stricter about matching RFC 3986

We're not to-the-letter about percent-encoding, but
we should allow all the characters.  This is mainly
so we can effectively use the link to some Wikipedia
pages with parentheses in them:

https://en.wikipedia.org/wiki/Atom_(standard)
https://en.wikipedia.org/wiki/Git_(software)

7 years agoview: try assuming UTF-8 for bogus charsets
Eric Wong [Thu, 18 Aug 2016 01:10:35 +0000 (01:10 +0000)]
view: try assuming UTF-8 for bogus charsets

For some reason, Alpine will set X-UNKNOWN for valid UTF-8.
Since we favor UTF-8 HTML anyways, try forcing Email::MIME to
handle text/plain as UTF-8 which might show up better.

At least this change renders

<alpine.DEB.2.20.1608131214070.4924@virtualbox>

properly by showing "•" (&#8226;) instead of
"â ¢" (&#226;&#128;&#162;)

Reported-by: Thomas Ferris Nicolaisen <tfnico@gmail.com>
7 years agoview: try to display bogus charsets for text/plain
Eric Wong [Thu, 18 Aug 2016 00:54:25 +0000 (00:54 +0000)]
view: try to display bogus charsets for text/plain

Alpine seems to set charset=X-UNKNOWN for valid UTF-8 text,
which causes Email::MIME::body_str to fail as X-UNKNOWN
is not a valid encoding.  So, blindly display the body
as plain-text but warn users about possibly mangled text.

Reported-by: Thomas Ferris Nicolaisen <tfnico@gmail.com>
7 years agoview: attach_link uses string concatentation
Eric Wong [Wed, 17 Aug 2016 23:07:43 +0000 (23:07 +0000)]
view: attach_link uses string concatentation

There is no point in using an array to join on an
empty string (my original intention was probably to
join on "\n").

This is only preparation for the next change to show
a warning to in the attachment link.

7 years agosearch: add YYYYMMDD search range via "d:" prefix
Eric Wong [Tue, 16 Aug 2016 08:49:26 +0000 (08:49 +0000)]
search: add YYYYMMDD search range via "d:" prefix

This is similar to mairix in that it uses a "d:" prefix; but
only takes YYYYMMDD, for now.  Using custom date/time parsers
via Perl will be much more work:

nntp://news.gmane.org/20151005222157.GE5880@survex.com

Anyhow, this ought to be more human-friendly than searching by
Unix timestamps, but it requires reindexing to take advantage of.

7 years agosearch: drop pointless range processors for Unix timestamp
Eric Wong [Tue, 16 Aug 2016 08:49:25 +0000 (08:49 +0000)]
search: drop pointless range processors for Unix timestamp

The Unix timestamp isn't meaningful for users searching,
we will start indexing the YYYYMMDD date stamp which may
use StringValueRangeProcessor, instead.

7 years agoHACKING: minor updates and add to the website
Eric Wong [Tue, 16 Aug 2016 07:49:56 +0000 (07:49 +0000)]
HACKING: minor updates and add to the website

Also, at least add one of the Tor mirrors (the rest will
be discoverable through the mirrors themselves).

7 years agoimport: use common address parsing to drop unnecessary quotes
Eric Wong [Mon, 15 Aug 2016 01:54:51 +0000 (01:54 +0000)]
import: use common address parsing to drop unnecessary quotes

Not sure why or how I missed this before; but the common address
parsing routine we have should be more correct.

Add a test to ensure excessively quoted names don't make it
through, either.

7 years agoTODO: updates based on git@vger mirror experience
Eric Wong [Sun, 14 Aug 2016 11:30:32 +0000 (11:30 +0000)]
TODO: updates based on git@vger mirror experience

Plenty more to do!

7 years agowww: do not double-clean Message-IDs from internal DBs
Eric Wong [Sun, 14 Aug 2016 10:21:10 +0000 (10:21 +0000)]
www: do not double-clean Message-IDs from internal DBs

Ensure we usually strip one level of '<>' from Message-IDs,
since our internal SQLite, Xapian, and SHA-1 storage all
assume that.

Realistically, we screw up if somebody has '<<' or '>>',
but those are screwed up mail clients and we can deal with
it another time.  Currently, this means some messages with
'>>' in References or Message-Id are not handled correctly,
yet, but we match the behavior of Mail::Thread in keeping
the extra '>'.

7 years agowww: do not unecessarily escape some chars in paths
Eric Wong [Sun, 14 Aug 2016 10:21:09 +0000 (10:21 +0000)]
www: do not unecessarily escape some chars in paths

Based on reading RFC 3986, it seems '@', ':', '!', '$', '&',
"'", '; '(', ')', '*', '+', ',', ';', '=' are all allowed
in path-absolute where we have the Message-ID.

In any case, it seems '@' is fairly common in path components
nowadays and too common in Message-IDs.

7 years agowww: ensure XML validity for some odd ASCII chars
Eric Wong [Sun, 14 Aug 2016 10:21:17 +0000 (10:21 +0000)]
www: ensure XML validity for some odd ASCII chars

I've seen 0x1b (\e) in at least one message and some other
possibly non-printable chars.  In any case, make sure they're
valid XML with us-ascii encoding as far as xmlstarlet(1) thinks
so.

7 years agomid: no wide characters for sha1_hex
Eric Wong [Sun, 14 Aug 2016 10:21:11 +0000 (10:21 +0000)]
mid: no wide characters for sha1_hex

Apparently there are some really screwed up In-Reply-To
fields out there.

7 years agosearch: gracefully handle lookup_message failure
Eric Wong [Sun, 14 Aug 2016 10:21:15 +0000 (10:21 +0000)]
search: gracefully handle lookup_message failure

We can't blindly assume a ghost even exists in the DB, as the
rules can change internally for some corner-case Message-IDs.

7 years agoview: remove redundant pre closing tag
Eric Wong [Sun, 14 Aug 2016 10:21:13 +0000 (10:21 +0000)]
view: remove redundant pre closing tag

7 years agoview: allow for missing In-Reply-To mapping
Eric Wong [Sun, 14 Aug 2016 10:21:12 +0000 (10:21 +0000)]
view: allow for missing In-Reply-To mapping

Because buggy mail clients exist and generate invalid
In-Reply-To headers we cannot handle across the board...

7 years agosearchidx: do not release Xapian lock while (only) Msgmap is indexing
Eric Wong [Sun, 14 Aug 2016 10:21:08 +0000 (10:21 +0000)]
searchidx: do not release Xapian lock while (only) Msgmap is indexing

SQLite might index quickly, so we hold the lock used by Xapian
for the duration.  This probably needs to be reworked entirely,
actually.

7 years agoimport_slrnspool: reimplement using fast-import
Eric Wong [Sun, 14 Aug 2016 10:21:07 +0000 (10:21 +0000)]
import_slrnspool: reimplement using fast-import

I needed to use this to resurrect some messages missing
from my initial downloads from gmane...

7 years agonewswww: include body text in 404 response
Eric Wong [Sun, 14 Aug 2016 10:16:55 +0000 (10:16 +0000)]
newswww: include body text in 404 response

Some browsers do not give any indication of the HTTP error
code on errors, so show the error text to the user like we
do in the top-level WWW module.

7 years agoextmsg: reorder and add a more Message-ID lookup services
Eric Wong [Sat, 13 Aug 2016 00:22:01 +0000 (00:22 +0000)]
extmsg: reorder and add a more Message-ID lookup services

gmane is down at the moment, so lower that in priority
(hopefully it will be brought back up, again).  Wikipedia also
lists a few more project-specific list providers, so include
those as well: https://en.wikipedia.org/wiki/Message-ID

7 years agowatch: respect altid for incremental watch changes
Eric Wong [Fri, 12 Aug 2016 22:08:50 +0000 (22:08 +0000)]
watch: respect altid for incremental watch changes

We need to pass the Inbox object to SearchIdx to get altid
mappings properly for incremental imports.

TODO: use the Inbox object in more places where it makes sense
to do so.

7 years agowww: allow including links to NNTP sites in HTML footer
Eric Wong [Fri, 12 Aug 2016 19:52:35 +0000 (19:52 +0000)]
www: allow including links to NNTP sites in HTML footer

Improve the discoverability of NNTP endpoints for users
who still know what NNTP is.

==> ~/.public-inbox/config <==
; aliases for the locally-run nntpd can be specified in
; the "publicinbox" section:
[publicinbox]
nntpserver = nntp://ou63pmih66umazou.onion/
nntpserver = news.public-inbox.org

; NNTPS is not supported natively, yet,
; but one can use haproxy or similar
; nntpserver = nntps://news.public-inbox.invalid/

; mirrors for specific inboxes may be specified either as full
; NNTP (or NNTPS) URLs, or with the server name only if the
; newsgroup name is specfied for a local NNTP server
[publicinbox "git"]
...
newsgroup = inbox.a.b.c
nntpmirror = nntp://czquwvybam4bgbro.onion/
nntpmirror = hjrcffqmbrq6wope.onion

; there may be a mirror on a different server with a
; different name:
nntpmirror = nntp://news.example.com/differently.named.group

; (And I really need to write manpages for all this...)

7 years agopublic-inbox-watch: support reloading config with SIGHUP
Eric Wong [Thu, 11 Aug 2016 19:15:23 +0000 (19:15 +0000)]
public-inbox-watch: support reloading config with SIGHUP

This can be useful for adding new lists, as restarting is
expensive (but still non-lossy).

7 years agoconfig: do not nest multi-value altid arrays
Eric Wong [Fri, 12 Aug 2016 02:15:55 +0000 (02:15 +0000)]
config: do not nest multi-value altid arrays

Oops.  We will inevitably need to support multiple altids for a
public-inbox one day.

7 years agosearch: support alt-ID for mapping legacy serial numbers
Eric Wong [Thu, 11 Aug 2016 00:23:48 +0000 (00:23 +0000)]
search: support alt-ID for mapping legacy serial numbers

For some existing mailing list archives, messages are identified
by serial number (such as NNTP article numbers in gmane).  Those
links may become inaccessible (as is the current case for
gmane), so ensure users can still search based on old serial
numbers.

Now, I run the following periodically to get article numbers
from gmane (while news.gmane.org remains):

NNTPSERVER=news.gmane.org
export NNTPSERVER
GROUP=gmane.comp.version-control.git
perl -I lib scripts/xhdr-num2mid $GROUP --msgmap=/path/to/gmane.sqlite3

(I might integrate this further with public-inbox-* scripts one day).

My ~/.public-inbox/config as an added "altid" snippet which now
looks like this:

[publicinbox "git"]
address = git@vger.kernel.org
mainrepo = /path/to/git.vger.git
newsgroup = inbox.comp.version-control.git

; relative pathnames expand to $mainrepo/public-inbox/$file
altid = serial:gmane:file=gmane.sqlite3

And run "public-inbox-index --reindex /path/to/git.vger.git"
periodically.

This ought to allow searching for "gmane:12345" to work for
Xapian-enabled instances.

Disclaimer: while public-inbox supports NNTP and stable article
serial numbers, use of those for public links is discouraged
since it encourages centralization.

7 years agosearchidx: allow searching Message-IDs in free-form text
Eric Wong [Tue, 9 Aug 2016 23:59:10 +0000 (23:59 +0000)]
searchidx: allow searching Message-IDs in free-form text

It is not unheard of for users to attempt finding messages by
entering Message-IDs into the "Search" box instead of using the
existing URL structure.  So make it possible for them.

Fwiw, I've definitely encountered users who enter entire URLs
into generic search engines.

7 years agowww: avoid misinterpreting '&' and ';' in query parameters
Eric Wong [Tue, 9 Aug 2016 01:55:19 +0000 (01:55 +0000)]
www: avoid misinterpreting '&' and ';' in query parameters

Oops, we must unescape each key=value pair in a QUERY_STRING
individually; otherwise we cannot interpret '&' or ';' in
query parameter values.

7 years agosearchidx: avoid holding Xapian lock in cat-file
Eric Wong [Tue, 9 Aug 2016 00:41:37 +0000 (00:41 +0000)]
searchidx: avoid holding Xapian lock in cat-file

We must ensure cat-file process is launched before Xapian
grabs lock, too.  Our use of "git cat-file --batch" has
the same problem as "git log" did, (which was fixed in
commit 3713c727cda431a0dc2865a7878c13ecf9f21851)
"searchidx: release Xapian FDs before spawning git log"

7 years agosearchidx: release Xapian FDs before spawning git log
Eric Wong [Tue, 9 Aug 2016 00:22:52 +0000 (00:22 +0000)]
searchidx: release Xapian FDs before spawning git log

This will allow us to release and re-acquire Xapian locks
due to the lack of FD_CLOEXEC on some FDs.

7 years agosearchidx: persist the PublicInbox::Git object
Eric Wong [Tue, 9 Aug 2016 00:22:51 +0000 (00:22 +0000)]
searchidx: persist the PublicInbox::Git object

We can cheaply keep the object around nowadays since it
spawns expensive processes only on an as-needed basis.

7 years agosearchidx: remove unused $git parameters
Eric Wong [Tue, 9 Aug 2016 00:22:50 +0000 (00:22 +0000)]
searchidx: remove unused $git parameters

We do not need to pass the PublicInbox::Git object to
various callbacks.

7 years agowww: use <hr> to delimit messages in /new.html view, too
Eric Wong [Sat, 6 Aug 2016 21:00:40 +0000 (21:00 +0000)]
www: use <hr> to delimit messages in /new.html view, too

This is necessary to delimit messages when viewed without
threading.

7 years agombox: be fair to other HTTP clients
Eric Wong [Sat, 6 Aug 2016 01:58:47 +0000 (01:58 +0000)]
mbox: be fair to other HTTP clients

At least for public-inbox-httpd, this allows us to avoid having
a client monopolize one event loop tick of the server for too
long.  It hurts throughput for the /all.mbox.gz endpoint, but I
doubt anybody cares and the latency improvement for other
clients would be appreciated.

We already do the same fairness thing for HTML pages.

7 years agoview: do not introduce excessive </pre> in $MID/t/ view
Eric Wong [Sat, 6 Aug 2016 00:26:38 +0000 (00:26 +0000)]
view: do not introduce excessive </pre> in $MID/t/ view

When using <ul><li>..., we already setup <pre> tags
in thread_index_entry, so having an extra </pre> tag
causes validation errors.

Fixes: 6ef9b216156c ("view: use <hr> to delineate in /$MID/T/ view")
7 years agosearch: disable batching in newer versions of Xapian, for now
Eric Wong [Fri, 5 Aug 2016 22:07:25 +0000 (22:07 +0000)]
search: disable batching in newer versions of Xapian, for now

This warrants further investigation, but it appears we cannot
release Xapian reliably after forking "git log" due to the
lack of a close-on-exec flag on the Xapian flintlock FD

7 years agoview: use <hr> to delineate in /$MID/T/ view
Eric Wong [Fri, 5 Aug 2016 18:10:50 +0000 (18:10 +0000)]
view: use <hr> to delineate in /$MID/T/ view

The sacrifice in vertical space might be worth it to improve
ease-of-reading, as it's unreasonable to expect an entire
message thread to be able to fit into a single window.

https://public-inbox.org/git/20160805093544.scvl4yshkfg2l26p@sigill.intra.peff.net/

Cc: Jeff King <peff@peff.net>
7 years agohttp: do not allow bad getline+close responses to kill us
Eric Wong [Thu, 4 Aug 2016 23:36:34 +0000 (23:36 +0000)]
http: do not allow bad getline+close responses to kill us

PSGI applications (like our WWW :P) can fail unpredictability,
but lets try to avoid bringing the entire process down when this
happens.

7 years agothread: avoid recursion in Mail::Thread::recurse_down
Eric Wong [Fri, 5 Aug 2016 00:24:18 +0000 (00:24 +0000)]
thread: avoid recursion in Mail::Thread::recurse_down

Yet another monkey patch to fix a problem encountered in upstream
Mail::Thread.

ref:
- https://rt.cpan.org/Ticket/Display.html?id=116727
- http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833479

7 years agoview: do not fail on empty In-Reply-To
Eric Wong [Thu, 4 Aug 2016 21:58:40 +0000 (21:58 +0000)]
view: do not fail on empty In-Reply-To

Sometimes messages have an empty In-Reply-To header which throws
threaders off.  This actually causes public-inbox-httpd to die,
which is probably bad and will be fixed elsewhere.

7 years agosearchmsg: add git object ID to doc_data
Eric Wong [Tue, 2 Aug 2016 10:02:54 +0000 (10:02 +0000)]
searchmsg: add git object ID to doc_data

Doing git tree lookups based on the SHA-1 of the Message-ID
is expensive as trees get larger, instead, use the SHA-1
object ID directly.  This drastically reduces the amount
of time spent in the "git cat-file --batch" process for
fetching the /$INBOX/all.mbox.gz endpoint on the ~800MB
git@vger.kernel.org mirror

This retains backwards compatibility and allows existing
indices to be transparently upgraded without performance
degradation.