user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH 0/6] minor internal consistency things
@ 2020-12-08 21:21 Eric Wong
  2020-12-08 21:21 ` [PATCH 1/6] treewide: replace {-inbox} with {ibx} for consistency Eric Wong
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Eric Wong @ 2020-12-08 21:21 UTC (permalink / raw)
  To: meta

Some more changes because the codebase needs to grow to
support client-side tooling and JMAP.

Lack of static type-checking means we need to be more consistent
with naming conventions to avoid confusing my easily-confused
mind.

Eric Wong (6):
  treewide: replace {-inbox} with {ibx} for consistency
  nntp: replace {ng} with {ibx} for consistency
  rename {pi_config} fields to {pi_cfg}
  extindex: do not use current dir like -index does
  admin: resolve_repo_dir => resolve_inboxdir
  extsearchidx: ck_existing: set $OID for warning context

 Documentation/mknews.perl          |   4 +-
 examples/cgit.psgi                 |   4 +-
 lib/PublicInbox/Admin.pm           |   8 +-
 lib/PublicInbox/Cgit.pm            |  24 +++---
 lib/PublicInbox/Config.pm          |   2 +-
 lib/PublicInbox/ExtMsg.pm          |  18 ++---
 lib/PublicInbox/ExtSearchIdx.pm    |   2 +
 lib/PublicInbox/Feed.pm            |   6 +-
 lib/PublicInbox/Filter/RubyLang.pm |   2 +-
 lib/PublicInbox/GzipFilter.pm      |   4 +-
 lib/PublicInbox/IMAPD.pm           |  28 +++----
 lib/PublicInbox/Inbox.pm           |  10 +--
 lib/PublicInbox/InboxIdle.pm       |   9 +--
 lib/PublicInbox/InboxWritable.pm   |   2 +-
 lib/PublicInbox/MDA.pm             |   4 +-
 lib/PublicInbox/ManifestJsGz.pm    |   2 +-
 lib/PublicInbox/Mbox.pm            |  30 +++----
 lib/PublicInbox/MboxGz.pm          |   4 +-
 lib/PublicInbox/NNTP.pm            | 124 ++++++++++++++---------------
 lib/PublicInbox/NNTPD.pm           |  16 ++--
 lib/PublicInbox/NewsWWW.pm         |  15 ++--
 lib/PublicInbox/Qspawn.pm          |   4 +-
 lib/PublicInbox/SearchThread.pm    |   4 +-
 lib/PublicInbox/SearchView.pm      |  14 ++--
 lib/PublicInbox/Spamcheck.pm       |   4 +-
 lib/PublicInbox/Unsubscribe.pm     |   6 +-
 lib/PublicInbox/View.pm            |  22 ++---
 lib/PublicInbox/ViewVCS.pm         |   2 +-
 lib/PublicInbox/WWW.pm             |  51 ++++++------
 lib/PublicInbox/Watch.pm           |  20 ++---
 lib/PublicInbox/WwwAltId.pm        |   2 +-
 lib/PublicInbox/WwwAtomStream.pm   |  10 +--
 lib/PublicInbox/WwwAttach.pm       |  10 +--
 lib/PublicInbox/WwwListing.pm      |   4 +-
 lib/PublicInbox/WwwStream.pm       |  12 +--
 lib/PublicInbox/WwwText.pm         |  12 +--
 script/public-inbox-index          |   1 +
 script/public-inbox-learn          |   8 +-
 script/public-inbox-mda            |   8 +-
 scripts/import_slrnspool           |   4 +-
 t/admin.t                          |  28 ++++---
 t/feed.t                           |   6 +-
 t/filter_rubylang.t                |   2 +-
 t/imapd.t                          |   4 +-
 t/inbox_idle.t                     |   8 +-
 t/mda_filter_rubylang.t            |   4 +-
 t/nntp.t                           |  12 +--
 t/psgi_mount.t                     |   6 +-
 t/psgi_search.t                    |   6 +-
 t/psgi_v2.t                        |  11 ++-
 t/watch_filter_rubylang.t          |  10 +--
 t/watch_maildir.t                  |  26 +++---
 t/watch_maildir_v2.t               |  48 +++++------
 t/watch_multiple_headers.t         |   8 +-
 xt/cmp-msgview.t                   |   2 +-
 xt/perf-msgview.t                  |   2 +-
 xt/perf-threading.t                |   2 +-
 57 files changed, 352 insertions(+), 349 deletions(-)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/6] treewide: replace {-inbox} with {ibx} for consistency
  2020-12-08 21:21 [PATCH 0/6] minor internal consistency things Eric Wong
@ 2020-12-08 21:21 ` Eric Wong
  2020-12-08 21:21 ` [PATCH 2/6] nntp: replace {ng} " Eric Wong
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Eric Wong @ 2020-12-08 21:21 UTC (permalink / raw)
  To: meta

{ibx} is shorter and is the most prevalent abbreviation
in indexing and IMAP code, and the `$ibx' local variable
is already prevalent throughout.

In general, the codebase favors removal of vowels in variable
and field names to denote non-references (because references are
"lighter" than non-references).

So update WWW and Filter users to use the same code since
it reduces confusion and may allow easier code sharing.
---
 Documentation/mknews.perl          |  4 ++--
 lib/PublicInbox/ExtMsg.pm          | 10 +++++-----
 lib/PublicInbox/Feed.pm            |  6 +++---
 lib/PublicInbox/Filter/RubyLang.pm |  2 +-
 lib/PublicInbox/GzipFilter.pm      |  4 ++--
 lib/PublicInbox/InboxWritable.pm   |  2 +-
 lib/PublicInbox/Mbox.pm            | 30 +++++++++++++++---------------
 lib/PublicInbox/MboxGz.pm          |  4 ++--
 lib/PublicInbox/SearchThread.pm    |  4 ++--
 lib/PublicInbox/SearchView.pm      | 14 +++++++-------
 lib/PublicInbox/View.pm            | 22 +++++++++++-----------
 lib/PublicInbox/ViewVCS.pm         |  2 +-
 lib/PublicInbox/WWW.pm             | 24 ++++++++++++------------
 lib/PublicInbox/WwwAltId.pm        |  2 +-
 lib/PublicInbox/WwwAtomStream.pm   | 10 +++++-----
 lib/PublicInbox/WwwAttach.pm       | 10 +++++-----
 lib/PublicInbox/WwwStream.pm       | 10 +++++-----
 lib/PublicInbox/WwwText.pm         |  8 ++++----
 t/feed.t                           |  6 +++---
 t/filter_rubylang.t                |  2 +-
 xt/cmp-msgview.t                   |  2 +-
 xt/perf-msgview.t                  |  2 +-
 xt/perf-threading.t                |  2 +-
 23 files changed, 91 insertions(+), 91 deletions(-)

diff --git a/Documentation/mknews.perl b/Documentation/mknews.perl
index 510a4e18..d87c2609 100755
--- a/Documentation/mknews.perl
+++ b/Documentation/mknews.perl
@@ -43,7 +43,7 @@ if ($dst eq 'NEWS') {
 	);
 	$ibx->{-primary_address} = $addr;
 	my $ctx = {
-		-inbox => $ibx,
+		ibx => $ibx,
 		-upfx => "$base_url/",
 		-hr => 1,
 	};
@@ -131,7 +131,7 @@ sub atom_start {
 	# WwwAtomStream stats this dir for mtime
 	my $astream = PublicInbox::WwwAtomStream->new($ctx);
 	delete $astream->{emit_header};
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my $title = PublicInbox::WwwAtomStream::title_tag($ibx->description);
 	my $updated = PublicInbox::WwwAtomStream::feed_updated($mtime);
 	print $out <<EOF or die;
diff --git a/lib/PublicInbox/ExtMsg.pm b/lib/PublicInbox/ExtMsg.pm
index 2a579c1b..43acfb53 100644
--- a/lib/PublicInbox/ExtMsg.pm
+++ b/lib/PublicInbox/ExtMsg.pm
@@ -76,7 +76,7 @@ sub search_partial ($$) {
 sub ext_msg_i {
 	my ($other, $ctx) = @_;
 
-	return if $other->{name} eq $ctx->{-inbox}->{name} || !$other->base_url;
+	return if $other->{name} eq $ctx->{ibx}->{name} || !$other->base_url;
 
 	my $mm = $other->mm or return;
 
@@ -107,7 +107,7 @@ sub ext_msg_ALL ($) {
 	my ($ctx) = @_;
 	my $ALL = $ctx->{www}->{pi_config}->ALL or return;
 	my $by_eidx_key = $ctx->{www}->{pi_config}->{-by_eidx_key};
-	my $cur_key = $ctx->{-inbox}->eidx_key;
+	my $cur_key = $ctx->{ibx}->eidx_key;
 	my %seen = ($cur_key => 1);
 	my ($id, $prev);
 	while (my $x = $ALL->over->next_by_mid($ctx->{mid}, \$id, \$prev)) {
@@ -123,7 +123,7 @@ sub ext_msg_ALL ($) {
 	return exact($ctx) if $ctx->{found};
 
 	# fall back to partial MID matching
-	for my $ibxish ($ctx->{-inbox}, $ALL) {
+	for my $ibxish ($ctx->{ibx}, $ALL) {
 		my $mids = search_partial($ibxish, $ctx->{mid}) or next;
 		push @{$ctx->{partial}}, [ $ibxish, $mids ];
 		last if ($ctx->{n_partial} += scalar(@$mids)) >= PARTIAL_MAX;
@@ -169,7 +169,7 @@ sub finalize_exact {
 
 	# fall back to partial MID matching
 	my $mid = $ctx->{mid};
-	my $cur = $ctx->{-inbox};
+	my $cur = $ctx->{ibx};
 	my $mids = search_partial($cur, $mid);
 	if ($mids) {
 		$ctx->{n_partial} = scalar(@$mids);
@@ -200,7 +200,7 @@ sub partial_response ($) {
 		my $es = $n_partial == 1 ? '' : 'es';
 		$n_partial .= '+' if ($n_partial == PARTIAL_MAX);
 		$s .= "\n$n_partial partial match$es found:\n\n";
-		my $cur_name = $ctx->{-inbox}->{name};
+		my $cur_name = $ctx->{ibx}->{name};
 		foreach my $pair (@{$ctx->{partial}}) {
 			my ($ibx, $res) = @$pair;
 			my $env = $ctx->{env} if $ibx->{name} eq $cur_name;
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm
index 805076f0..4dd584d3 100644
--- a/lib/PublicInbox/Feed.pm
+++ b/lib/PublicInbox/Feed.pm
@@ -24,7 +24,7 @@ sub generate {
 
 sub generate_thread_atom {
 	my ($ctx) = @_;
-	my $msgs = $ctx->{msgs} = $ctx->{-inbox}->over->get_thread($ctx->{mid});
+	my $msgs = $ctx->{msgs} = $ctx->{ibx}->over->get_thread($ctx->{mid});
 	return _no_thread() unless @$msgs;
 	PublicInbox::WwwAtomStream->response($ctx, 200, \&generate_i);
 }
@@ -34,7 +34,7 @@ sub generate_html_index {
 	# if the 'r' query parameter is given, it is a legacy permalink
 	# which we must continue supporting:
 	my $qp = $ctx->{qp};
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	if ($qp && !$qp->{r} && $ibx->over) {
 		return PublicInbox::View::index_topics($ctx);
 	}
@@ -79,7 +79,7 @@ sub _no_thread () {
 
 sub recent_msgs {
 	my ($ctx) = @_;
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my $max = $ibx->{feedmax};
 	return PublicInbox::View::paginate_recent($ctx, $max) if $ibx->over;
 
diff --git a/lib/PublicInbox/Filter/RubyLang.pm b/lib/PublicInbox/Filter/RubyLang.pm
index 06e4ea75..62cf5d20 100644
--- a/lib/PublicInbox/Filter/RubyLang.pm
+++ b/lib/PublicInbox/Filter/RubyLang.pm
@@ -16,7 +16,7 @@ sub new {
 	my ($class, %opts) = @_;
 	my $altid = delete $opts{-altid};
 	my $self = $class->SUPER::new(%opts);
-	my $ibx = $self->{-inbox};
+	my $ibx = $self->{ibx};
 	# altid = serial:ruby-core:file=msgmap.sqlite3
 	if (!$altid && $ibx && $ibx->{altid}) {
 		$altid ||= $ibx->{altid}->[0];
diff --git a/lib/PublicInbox/GzipFilter.pm b/lib/PublicInbox/GzipFilter.pm
index 20030433..5f701673 100644
--- a/lib/PublicInbox/GzipFilter.pm
+++ b/lib/PublicInbox/GzipFilter.pm
@@ -169,7 +169,7 @@ sub async_blob_cb { # git->cat_async callback
 	if (!defined($oid)) {
 		# it's possible to have TOCTOU if an admin runs
 		# public-inbox-(edit|purge), just move onto the next message
-		warn "E: $smsg->{blob} missing in $self->{-inbox}->{inboxdir}\n";
+		warn "E: $smsg->{blob} missing in $self->{ibx}->{inboxdir}\n";
 		return $http->next_step($self->can('async_next'));
 	}
 	$smsg->{blob} eq $oid or bail($self, "BUG: $smsg->{blob} != $oid");
@@ -180,7 +180,7 @@ sub async_blob_cb { # git->cat_async callback
 
 sub smsg_blob {
 	my ($self, $smsg) = @_;
-	git_async_cat($self->{-inbox}->git, $smsg->{blob},
+	git_async_cat($self->{ibx}->git, $smsg->{blob},
 			\&async_blob_cb, $self);
 }
 
diff --git a/lib/PublicInbox/InboxWritable.pm b/lib/PublicInbox/InboxWritable.pm
index e97c7e2d..49809045 100644
--- a/lib/PublicInbox/InboxWritable.pm
+++ b/lib/PublicInbox/InboxWritable.pm
@@ -102,7 +102,7 @@ sub filter {
 			$im->done;
 		}
 
-		my @args = (-inbox => $self);
+		my @args = (ibx => $self);
 		# basic line splitting, only
 		# Perhaps we can have proper quote splitting one day...
 		($f, @args) = split(/\s+/, $f) if $f =~ /\s+/;
diff --git a/lib/PublicInbox/Mbox.pm b/lib/PublicInbox/Mbox.pm
index 0df31e7f..64de8c72 100644
--- a/lib/PublicInbox/Mbox.pm
+++ b/lib/PublicInbox/Mbox.pm
@@ -17,7 +17,7 @@ use PublicInbox::Eml;
 sub getline {
 	my ($ctx) = @_; # ctx
 	my $smsg = $ctx->{smsg} or return;
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my $eml = $ibx->smsg_eml($smsg) or return;
 	my $n = $ctx->{smsg} = $ibx->over->next_by_mid(@{$ctx->{next_arg}});
 	$ctx->zmore(msg_hdr($ctx, $eml, $smsg->{mid}));
@@ -44,7 +44,7 @@ sub async_eml { # for async_blob_cb
 	my ($ctx, $eml) = @_;
 	my $smsg = delete $ctx->{smsg};
 	# next message
-	$ctx->{smsg} = $ctx->{-inbox}->over->next_by_mid(@{$ctx->{next_arg}});
+	$ctx->{smsg} = $ctx->{ibx}->over->next_by_mid(@{$ctx->{next_arg}});
 
 	$ctx->zmore(msg_hdr($ctx, $eml, $smsg->{mid}));
 	$ctx->{http_out}->write($ctx->translate(msg_body($eml)));
@@ -56,7 +56,7 @@ sub res_hdr ($$) {
 	$fn =~ s/^re:\s+//i;
 	$fn = to_filename($fn) // 'no-subject';
 	my @hdr = ('Content-Type');
-	if ($ctx->{-inbox}->{obfuscate}) {
+	if ($ctx->{ibx}->{obfuscate}) {
 		# obfuscation is stupid, but maybe scrapers are, too...
 		push @hdr, 'application/mbox';
 		$fn .= '.mbox';
@@ -71,7 +71,7 @@ sub res_hdr ($$) {
 # for rare cases where v1 inboxes aren't indexed w/ ->over at all
 sub no_over_raw ($) {
 	my ($ctx) = @_;
-	my $mref = $ctx->{-inbox}->msg_by_mid($ctx->{mid}) or return;
+	my $mref = $ctx->{ibx}->msg_by_mid($ctx->{mid}) or return;
 	my $eml = PublicInbox::Eml->new($mref);
 	[ 200, res_hdr($ctx, $eml->header_str('Subject')),
 		[ msg_hdr($ctx, $eml, $ctx->{mid}) . msg_body($eml) ] ]
@@ -80,8 +80,8 @@ sub no_over_raw ($) {
 # /$INBOX/$MESSAGE_ID/raw
 sub emit_raw {
 	my ($ctx) = @_;
-	$ctx->{base_url} = $ctx->{-inbox}->base_url($ctx->{env});
-	my $over = $ctx->{-inbox}->over or return no_over_raw($ctx);
+	$ctx->{base_url} = $ctx->{ibx}->base_url($ctx->{env});
+	my $over = $ctx->{ibx}->over or return no_over_raw($ctx);
 	my ($id, $prev);
 	my $mip = $ctx->{next_arg} = [ $ctx->{mid}, \$id, \$prev ];
 	my $smsg = $ctx->{smsg} = $over->next_by_mid(@$mip) or return;
@@ -99,7 +99,7 @@ sub msg_hdr ($$;$) {
 	foreach my $d (qw(Lines Bytes Content-Length Status)) {
 		$header_obj->header_set($d);
 	}
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my $base = $ctx->{base_url};
 	$mid = $ctx->{mid} unless defined $mid;
 	$mid = mid_escape($mid);
@@ -190,7 +190,7 @@ sub all_ids_cb {
 
 sub mbox_all_ids {
 	my ($ctx) = @_;
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my $prev = 0;
 	my $mm = $ctx->{mm} = $ibx->mm;
 	my $ids = $mm->ids_after(\$prev) or return
@@ -205,20 +205,20 @@ sub mbox_all_ids {
 
 sub gone ($$) {
 	my ($ctx, $what) = @_;
-	warn "W: `$ctx->{-inbox}->{inboxdir}' $what went away unexpectedly\n";
+	warn "W: `$ctx->{ibx}->{inboxdir}' $what went away unexpectedly\n";
 	undef;
 }
 
 sub results_cb {
 	my ($ctx) = @_;
-	my $over = $ctx->{-inbox}->over or return gone($ctx, 'over');
+	my $over = $ctx->{ibx}->over or return gone($ctx, 'over');
 	while (1) {
 		while (defined(my $num = shift(@{$ctx->{ids}}))) {
 			my $smsg = $over->get_art($num) or next;
 			return $smsg;
 		}
 		# refill result set
-		my $srch = $ctx->{-inbox}->isrch or return gone($ctx, 'search');
+		my $srch = $ctx->{ibx}->isrch or return gone($ctx, 'search');
 		my $mset = $srch->mset($ctx->{query}, $ctx->{qopts});
 		my $size = $mset->size or return;
 		$ctx->{qopts}->{offset} += $size;
@@ -229,7 +229,7 @@ sub results_cb {
 sub results_thread_cb {
 	my ($ctx) = @_;
 
-	my $over = $ctx->{-inbox}->over or return gone($ctx, 'over');
+	my $over = $ctx->{ibx}->over or return gone($ctx, 'over');
 	while (1) {
 		while (defined(my $num = shift(@{$ctx->{xids}}))) {
 			my $smsg = $over->get_art($num) or next;
@@ -240,7 +240,7 @@ sub results_thread_cb {
 		next if $over->expand_thread($ctx);
 
 		# refill result set
-		my $srch = $ctx->{-inbox}->isrch or return gone($ctx, 'search');
+		my $srch = $ctx->{ibx}->isrch or return gone($ctx, 'search');
 		my $mset = $srch->mset($ctx->{query}, $ctx->{qopts});
 		my $size = $mset->size or return;
 		$ctx->{qopts}->{offset} += $size;
@@ -253,9 +253,9 @@ sub mbox_all {
 	my ($ctx, $q) = @_;
 	my $q_string = $q->{'q'};
 	return mbox_all_ids($ctx) if $q_string !~ /\S/;
-	my $srch = $ctx->{-inbox}->isrch or
+	my $srch = $ctx->{ibx}->isrch or
 		return PublicInbox::WWW::need($ctx, 'Search');
-	my $over = $ctx->{-inbox}->over or
+	my $over = $ctx->{ibx}->over or
 		return PublicInbox::WWW::need($ctx, 'Overview');
 
 	my $qopts = $ctx->{qopts} = { mset => 2 }; # order by docid
diff --git a/lib/PublicInbox/MboxGz.pm b/lib/PublicInbox/MboxGz.pm
index 913be6e4..ab3c9770 100644
--- a/lib/PublicInbox/MboxGz.pm
+++ b/lib/PublicInbox/MboxGz.pm
@@ -22,7 +22,7 @@ sub async_next ($) {
 sub mbox_gz {
 	my ($self, $cb, $fn) = @_;
 	$self->{cb} = $cb;
-	$self->{base_url} = $self->{-inbox}->base_url($self->{env});
+	$self->{base_url} = $self->{ibx}->base_url($self->{env});
 	$self->{gz} = PublicInbox::GzipFilter::gzip_or_die();
 	$fn = to_filename($fn // '') // 'no-subject';
 	# http://www.iana.org/assignments/media-types/application/gzip
@@ -37,7 +37,7 @@ sub getline {
 	my ($self) = @_;
 	my $cb = $self->{cb} or return;
 	while (my $smsg = $cb->($self)) {
-		my $eml = $self->{-inbox}->smsg_eml($smsg) or next;
+		my $eml = $self->{ibx}->smsg_eml($smsg) or next;
 		$self->zmore(msg_hdr($self, $eml, $smsg->{mid}));
 		return $self->translate(msg_body($eml));
 	}
diff --git a/lib/PublicInbox/SearchThread.pm b/lib/PublicInbox/SearchThread.pm
index 60f692b2..8fb3a030 100644
--- a/lib/PublicInbox/SearchThread.pm
+++ b/lib/PublicInbox/SearchThread.pm
@@ -42,7 +42,7 @@ sub thread {
 	# We'll trust the client Date: header here instead of the Received:
 	# time since this is for display (and not retrieval)
 	_set_parent(\%id_table, $_) for sort { $a->{ds} <=> $b->{ds} } @$msgs;
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my $rootset = [ grep {
 			!delete($_->{parent}) && $_->visible($ibx)
 		} values %id_table ];
@@ -166,7 +166,7 @@ sub order_children {
 
 	my %seen = ($cur => 1); # self-referential loop prevention
 	my @q = ($cur);
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	while (defined($cur = shift @q)) {
 		my $c = $cur->{children}; # The hashref here...
 
diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm
index f3c96126..f568f31c 100644
--- a/lib/PublicInbox/SearchView.pm
+++ b/lib/PublicInbox/SearchView.pm
@@ -30,7 +30,7 @@ sub mbox_results {
 
 sub sres_top_html {
 	my ($ctx) = @_;
-	my $srch = $ctx->{-inbox}->isrch or
+	my $srch = $ctx->{ibx}->isrch or
 		return PublicInbox::WWW::need($ctx, 'Search');
 	my $q = PublicInbox::SearchQuery->new($ctx->{qp});
 	my $x = $q->{x};
@@ -93,7 +93,7 @@ sub mset_summary {
 	my $pad = length("$total");
 	my $pfx = ' ' x $pad;
 	my $res = \($ctx->{-html_tip});
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my $obfs_ibx = $ibx->{obfuscate} ? $ibx : undef;
 	my @nums = @{$ibx->isrch->mset_to_artnums($mset)};
 	my %num2msg = map { $_->{num} => $_ } @{$ibx->over->get_all(@nums)};
@@ -156,7 +156,7 @@ sub path2inc ($) {
 
 sub err_txt {
 	my ($ctx, $err) = @_;
-	my $u = $ctx->{-inbox}->base_url($ctx->{env}) . '_/text/help/';
+	my $u = $ctx->{ibx}->base_url($ctx->{env}) . '_/text/help/';
 	$err =~ s/^\s*Exception:\s*//; # bad word to show users :P
 	$err =~ s!(\S+)!path2inc($1)!sge;
 	$err = ascii_html($err);
@@ -201,7 +201,7 @@ sub search_nav_top {
 	}
 	my $A = $q->qs_html(x => 'A', r => undef);
 	$rv .= qq{|<a\nhref="?$A">Atom feed</a>]};
-	if ($ctx->{-inbox}->isrch->has_threadid) {
+	if ($ctx->{ibx}->isrch->has_threadid) {
 		$rv .= qq{\n\t\t\tdownload mbox.gz: } .
 			# we set name=z w/o using it since it seems required for
 			# lynx (but works fine for w3m).
@@ -286,7 +286,7 @@ sub get_pct ($) {
 
 sub mset_thread {
 	my ($ctx, $mset, $q) = @_;
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my @pct = map { get_pct($_) } $mset->items;
 	my $msgs = $ibx->isrch->mset_to_smsg($ibx, $mset);
 	my $i = 0;
@@ -353,7 +353,7 @@ sub ctx_prepare {
 
 sub adump {
 	my ($cb, $mset, $q, $ctx) = @_;
-	$ctx->{ids} = $ctx->{-inbox}->isrch->mset_to_artnums($mset);
+	$ctx->{ids} = $ctx->{ibx}->isrch->mset_to_artnums($mset);
 	$ctx->{search_query} = $q; # used by WwwAtomStream::atom_header
 	PublicInbox::WwwAtomStream->response($ctx, 200, \&adump_i);
 }
@@ -362,7 +362,7 @@ sub adump {
 sub adump_i {
 	my ($ctx) = @_;
 	while (my $num = shift @{$ctx->{ids}}) {
-		my $smsg = eval { $ctx->{-inbox}->over->get_art($num) } or next;
+		my $smsg = eval { $ctx->{ibx}->over->get_art($num) } or next;
 		return $smsg;
 	}
 }
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 1d5119cd..a27e9369 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -48,7 +48,7 @@ sub msg_page_i {
 # /$INBOX/$MSGID/ for unindexed v1 inboxes
 sub no_over_html ($) {
 	my ($ctx) = @_;
-	my $bref = $ctx->{-inbox}->msg_by_mid($ctx->{mid}) or return; # 404
+	my $bref = $ctx->{ibx}->msg_by_mid($ctx->{mid}) or return; # 404
 	my $eml = PublicInbox::Eml->new($bref);
 	$ctx->{mhref} = '';
 	PublicInbox::WwwStream::init($ctx);
@@ -64,7 +64,7 @@ sub no_over_html ($) {
 
 sub msg_page {
 	my ($ctx) = @_;
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	$ctx->{-obfs_ibx} = $ibx->{obfuscate} ? $ibx : undef;
 	my $over = $ctx->{over} = $ibx->over or return no_over_html($ctx);
 	my ($id, $prev);
@@ -88,7 +88,7 @@ sub msg_reply ($$) {
 	 'https://en.wikipedia.org/wiki/Posting_style#Interleaved_style';
 
 	my $info = '';
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	if (my $url = $ibx->{infourl}) {
 		$url = prurl($ctx->{env}, $url);
 		$info = qq(\n  List information: <a\nhref="$url">$url</a>\n);
@@ -421,7 +421,7 @@ sub stream_thread ($$) {
 sub thread_html {
 	my ($ctx) = @_;
 	my $mid = $ctx->{mid};
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my ($nr, $msgs) = $ibx->over->get_thread($mid);
 	return missing_thread($ctx) if $nr == 0;
 
@@ -554,7 +554,7 @@ EOF
 sub add_text_body { # callback for each_part
 	my ($p, $ctx) = @_;
 	my $upfx = $ctx->{mhref};
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my $l = $ctx->{-linkify} //= PublicInbox::Linkify->new;
 	# $p - from each_part: [ Email::MIME-like, depth, $idx ]
 	my ($part, $depth, $idx) = @$p;
@@ -639,7 +639,7 @@ sub add_text_body { # callback for each_part
 
 sub _msg_page_prepare_obuf {
 	my ($eml, $ctx) = @_;
-	my $over = $ctx->{-inbox}->over;
+	my $over = $ctx->{ibx}->over;
 	my $obfs_ibx = $ctx->{-obfs_ibx};
 	my $rv = '';
 	my $mids = mids_for_index($eml);
@@ -729,7 +729,7 @@ sub SKEL_EXPAND () {
 sub thread_skel ($$$) {
 	my ($skel, $ctx, $hdr) = @_;
 	my $mid = mids($hdr)->[0];
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my ($nr, $msgs) = $ibx->over->get_thread($mid);
 	my $parent = in_reply_to($hdr);
 	$$skel .= "\n<b>Thread overview: </b>";
@@ -800,7 +800,7 @@ sub _parent_headers {
 # returns a string buffer
 sub html_footer {
 	my ($ctx, $hdr) = @_;
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my $upfx = '../';
 	my $skel;
 	my $rv = '<pre>';
@@ -1072,7 +1072,7 @@ sub acc_topic { # walk_thread callback
 	my ($ctx, $level, $smsg) = @_;
 	my $mid = $smsg->{mid};
 	my $has_blob = $smsg->{blob} // do {
-		if (my $by_mid = $ctx->{-inbox}->smsg_by_mid($mid)) {
+		if (my $by_mid = $ctx->{ibx}->smsg_by_mid($mid)) {
 			%$smsg = (%$smsg, %$by_mid);
 			1;
 		}
@@ -1116,7 +1116,7 @@ sub dump_topics {
 	}
 
 	my @out;
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my $obfs_ibx = $ibx->{obfuscate} ? $ibx : undef;
 
 	# sort by recency, this allows new posts to "bump" old topics...
@@ -1194,7 +1194,7 @@ sub paginate_recent ($$) {
 	$t =~ s/\A([0-9]{8,14})-// and $after = str2ts($1);
 	$t =~ /\A([0-9]{8,14})\z/ and $before = str2ts($1);
 
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my $msgs = $ibx->recent($opts, $after, $before);
 	my $nr = scalar @$msgs;
 	if ($nr < $lim && defined($after)) {
diff --git a/lib/PublicInbox/ViewVCS.pm b/lib/PublicInbox/ViewVCS.pm
index 87927d5e..3f34ea82 100644
--- a/lib/PublicInbox/ViewVCS.pm
+++ b/lib/PublicInbox/ViewVCS.pm
@@ -197,7 +197,7 @@ sub show ($$;$) {
 
 	$ctx->{'log'} = tmpfile("solve.$oid_b");
 	$ctx->{fn} = $fn;
-	my $solver = PublicInbox::SolverGit->new($ctx->{-inbox},
+	my $solver = PublicInbox::SolverGit->new($ctx->{ibx},
 						\&solve_result, $ctx);
 	# PSGI server will call this immediately and give us a callback (-wcb)
 	sub {
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index fc208816..6bae2190 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -213,7 +213,7 @@ sub invalid_inbox ($$) {
 	my $ibx = $ctx->{www}->{pi_config}->lookup_name($inbox) //
 			$ctx->{www}->{pi_config}->lookup_ei($inbox);
 	if (defined $ibx) {
-		$ctx->{-inbox} = $ibx;
+		$ctx->{ibx} = $ibx;
 		return;
 	}
 
@@ -231,11 +231,11 @@ sub invalid_inbox_mid {
 	return $ret if $ret;
 
 	my $mid = $ctx->{mid} = uri_unescape($mid_ue);
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	if ($mid =~ m!\A([a-f0-9]{2})([a-f0-9]{38})\z!) {
 		my ($x2, $x38) = ($1, $2);
 		# this is horrifically wasteful for legacy URLs:
-		my $str = $ctx->{-inbox}->msg_by_path("$x2/$x38") or return;
+		my $str = $ctx->{ibx}->msg_by_path("$x2/$x38") or return;
 		my $s = PublicInbox::Eml->new($str);
 		$mid = PublicInbox::MID::mid_clean($s->header_raw('Message-ID'));
 		return r301($ctx, $inbox, mid_escape($mid));
@@ -286,7 +286,7 @@ sub get_mid_html {
 # /$INBOX/$MESSAGE_ID/t/
 sub get_thread {
 	my ($ctx, $flat) = @_;
-	$ctx->{-inbox}->over or return need($ctx, 'Overview');
+	$ctx->{ibx}->over or return need($ctx, 'Overview');
 	$ctx->{flat} = $flat;
 	require PublicInbox::View;
 	PublicInbox::View::thread_html($ctx);
@@ -339,7 +339,7 @@ EOF
 # especially on older systems.  Stick to zlib since that's what git uses.
 sub get_thread_mbox {
 	my ($ctx, $sfx) = @_;
-	my $over = $ctx->{-inbox}->over or return need($ctx, 'Overview');
+	my $over = $ctx->{ibx}->over or return need($ctx, 'Overview');
 	require PublicInbox::Mbox;
 	PublicInbox::Mbox::thread_mbox($ctx, $over, $sfx);
 }
@@ -348,7 +348,7 @@ sub get_thread_mbox {
 # /$INBOX/$MESSAGE_ID/t.atom		  -> thread as Atom feed
 sub get_thread_atom {
 	my ($ctx) = @_;
-	$ctx->{-inbox}->over or return need($ctx, 'Overview');
+	$ctx->{ibx}->over or return need($ctx, 'Overview');
 	require PublicInbox::Feed;
 	PublicInbox::Feed::generate_thread_atom($ctx);
 }
@@ -413,11 +413,11 @@ sub legacy_redirects {
 
 sub r301 {
 	my ($ctx, $inbox, $mid_ue, $suffix) = @_;
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	unless ($ibx) {
 		my $r404 = invalid_inbox($ctx, $inbox);
 		return $r404 if $r404;
-		$ibx = $ctx->{-inbox};
+		$ibx = $ctx->{ibx};
 	}
 	my $url = $ibx->base_url($ctx->{env});
 	my $qs = $ctx->{env}->{QUERY_STRING};
@@ -454,7 +454,7 @@ sub msg_page {
 sub serve_git {
 	my ($ctx, $epoch, $path) = @_;
 	my $env = $ctx->{env};
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my $git = defined $epoch ? $ibx->git_epoch($epoch) : $ibx->git;
 	$git ? PublicInbox::GitHTTPBackend::serve($env, $git, $path) : r404();
 }
@@ -462,7 +462,7 @@ sub serve_git {
 sub mbox_results {
 	my ($ctx) = @_;
 	if ($ctx->{env}->{QUERY_STRING} =~ /(?:\A|[&;])q=/) {
-		$ctx->{-inbox}->isrch or return need($ctx, 'search');
+		$ctx->{ibx}->isrch or return need($ctx, 'search');
 		require PublicInbox::SearchView;
 		return PublicInbox::SearchView::mbox_results($ctx);
 	}
@@ -642,7 +642,7 @@ sub get_css ($$$) {
 	my $css = $css_map->{$key};
 	if (!defined($css) && $key eq 'userContent') {
 		my $env = $ctx->{env};
-		$css = PublicInbox::UserContent::sample($ctx->{-inbox}, $env);
+		$css = PublicInbox::UserContent::sample($ctx->{ibx}, $env);
 	}
 	defined $css or return r404();
 	my $h = [ 'Content-Length', bytes::length($css),
@@ -654,7 +654,7 @@ sub get_css ($$$) {
 sub get_description {
 	my ($ctx, $inbox) = @_;
 	invalid_inbox($ctx, $inbox) || do {
-		my $d = $ctx->{-inbox}->description . "\n";
+		my $d = $ctx->{ibx}->description . "\n";
 		[ 200, [ 'Content-Length', bytes::length($d),
 			'Content-Type', 'text/plain' ], [ $d ] ];
 	};
diff --git a/lib/PublicInbox/WwwAltId.pm b/lib/PublicInbox/WwwAltId.pm
index 2818400e..204e2f82 100644
--- a/lib/PublicInbox/WwwAltId.pm
+++ b/lib/PublicInbox/WwwAltId.pm
@@ -30,7 +30,7 @@ sub check_output {
 sub sqldump ($$) {
 	my ($ctx, $altid_pfx) = @_;
 	my $env = $ctx->{env};
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my $altid_map = $ibx->altid_map;
 	my $fn = $altid_map->{$altid_pfx};
 	unless (defined $fn) {
diff --git a/lib/PublicInbox/WwwAtomStream.pm b/lib/PublicInbox/WwwAtomStream.pm
index 388def12..912f860e 100644
--- a/lib/PublicInbox/WwwAtomStream.pm
+++ b/lib/PublicInbox/WwwAtomStream.pm
@@ -15,7 +15,7 @@ use PublicInbox::MsgTime qw(msg_timestamp);
 
 sub new {
 	my ($class, $ctx, $cb) = @_;
-	$ctx->{feed_base_url} = $ctx->{-inbox}->base_url($ctx->{env});
+	$ctx->{feed_base_url} = $ctx->{ibx}->base_url($ctx->{env});
 	$ctx->{cb} = $cb || \&PublicInbox::GzipFilter::close;
 	$ctx->{emit_header} = 1;
 	bless $ctx, $class;
@@ -53,7 +53,7 @@ sub getline {
 	my ($self) = @_;
 	my $cb = $self->{cb} or return;
 	while (my $smsg = $cb->($self)) {
-		my $eml = $self->{-inbox}->smsg_eml($smsg) or next;
+		my $eml = $self->{ibx}->smsg_eml($smsg) or next;
 		return $self->translate(feed_entry($self, $smsg, $eml));
 	}
 	delete $self->{cb};
@@ -82,7 +82,7 @@ sub to_uuid ($) {
 
 sub atom_header {
 	my ($ctx, $title) = @_;
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my $base_url = $ctx->{feed_base_url};
 	my $search_q = $ctx->{search_query};
 	my $self_url = $base_url;
@@ -136,10 +136,10 @@ sub feed_entry {
 	$title = title_tag($title);
 
 	my $from = $eml->header('From') // $eml->header('Sender') //
-		$ctx->{-inbox}->{-primary_address};
+		$ctx->{ibx}->{-primary_address};
 	my ($email) = PublicInbox::Address::emails($from);
 	my $name = ascii_html(join(', ', PublicInbox::Address::names($from)));
-	$email = ascii_html($email // $ctx->{-inbox}->{-primary_address});
+	$email = ascii_html($email // $ctx->{ibx}->{-primary_address});
 
 	my $s = delete($ctx->{emit_header}) ? atom_header($ctx, $title) : '';
 	$s .= "<entry><author><name>$name</name><email>$email</email>" .
diff --git a/lib/PublicInbox/WwwAttach.pm b/lib/PublicInbox/WwwAttach.pm
index 09c66d02..0fe63e42 100644
--- a/lib/PublicInbox/WwwAttach.pm
+++ b/lib/PublicInbox/WwwAttach.pm
@@ -16,7 +16,7 @@ sub referer_match ($) {
 	return 1 if $referer eq ''; # no referer is always OK for wget/curl
 
 	# prevent deep-linking from other domains on some browsers (Firefox)
-	# n.b.: $ctx->{-inbox}->base_url($env) with INBOX_URL won't work
+	# n.b.: $ctx->{ibx}->base_url($env) with INBOX_URL won't work
 	# with dillo, we can only match "$url_scheme://$HTTP_HOST/" without
 	# path components
 	my $base_url = $env->{'psgi.url_scheme'} . '://' .
@@ -88,15 +88,15 @@ sub get_attach ($$$) {
 	$ctx->{idx} = $idx;
 	bless $ctx, __PACKAGE__;
 	my $eml;
-	if ($ctx->{smsg} = $ctx->{-inbox}->smsg_by_mid($ctx->{mid})) {
+	if ($ctx->{smsg} = $ctx->{ibx}->smsg_by_mid($ctx->{mid})) {
 		return sub { # public-inbox-httpd-only
 			$ctx->{wcb} = $_[0];
 			scan_attach($ctx);
 		} if $ctx->{env}->{'pi-httpd.async'};
 		# generic PSGI:
-		$eml = $ctx->{-inbox}->smsg_eml($ctx->{smsg});
-	} elsif (!$ctx->{-inbox}->over) {
-		if (my $bref = $ctx->{-inbox}->msg_by_mid($ctx->{mid})) {
+		$eml = $ctx->{ibx}->smsg_eml($ctx->{smsg});
+	} elsif (!$ctx->{ibx}->over) {
+		if (my $bref = $ctx->{ibx}->msg_by_mid($ctx->{mid})) {
 			$eml = PublicInbox::Eml->new($bref);
 		}
 	}
diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index 2527b8ed..849831a6 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -16,7 +16,7 @@ our $CODE_URL = 'https://public-inbox.org/public-inbox.git';
 
 sub base_url ($) {
 	my $ctx = shift;
-	my $base_url = $ctx->{-inbox}->base_url($ctx->{env});
+	my $base_url = $ctx->{ibx}->base_url($ctx->{env});
 	chop $base_url; # no trailing slash for clone
 	$base_url;
 }
@@ -35,7 +35,7 @@ sub async_eml { # for async_blob_cb
 
 sub html_top ($) {
 	my ($ctx) = @_;
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my $desc = ascii_html($ibx->description);
 	my $title = delete($ctx->{-title_html}) // $desc;
 	my $upfx = $ctx->{-upfx} || '';
@@ -78,7 +78,7 @@ sub html_top ($) {
 
 sub coderepos ($) {
 	my ($ctx) = @_;
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my @ret;
 	if (defined(my $cr = $ibx->{coderepo})) {
 		my $cfg = $ctx->{www}->{pi_config};
@@ -109,7 +109,7 @@ sub _html_end {
 id=mirror>This inbox may be cloned and mirrored by anyone:</a>
 EOF
 
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my $desc = ascii_html($ibx->description);
 
 	my @urls;
@@ -184,7 +184,7 @@ sub getline {
 	my $cb = $ctx->{cb} or return;
 	while (defined(my $x = $cb->($ctx))) { # x = smsg or scalar non-ref
 		if (ref($x)) { # smsg
-			my $eml = $ctx->{-inbox}->smsg_eml($x) or next;
+			my $eml = $ctx->{ibx}->smsg_eml($x) or next;
 			$ctx->{smsg} = $x;
 			return $ctx->translate($cb->($ctx, $eml));
 		} else { # scalar
diff --git a/lib/PublicInbox/WwwText.pm b/lib/PublicInbox/WwwText.pm
index 8cc818df..53e15e45 100644
--- a/lib/PublicInbox/WwwText.pm
+++ b/lib/PublicInbox/WwwText.pm
@@ -49,7 +49,7 @@ sub get_text {
 
 	# enforce trailing slash for "wget -r" compatibility
 	if (!$have_tslash && $code == 200) {
-		my $url = $ctx->{-inbox}->base_url($env);
+		my $url = $ctx->{ibx}->base_url($env);
 		$url .= "_/text/$key/";
 
 		return [ 302, [ 'Content-Type', 'text/plain',
@@ -100,7 +100,7 @@ sub _srch_prefix ($$) {
 
 sub _colors_help ($$) {
 	my ($ctx, $txt) = @_;
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my $env = $ctx->{env};
 	my $base_url = $ibx->base_url($env);
 	$$txt .= "color customization for $base_url\n";
@@ -135,7 +135,7 @@ sub URI_PATH () { '^A-Za-z0-9\-\._~/' }
 # n.b. this is a perfect candidate for memoization
 sub inbox_config ($$$) {
 	my ($ctx, $hdr, $txt) = @_;
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	push @$hdr, 'Content-Disposition', 'inline; filename=inbox.config';
 	my $name = dq_escape($ibx->{name});
 	my $inboxdir = '/path/to/top-level-inbox';
@@ -221,7 +221,7 @@ sub _default_text ($$$$) {
 	return inbox_config($ctx, $hdr, $txt) if $key eq 'config';
 	return if $key ne 'help'; # TODO more keys?
 
-	my $ibx = $ctx->{-inbox};
+	my $ibx = $ctx->{ibx};
 	my $base_url = $ibx->base_url($ctx->{env});
 	$$txt .= "public-inbox help for $base_url\n";
 	$$txt .= <<EOF;
diff --git a/t/feed.t b/t/feed.t
index 5ad90a07..9f6a987b 100644
--- a/t/feed.t
+++ b/t/feed.t
@@ -75,7 +75,7 @@ EOF
 {
 	# check initial feed
 	{
-		my $feed = string_feed({ -inbox => $ibx });
+		my $feed = string_feed({ ibx => $ibx });
 		SKIP: {
 			skip 'XML::TreePP missing', 3 unless $have_xml_treepp;
 			my $t = XML::TreePP->new->parse($feed);
@@ -109,7 +109,7 @@ EOF
 
 	# check spam shows up
 	{
-		my $spammy_feed = string_feed({ -inbox => $ibx });
+		my $spammy_feed = string_feed({ ibx => $ibx });
 		SKIP: {
 			skip 'XML::TreePP missing', 2 unless $have_xml_treepp;
 			my $t = XML::TreePP->new->parse($spammy_feed);
@@ -127,7 +127,7 @@ EOF
 
 	# spam no longer shows up
 	{
-		my $feed = string_feed({ -inbox => $ibx });
+		my $feed = string_feed({ ibx => $ibx });
 		SKIP: {
 			skip 'XML::TreePP missing', 2 unless $have_xml_treepp;
 			my $t = XML::TreePP->new->parse($feed);
diff --git a/t/filter_rubylang.t b/t/filter_rubylang.t
index e6c53f98..6d639c00 100644
--- a/t/filter_rubylang.t
+++ b/t/filter_rubylang.t
@@ -35,7 +35,7 @@ SKIP: {
 	];
 	my $ibx = PublicInbox::Inbox->new({ inboxdir => $git_dir,
 						altid => $altid });
-	$f = PublicInbox::Filter::RubyLang->new(-inbox => $ibx);
+	$f = PublicInbox::Filter::RubyLang->new(ibx => $ibx);
 	$msg = <<'EOF';
 X-Mail-Count: 12
 Message-ID: <a@b>
diff --git a/xt/cmp-msgview.t b/xt/cmp-msgview.t
index 5bd7aa17..24151267 100644
--- a/xt/cmp-msgview.t
+++ b/xt/cmp-msgview.t
@@ -24,7 +24,7 @@ vec(my $vec = '', fileno($fh), 1) = 1;
 select($vec, undef, undef, 60) or die "timed out waiting for --batch-check";
 my $mime_ctx = {
 	env => { HTTP_HOST => 'example.com', 'psgi.url_scheme' => 'https' },
-	-inbox => $ibx,
+	ibx => $ibx,
 	www => Plack::Util::inline_object(style => sub {''}),
 	obuf => \(my $mime_buf = ''),
 	mhref => '../',
diff --git a/xt/perf-msgview.t b/xt/perf-msgview.t
index d99101a3..30e133d7 100644
--- a/xt/perf-msgview.t
+++ b/xt/perf-msgview.t
@@ -29,7 +29,7 @@ select($vec, undef, undef, 60) or die "timed out waiting for --batch-check";
 
 my $ctx = {
 	env => { HTTP_HOST => 'example.com', 'psgi.url_scheme' => 'https' },
-	-inbox => $ibx,
+	ibx => $ibx,
 	www => Plack::Util::inline_object(style => sub {''}),
 };
 my ($mime, $res, $oid, $type);
diff --git a/xt/perf-threading.t b/xt/perf-threading.t
index b27c9cbd..472c1953 100644
--- a/xt/perf-threading.t
+++ b/xt/perf-threading.t
@@ -25,7 +25,7 @@ ok($n, 'got some messages');
 diag "enquire: ".timestr($elapsed)." for $n";
 
 $elapsed = timeit(1, sub {
-	PublicInbox::View::thread_results({-inbox => $ibx}, $msgs);
+	PublicInbox::View::thread_results({ibx => $ibx}, $msgs);
 });
 diag "thread_results ".timestr($elapsed);
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/6] nntp: replace {ng} with {ibx} for consistency
  2020-12-08 21:21 [PATCH 0/6] minor internal consistency things Eric Wong
  2020-12-08 21:21 ` [PATCH 1/6] treewide: replace {-inbox} with {ibx} for consistency Eric Wong
@ 2020-12-08 21:21 ` Eric Wong
  2020-12-08 21:21 ` [PATCH 3/6] rename {pi_config} fields to {pi_cfg} Eric Wong
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Eric Wong @ 2020-12-08 21:21 UTC (permalink / raw)
  To: meta

They're PublicInbox::Inbox objects just like the rest of
the non-NNTP code.  So rename the NNTP code for consistency
with the rest of the codebase.  Furthermore, {ng} and $ng
may be confused with the `--ng' switch for -init, and that's
a non-ref scalar string.
---
 lib/PublicInbox/NNTP.pm | 102 ++++++++++++++++++++--------------------
 t/nntp.t                |  10 ++--
 2 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index 05d2d13b..766ea89e 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -5,7 +5,7 @@
 # fields:
 # nntpd: PublicInbox::NNTPD ref
 # article: per-session current article number
-# ng: PublicInbox::Inbox ref
+# ibx: PublicInbox::Inbox ref
 # long_cb: long_response private data
 package PublicInbox::NNTP;
 use strict;
@@ -202,7 +202,7 @@ sub cmd_list ($;$$) {
 
 sub listgroup_range_i {
 	my ($self, $beg, $end) = @_;
-	my $r = $self->{ng}->mm->msg_range($beg, $end, 'num');
+	my $r = $self->{ibx}->mm->msg_range($beg, $end, 'num');
 	scalar(@$r) or return;
 	$self->msg_more(join('', map { "$_->[0]\r\n" } @$r));
 	1;
@@ -210,7 +210,7 @@ sub listgroup_range_i {
 
 sub listgroup_all_i {
 	my ($self, $num) = @_;
-	my $ary = $self->{ng}->mm->ids_after($num);
+	my $ary = $self->{ibx}->mm->ids_after($num);
 	scalar(@$ary) or return;
 	more($self, join("\r\n", @$ary));
 	1;
@@ -223,7 +223,7 @@ sub cmd_listgroup ($;$$) {
 		return $res if ($res !~ /\A211 /);
 		more($self, $res);
 	}
-	$self->{ng} or return '412 no newsgroup selected';
+	$self->{ibx} or return '412 no newsgroup selected';
 	if (defined $range) {
 		my $r = get_range($self, $range);
 		return $r unless ref $r;
@@ -260,9 +260,9 @@ sub parse_time ($$;$) {
 }
 
 sub group_line ($$) {
-	my ($self, $ng) = @_;
-	my ($min, $max) = $ng->mm->minmax;
-	more($self, "$ng->{newsgroup} $max $min n");
+	my ($self, $ibx) = @_;
+	my ($min, $max) = $ibx->mm->minmax;
+	more($self, "$ibx->{newsgroup} $max $min n");
 }
 
 sub newgroups_i {
@@ -366,7 +366,7 @@ sub cmd_group ($$) {
 		return '411 no such news group';
 	$nntpd->idler_start;
 
-	$self->{ng} = $ibx;
+	$self->{ibx} = $ibx;
 	my ($min, $max) = $ibx->mm->minmax;
 	$self->{article} = $min;
 	my $est_size = $max - $min;
@@ -375,13 +375,13 @@ sub cmd_group ($$) {
 
 sub article_adj ($$) {
 	my ($self, $off) = @_;
-	my $ng = $self->{ng} or return '412 no newsgroup selected';
+	my $ibx = $self->{ibx} or return '412 no newsgroup selected';
 
 	my $n = $self->{article};
 	defined $n or return '420 no current article has been selected';
 
 	$n += $off;
-	my $mid = $ng->mm->mid_for($n);
+	my $mid = $ibx->mm->mid_for($n);
 	unless ($mid) {
 		$n = $off > 0 ? 'next' : 'previous';
 		return "421 no $n article in this group";
@@ -397,8 +397,8 @@ sub cmd_last ($) { article_adj($_[0], -1) }
 # the single-point-of-failure a single server provides.
 sub cmd_post ($) {
 	my ($self) = @_;
-	my $ng = $self->{ng};
-	$ng ? "440 mailto:$ng->{-primary_address} to post"
+	my $ibx = $self->{ibx};
+	$ibx ? "440 mailto:$ibx->{-primary_address} to post"
 		: '440 posting not allowed'
 }
 
@@ -516,7 +516,7 @@ sub art_lookup ($$$) {
 		$err = '420 no current article has been selected';
 		$n = $self->{article} // return $err;
 find_ibx:
-		$ibx = $self->{ng} or
+		$ibx = $self->{ibx} or
 				return '412 no newsgroup has been selected';
 	}
 found:
@@ -631,10 +631,10 @@ sub cmd_help ($) {
 
 sub get_range ($$) {
 	my ($self, $range) = @_;
-	my $ng = $self->{ng} or return '412 no news group has been selected';
+	my $ibx = $self->{ibx} or return '412 no news group has been selected';
 	defined $range or return '420 No article(s) selected';
 	my ($beg, $end);
-	my ($min, $max) = $ng->mm->minmax;
+	my ($min, $max) = $ibx->mm->minmax;
 	if ($range =~ /\A([0-9]+)\z/) {
 		$beg = $end = $1;
 	} elsif ($range =~ /\A([0-9]+)-\z/) {
@@ -704,7 +704,7 @@ sub long_response ($$;@) {
 
 sub hdr_msgid_range_i {
 	my ($self, $beg, $end) = @_;
-	my $r = $self->{ng}->mm->msg_range($beg, $end);
+	my $r = $self->{ibx}->mm->msg_range($beg, $end);
 	@$r or return;
 	$self->msg_more(join('', map { "$_->[0] <$_->[1]>\r\n" } @$r));
 	1;
@@ -714,9 +714,9 @@ sub hdr_message_id ($$$) { # optimize XHDR Message-ID [range] for slrnpull.
 	my ($self, $xhdr, $range) = @_;
 
 	if (defined $range && $range =~ $ONE_MSGID) {
-		my ($ng, $n) = mid_lookup($self, $1);
+		my ($ibx, $n) = mid_lookup($self, $1);
 		return r430 unless $n;
-		hdr_mid_response($self, $xhdr, $ng, $n, $range, $range);
+		hdr_mid_response($self, $xhdr, $ibx, $n, $range, $range);
 	} else { # numeric range
 		$range = $self->{article} unless defined $range;
 		my $r = get_range($self, $range);
@@ -728,10 +728,10 @@ sub hdr_message_id ($$$) { # optimize XHDR Message-ID [range] for slrnpull.
 
 sub mid_lookup ($$) {
 	my ($self, $mid) = @_;
-	my $self_ng = $self->{ng};
-	if ($self_ng) {
-		my $n = $self_ng->mm->num_for($mid);
-		return ($self_ng, $n) if defined $n;
+	my $cur_ibx = $self->{ibx};
+	if ($cur_ibx) {
+		my $n = $cur_ibx->mm->num_for($mid);
+		return ($cur_ibx, $n) if defined $n;
 	}
 	my $pi_cfg = $self->{nntpd}->{pi_config};
 	if (my $ALL = $pi_cfg->ALL) {
@@ -759,7 +759,7 @@ EOF
 		# no warning here, $mid is just invalid
 	} else { # slow path for non-ALL users
 		for my $ibx (values %{$pi_cfg->{-by_newsgroup}}) {
-			next if defined $self_ng && $ibx eq $self_ng;
+			next if defined $cur_ibx && $ibx eq $cur_ibx;
 			my $n = $ibx->mm->num_for($mid);
 			return ($ibx, $n) if defined $n;
 		}
@@ -769,12 +769,12 @@ EOF
 
 sub xref_range_i {
 	my ($self, $beg, $end) = @_;
-	my $ng = $self->{ng};
-	my $msgs = $ng->over->query_xover($$beg, $end);
+	my $ibx = $self->{ibx};
+	my $msgs = $ibx->over->query_xover($$beg, $end);
 	scalar(@$msgs) or return;
 	$$beg = $msgs->[-1]->{num} + 1;
 	$self->msg_more(join('', map {
-		"$_->{num} ".xref($self, $ng, $_) . "\r\n";
+		"$_->{num} ".xref($self, $ibx, $_) . "\r\n";
 	} @$msgs));
 	1;
 }
@@ -784,11 +784,11 @@ sub hdr_xref ($$$) { # optimize XHDR Xref [range] for rtin
 
 	if (defined $range && $range =~ $ONE_MSGID) {
 		my $mid = $1;
-		my ($ng, $n) = mid_lookup($self, $mid);
+		my ($ibx, $n) = mid_lookup($self, $mid);
 		return r430 unless $n;
-		my $smsg = $ng->over->get_art($n) or return;
-		hdr_mid_response($self, $xhdr, $ng, $n, $range,
-				xref($self, $ng, $smsg));
+		my $smsg = $ibx->over->get_art($n) or return;
+		hdr_mid_response($self, $xhdr, $ibx, $n, $range,
+				xref($self, $ibx, $smsg));
 	} else { # numeric range
 		$range = $self->{article} unless defined $range;
 		my $r = get_range($self, $range);
@@ -807,7 +807,7 @@ sub over_header_for {
 
 sub smsg_range_i {
 	my ($self, $beg, $end, $field) = @_;
-	my $over = $self->{ng}->over;
+	my $over = $self->{ibx}->over;
 	my $msgs = $over->query_xover($$beg, $end);
 	scalar(@$msgs) or return;
 	my $tmp = '';
@@ -830,10 +830,10 @@ sub smsg_range_i {
 sub hdr_smsg ($$$$) {
 	my ($self, $xhdr, $field, $range) = @_;
 	if (defined $range && $range =~ $ONE_MSGID) {
-		my ($ng, $n) = mid_lookup($self, $1);
+		my ($ibx, $n) = mid_lookup($self, $1);
 		return r430 unless defined $n;
-		my $v = over_header_for($ng->over, $n, $field);
-		hdr_mid_response($self, $xhdr, $ng, $n, $range, $v);
+		my $v = over_header_for($ibx->over, $n, $field);
+		hdr_mid_response($self, $xhdr, $ibx, $n, $range, $v);
 	} else { # numeric range
 		$range = $self->{article} unless defined $range;
 		my $r = get_range($self, $range);
@@ -873,26 +873,26 @@ sub cmd_xhdr ($$;$) {
 }
 
 sub hdr_mid_prefix ($$$$$) {
-	my ($self, $xhdr, $ng, $n, $mid) = @_;
+	my ($self, $xhdr, $ibx, $n, $mid) = @_;
 	return $mid if $xhdr;
 
 	# HDR for RFC 3977 users
-	if (my $self_ng = $self->{ng}) {
-		($self_ng eq $ng) ? $n : '0';
+	if (my $cur_ibx = $self->{ibx}) {
+		($cur_ibx eq $ibx) ? $n : '0';
 	} else {
 		'0';
 	}
 }
 
 sub hdr_mid_response ($$$$$$) {
-	my ($self, $xhdr, $ng, $n, $mid, $v) = @_;
+	my ($self, $xhdr, $ibx, $n, $mid, $v) = @_;
 	my $res = '';
 	if ($xhdr) {
 		$res .= r221 . "\r\n";
 		$res .= "$mid $v\r\n";
 	} else {
 		$res .= r225 . "\r\n";
-		my $pfx = hdr_mid_prefix($self, $xhdr, $ng, $n, $mid);
+		my $pfx = hdr_mid_prefix($self, $xhdr, $ibx, $n, $mid);
 		$res .= "$pfx $v\r\n";
 	}
 	res($self, $res .= '.');
@@ -901,14 +901,14 @@ sub hdr_mid_response ($$$$$$) {
 
 sub xrover_i {
 	my ($self, $beg, $end) = @_;
-	my $h = over_header_for($self->{ng}->over, $$beg, 'references');
+	my $h = over_header_for($self->{ibx}->over, $$beg, 'references');
 	more($self, "$$beg $h") if defined($h);
 	$$beg++ < $end;
 }
 
 sub cmd_xrover ($;$) {
 	my ($self, $range) = @_;
-	my $ng = $self->{ng} or return '412 no newsgroup selected';
+	my $ibx = $self->{ibx} or return '412 no newsgroup selected';
 	(defined $range && $range =~ /[<>]/) and
 		return '420 No article(s) selected'; # no message IDs
 
@@ -920,7 +920,7 @@ sub cmd_xrover ($;$) {
 }
 
 sub over_line ($$$) {
-	my ($self, $ng, $smsg) = @_;
+	my ($self, $ibx, $smsg) = @_;
 	# n.b. field access and procedural calls can be
 	# 10%-15% faster than OO method calls:
 	my $s = join("\t", $smsg->{num},
@@ -931,7 +931,7 @@ sub over_line ($$$) {
 		$smsg->{references},
 		$smsg->{bytes},
 		$smsg->{lines},
-		"Xref: " . xref($self, $ng, $smsg));
+		"Xref: " . xref($self, $ibx, $smsg));
 	utf8::encode($s);
 	$s .= "\r\n";
 }
@@ -939,20 +939,20 @@ sub over_line ($$$) {
 sub cmd_over ($;$) {
 	my ($self, $range) = @_;
 	if ($range && $range =~ $ONE_MSGID) {
-		my ($ng, $n) = mid_lookup($self, $1);
+		my ($ibx, $n) = mid_lookup($self, $1);
 		defined $n or return r430;
-		my $smsg = $ng->over->get_art($n) or return r430;
+		my $smsg = $ibx->over->get_art($n) or return r430;
 		more($self, '224 Overview information follows (multi-line)');
 
 		# Only set article number column if it's the current group
 		# (RFC 3977 8.3.2)
-		my $self_ng = $self->{ng};
-		if (!$self_ng || $self_ng ne $ng) {
+		my $cur_ibx = $self->{ibx};
+		if (!$cur_ibx || $cur_ibx ne $ibx) {
 			# set {-orig_num} for nntp_xref_for
 			$smsg->{-orig_num} = $smsg->{num};
 			$smsg->{num} = 0;
 		}
-		$self->msg_more(over_line($self, $ng, $smsg));
+		$self->msg_more(over_line($self, $ibx, $smsg));
 		'.';
 	} else {
 		cmd_xover($self, $range);
@@ -961,13 +961,13 @@ sub cmd_over ($;$) {
 
 sub xover_i {
 	my ($self, $beg, $end) = @_;
-	my $ng = $self->{ng};
-	my $msgs = $ng->over->query_xover($$beg, $end);
+	my $ibx = $self->{ibx};
+	my $msgs = $ibx->over->query_xover($$beg, $end);
 	my $nr = scalar @$msgs or return;
 
 	# OVERVIEW.FMT
 	$self->msg_more(join('', map {
-		over_line($self, $ng, $_);
+		over_line($self, $ibx, $_);
 		} @$msgs));
 	$$beg = $msgs->[-1]->{num} + 1;
 }
diff --git a/t/nntp.t b/t/nntp.t
index ea2ef876..3d2f524c 100644
--- a/t/nntp.t
+++ b/t/nntp.t
@@ -99,14 +99,14 @@ use PublicInbox::Config;
 
 { # test setting NNTP headers in HEAD and ARTICLE requests
 	my $u = 'https://example.com/a/';
-	my $ng = PublicInbox::Inbox->new({ name => 'test',
+	my $ibx = PublicInbox::Inbox->new({ name => 'test',
 					inboxdir => 'test.git',
 					address => 'a@example.com',
 					-primary_address => 'a@example.com',
 					newsgroup => 'test',
 					domain => 'example.com',
 					url => [ '//example.com/a' ]});
-	is($ng->base_url, $u, 'URL expanded');
+	is($ibx->base_url, $u, 'URL expanded');
 	my $mid = 'a@b';
 	my $mime = PublicInbox::Eml->new("Message-ID: <$mid>\r\n\r\n");
 	my $hdr = $mime->header_obj;
@@ -115,9 +115,9 @@ use PublicInbox::Config;
 			servername => 'example.com',
 			pi_config => bless {}, 'PublicInbox::Config',
 		},
-		ng => $ng,
+		ibx => $ibx,
 	};
-	my $smsg = { num => 1, mid => $mid, nntp => $mock_self, -ibx => $ng };
+	my $smsg = { num => 1, mid => $mid, nntp => $mock_self, -ibx => $ibx };
 	PublicInbox::NNTP::set_nntp_headers($hdr, $smsg);
 	is_deeply([ $mime->header('Message-ID') ], [ "<$mid>" ],
 		'Message-ID unchanged');
@@ -132,7 +132,7 @@ use PublicInbox::Config;
 	is_deeply([ $mime->header('Xref') ], [ 'example.com test:1' ],
 		'Xref: set');
 
-	$ng->{-base_url} = 'http://mirror.example.com/m/';
+	$ibx->{-base_url} = 'http://mirror.example.com/m/';
 	$smsg->{num} = 2;
 	PublicInbox::NNTP::set_nntp_headers($hdr, $smsg);
 	is_deeply([ $mime->header('Message-ID') ], [ "<$mid>" ],

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/6] rename {pi_config} fields to {pi_cfg}
  2020-12-08 21:21 [PATCH 0/6] minor internal consistency things Eric Wong
  2020-12-08 21:21 ` [PATCH 1/6] treewide: replace {-inbox} with {ibx} for consistency Eric Wong
  2020-12-08 21:21 ` [PATCH 2/6] nntp: replace {ng} " Eric Wong
@ 2020-12-08 21:21 ` Eric Wong
  2020-12-08 21:21 ` [PATCH 4/6] extindex: do not use current dir like -index does Eric Wong
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Eric Wong @ 2020-12-08 21:21 UTC (permalink / raw)
  To: meta

{pi_config} may be confused with the documented `PI_CONFIG'
environment variable, and we'll favor vowel-removal to be
consistent with our usage of object references.

The `pi_' prefix may stay in some places, for now; since a
separate namespace may come into this codebase for local/private
client-tooling.

For InboxIdle, we'll also remove an invalid comment about
holding a reference to the PublicInbox::Config object, too.
---
 examples/cgit.psgi              |  4 +--
 lib/PublicInbox/Cgit.pm         | 24 ++++++++---------
 lib/PublicInbox/Config.pm       |  2 +-
 lib/PublicInbox/ExtMsg.pm       |  8 +++---
 lib/PublicInbox/IMAPD.pm        | 28 +++++++++----------
 lib/PublicInbox/Inbox.pm        | 10 +++----
 lib/PublicInbox/InboxIdle.pm    |  9 +++----
 lib/PublicInbox/MDA.pm          |  4 +--
 lib/PublicInbox/ManifestJsGz.pm |  2 +-
 lib/PublicInbox/NNTP.pm         | 22 +++++++--------
 lib/PublicInbox/NNTPD.pm        | 16 +++++------
 lib/PublicInbox/NewsWWW.pm      | 15 +++++------
 lib/PublicInbox/Qspawn.pm       |  4 +--
 lib/PublicInbox/Spamcheck.pm    |  4 +--
 lib/PublicInbox/Unsubscribe.pm  |  6 ++---
 lib/PublicInbox/WWW.pm          | 27 +++++++++----------
 lib/PublicInbox/Watch.pm        | 20 +++++++-------
 lib/PublicInbox/WwwListing.pm   |  4 +--
 lib/PublicInbox/WwwStream.pm    |  2 +-
 lib/PublicInbox/WwwText.pm      |  4 +--
 script/public-inbox-learn       |  8 +++---
 script/public-inbox-mda         |  8 +++---
 scripts/import_slrnspool        |  4 +--
 t/imapd.t                       |  4 +--
 t/inbox_idle.t                  |  8 +++---
 t/mda_filter_rubylang.t         |  4 +--
 t/nntp.t                        |  2 +-
 t/psgi_mount.t                  |  6 ++---
 t/psgi_search.t                 |  6 ++---
 t/psgi_v2.t                     | 11 ++++----
 t/watch_filter_rubylang.t       | 10 +++----
 t/watch_maildir.t               | 26 +++++++++---------
 t/watch_maildir_v2.t            | 48 ++++++++++++++++-----------------
 t/watch_multiple_headers.t      |  8 +++---
 34 files changed, 182 insertions(+), 186 deletions(-)

diff --git a/examples/cgit.psgi b/examples/cgit.psgi
index 7ad38e28..48e3798b 100644
--- a/examples/cgit.psgi
+++ b/examples/cgit.psgi
@@ -14,8 +14,8 @@ use warnings;
 use Plack::Builder;
 use PublicInbox::Cgit;
 use PublicInbox::Config;
-my $pi_config = PublicInbox::Config->new;
-my $cgit = PublicInbox::Cgit->new($pi_config);
+my $pi_cfg = PublicInbox::Config->new;
+my $cgit = PublicInbox::Cgit->new($pi_cfg);
 
 builder {
 	eval { enable 'ReverseProxy' };
diff --git a/lib/PublicInbox/Cgit.pm b/lib/PublicInbox/Cgit.pm
index fb0d0e60..472509a8 100644
--- a/lib/PublicInbox/Cgit.pm
+++ b/lib/PublicInbox/Cgit.pm
@@ -16,9 +16,9 @@ use PublicInbox::Qspawn;
 use PublicInbox::WwwStatic qw(r);
 
 sub locate_cgit ($) {
-	my ($pi_config) = @_;
-	my $cgit_bin = $pi_config->{'publicinbox.cgitbin'};
-	my $cgit_data = $pi_config->{'publicinbox.cgitdata'};
+	my ($pi_cfg) = @_;
+	my $cgit_bin = $pi_cfg->{'publicinbox.cgitbin'};
+	my $cgit_data = $pi_cfg->{'publicinbox.cgitdata'};
 
 	# /var/www/htdocs/cgit is the default install path from cgit.git
 	# /usr/{lib,share}/cgit is where Debian puts cgit
@@ -51,28 +51,28 @@ sub locate_cgit ($) {
 }
 
 sub new {
-	my ($class, $pi_config) = @_;
-	my ($cgit_bin, $cgit_data) = locate_cgit($pi_config);
+	my ($class, $pi_cfg) = @_;
+	my ($cgit_bin, $cgit_data) = locate_cgit($pi_cfg);
 
 	my $self = bless {
 		cmd => [ $cgit_bin ],
 		cgit_data => $cgit_data,
-		pi_config => $pi_config,
+		pi_cfg => $pi_cfg,
 	}, $class;
 
-	$pi_config->fill_all; # fill in -code_repos mapped to inboxes
+	$pi_cfg->fill_all; # fill in -code_repos mapped to inboxes
 
 	# some cgit repos may not be mapped to inboxes, so ensure those exist:
-	my $code_repos = $pi_config->{-code_repos};
-	foreach my $k (keys %$pi_config) {
+	my $code_repos = $pi_cfg->{-code_repos};
+	foreach my $k (keys %$pi_cfg) {
 		$k =~ /\Acoderepo\.(.+)\.dir\z/ or next;
-		my $dir = $pi_config->{$k};
+		my $dir = $pi_cfg->{$k};
 		$code_repos->{$1} ||= PublicInbox::Git->new($dir);
 	}
 	while (my ($nick, $repo) = each %$code_repos) {
 		$self->{"\0$nick"} = $repo;
 	}
-	my $cgit_static = $pi_config->{-cgit_static};
+	my $cgit_static = $pi_cfg->{-cgit_static};
 	my $static = join('|', map { quotemeta $_ } keys %$cgit_static);
 	$self->{static} = qr/\A($static)\z/;
 	$self;
@@ -120,7 +120,7 @@ sub call {
 
 	my $rdr = input_prepare($env) or return r(500);
 	my $qsp = PublicInbox::Qspawn->new($self->{cmd}, $cgi_env, $rdr);
-	my $limiter = $self->{pi_config}->limiter('-cgit');
+	my $limiter = $self->{pi_cfg}->limiter('-cgit');
 	$qsp->psgi_return($env, $limiter, $parse_cgi_headers);
 }
 
diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index 1844f8b2..cafd9c3b 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -425,7 +425,7 @@ EOF
 	}
 
 	$ibx->{name} = $name;
-	$ibx->{-pi_config} = $self;
+	$ibx->{-pi_cfg} = $self;
 	$ibx = PublicInbox::Inbox->new($ibx);
 	foreach (@{$ibx->{address}}) {
 		my $lc_addr = lc($_);
diff --git a/lib/PublicInbox/ExtMsg.pm b/lib/PublicInbox/ExtMsg.pm
index 43acfb53..8da96df6 100644
--- a/lib/PublicInbox/ExtMsg.pm
+++ b/lib/PublicInbox/ExtMsg.pm
@@ -105,8 +105,8 @@ sub ext_msg_step {
 
 sub ext_msg_ALL ($) {
 	my ($ctx) = @_;
-	my $ALL = $ctx->{www}->{pi_config}->ALL or return;
-	my $by_eidx_key = $ctx->{www}->{pi_config}->{-by_eidx_key};
+	my $ALL = $ctx->{www}->{pi_cfg}->ALL or return;
+	my $by_eidx_key = $ctx->{www}->{pi_cfg}->{-by_eidx_key};
 	my $cur_key = $ctx->{ibx}->eidx_key;
 	my %seen = ($cur_key => 1);
 	my ($id, $prev);
@@ -139,11 +139,11 @@ sub ext_msg {
 		if ($ctx->{env}->{'pi-httpd.async'}) {
 			require PublicInbox::ConfigIter;
 			my $iter = PublicInbox::ConfigIter->new(
-						$ctx->{www}->{pi_config},
+						$ctx->{www}->{pi_cfg},
 						\&ext_msg_step, $ctx);
 			$iter->event_step;
 		} else {
-			$ctx->{www}->{pi_config}->each_inbox(\&ext_msg_i, $ctx);
+			$ctx->{www}->{pi_cfg}->each_inbox(\&ext_msg_i, $ctx);
 			finalize_exact($ctx);
 		}
 	};
diff --git a/lib/PublicInbox/IMAPD.pm b/lib/PublicInbox/IMAPD.pm
index 4a37734e..fb945847 100644
--- a/lib/PublicInbox/IMAPD.pm
+++ b/lib/PublicInbox/IMAPD.pm
@@ -19,12 +19,12 @@ sub new {
 		err => \*STDERR,
 		out => \*STDOUT,
 		# accept_tls => { SSL_server => 1, ..., SSL_reuse_ctx => ... }
-		# pi_config => PublicInbox::Config
+		# pi_cfg => PublicInbox::Config
 		# idler => PublicInbox::InboxIdle
 	}, $class;
 }
 
-sub imapd_refresh_ibx { # pi_config->each_inbox cb
+sub imapd_refresh_ibx { # pi_cfg->each_inbox cb
 	my ($ibx, $imapd) = @_;
 	my $ngname = $ibx->{newsgroup} or return;
 
@@ -60,7 +60,7 @@ sub imapd_refresh_ibx { # pi_config->each_inbox cb
 }
 
 sub imapd_refresh_finalize {
-	my ($imapd, $pi_config) = @_;
+	my ($imapd, $pi_cfg) = @_;
 	my $mailboxes;
 	if (my $next = delete $imapd->{imapd_next}) {
 		$imapd->{mailboxes} = delete $next->{mailboxes};
@@ -78,40 +78,40 @@ sub imapd_refresh_finalize {
 			qq[* LIST (\\Has${no}Children) "." $u\r\n]
 		} keys %$mailboxes
 	];
-	$imapd->{pi_config} = $pi_config;
+	$imapd->{pi_cfg} = $pi_cfg;
 	if (my $idler = $imapd->{idler}) {
-		$idler->refresh($pi_config);
+		$idler->refresh($pi_cfg);
 	}
 }
 
-sub imapd_refresh_step { # pi_config->iterate_start cb
-	my ($pi_config, $section, $imapd) = @_;
+sub imapd_refresh_step { # pi_cfg->iterate_start cb
+	my ($pi_cfg, $section, $imapd) = @_;
 	if (defined($section)) {
 		return if $section !~ m!\Apublicinbox\.([^/]+)\z!;
-		my $ibx = $pi_config->lookup_name($1) or return;
+		my $ibx = $pi_cfg->lookup_name($1) or return;
 		imapd_refresh_ibx($ibx, $imapd->{imapd_next});
 	} else { # undef == "EOF"
-		imapd_refresh_finalize($imapd, $pi_config);
+		imapd_refresh_finalize($imapd, $pi_cfg);
 	}
 }
 
 sub refresh_groups {
 	my ($self, $sig) = @_;
-	my $pi_config = PublicInbox::Config->new;
+	my $pi_cfg = PublicInbox::Config->new;
 	if ($sig) { # SIGHUP is handled through the event loop
 		$self->{imapd_next} = { dummies => {}, mailboxes => {} };
-		my $iter = PublicInbox::ConfigIter->new($pi_config,
+		my $iter = PublicInbox::ConfigIter->new($pi_cfg,
 						\&imapd_refresh_step, $self);
 		$iter->event_step;
 	} else { # initial start is synchronous
 		$self->{dummies} = {};
-		$pi_config->each_inbox(\&imapd_refresh_ibx, $self);
-		imapd_refresh_finalize($self, $pi_config);
+		$pi_cfg->each_inbox(\&imapd_refresh_ibx, $self);
+		imapd_refresh_finalize($self, $pi_cfg);
 	}
 }
 
 sub idler_start {
-	$_[0]->{idler} //= PublicInbox::InboxIdle->new($_[0]->{pi_config});
+	$_[0]->{idler} //= PublicInbox::InboxIdle->new($_[0]->{pi_cfg});
 }
 
 1;
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index 52aece7c..586bd561 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -85,7 +85,7 @@ sub _set_uint ($$$) {
 }
 
 sub _set_limiter ($$$) {
-	my ($self, $pi_config, $pfx) = @_;
+	my ($self, $pi_cfg, $pfx) = @_;
 	my $lkey = "-${pfx}_limiter";
 	$self->{$lkey} ||= do {
 		# full key is: publicinbox.$NAME.httpbackendmax
@@ -96,7 +96,7 @@ sub _set_limiter ($$$) {
 			require PublicInbox::Qspawn;
 			$lim = PublicInbox::Qspawn::Limiter->new($val);
 		} elsif ($val =~ /\A[a-z][a-z0-9]*\z/) {
-			$lim = $pi_config->limiter($val);
+			$lim = $pi_cfg->limiter($val);
 			warn "$mkey limiter=$val not found\n" if !$lim;
 		} else {
 			warn "$mkey limiter=$val not understood\n";
@@ -110,10 +110,10 @@ sub new {
 	my $v = $opts->{address} ||= [ 'public-inbox@example.com' ];
 	my $p = $opts->{-primary_address} = ref($v) eq 'ARRAY' ? $v->[0] : $v;
 	$opts->{domain} = ($p =~ /\@(\S+)\z/) ? $1 : 'localhost';
-	my $pi_config = delete $opts->{-pi_config};
-	_set_limiter($opts, $pi_config, 'httpbackend');
+	my $pi_cfg = delete $opts->{-pi_cfg};
+	_set_limiter($opts, $pi_cfg, 'httpbackend');
 	_set_uint($opts, 'feedmax', 25);
-	$opts->{nntpserver} ||= $pi_config->{'publicinbox.nntpserver'};
+	$opts->{nntpserver} ||= $pi_cfg->{'publicinbox.nntpserver'};
 	my $dir = $opts->{inboxdir};
 	if (defined $dir && -f "$dir/inbox.lock") {
 		$opts->{version} = 2;
diff --git a/lib/PublicInbox/InboxIdle.pm b/lib/PublicInbox/InboxIdle.pm
index 0cdd2e2a..2737bbbd 100644
--- a/lib/PublicInbox/InboxIdle.pm
+++ b/lib/PublicInbox/InboxIdle.pm
@@ -2,7 +2,6 @@
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # fields:
-# pi_config: PublicInbox::Config ref
 # inot: Linux::Inotify2-like object
 # pathmap => { inboxdir => [ ibx, watch1, watch2, watch3... ] } mapping
 package PublicInbox::InboxIdle;
@@ -51,12 +50,12 @@ sub in2_arm ($$) { # PublicInbox::Config::each_inbox callback
 }
 
 sub refresh {
-	my ($self, $pi_config) = @_;
-	$pi_config->each_inbox(\&in2_arm, $self);
+	my ($self, $pi_cfg) = @_;
+	$pi_cfg->each_inbox(\&in2_arm, $self);
 }
 
 sub new {
-	my ($class, $pi_config) = @_;
+	my ($class, $pi_cfg) = @_;
 	my $self = bless {}, $class;
 	my $inot;
 	if ($ino_cls) {
@@ -70,7 +69,7 @@ sub new {
 	$self->{inot} = $inot;
 	$self->{pathmap} = {}; # inboxdir => [ ibx, watch1, watch2, watch3...]
 	$self->{on_unlock} = {}; # lock path => ibx
-	refresh($self, $pi_config);
+	refresh($self, $pi_cfg);
 	PublicInbox::FakeInotify::poll_once($self) if !$ino_cls;
 	$self;
 }
diff --git a/lib/PublicInbox/MDA.pm b/lib/PublicInbox/MDA.pm
index fa4a2ad8..0377a877 100644
--- a/lib/PublicInbox/MDA.pm
+++ b/lib/PublicInbox/MDA.pm
@@ -83,7 +83,7 @@ sub set_list_headers {
 }
 
 sub inboxes_for_list_id ($$) {
-	my ($klass, $config, $simple) = @_;
+	my ($klass, $pi_cfg, $simple) = @_;
 
 	# newer Email::Simple allows header_raw, as does Email::MIME:
 	my @list_ids = $simple->can('header_raw') ?
@@ -92,7 +92,7 @@ sub inboxes_for_list_id ($$) {
 	my @dests;
 	for my $list_id (@list_ids) {
 		$list_id =~ /<[ \t]*(.+)?[ \t]*>/ or next;
-		if (my $ibx = $config->lookup_list_id($1)) {
+		if (my $ibx = $pi_cfg->lookup_list_id($1)) {
 			push @dests, $ibx;
 		}
 	}
diff --git a/lib/PublicInbox/ManifestJsGz.pm b/lib/PublicInbox/ManifestJsGz.pm
index 2c4a231d..fb7a45e7 100644
--- a/lib/PublicInbox/ManifestJsGz.pm
+++ b/lib/PublicInbox/ManifestJsGz.pm
@@ -71,7 +71,7 @@ sub eidx_manifest_add ($$$) {
 
 sub ibx_entry {
 	my ($ctx, $ibx) = @_;
-	my $ALL = $ctx->{www}->{pi_config}->ALL;
+	my $ALL = $ctx->{www}->{pi_cfg}->ALL;
 	if ($ALL) {
 		eidx_manifest_add($ctx, $ALL, $ibx);
 	} else {
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index 766ea89e..0b43cdbc 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -129,7 +129,7 @@ sub list_active_i { # "LIST ACTIVE" and also just "LIST" (no args)
 	my ($self, $groupnames) = @_;
 	my @window = splice(@$groupnames, 0, 100) or return 0;
 	my $ibx;
-	my $groups = $self->{nntpd}->{pi_config}->{-by_newsgroup};
+	my $groups = $self->{nntpd}->{pi_cfg}->{-by_newsgroup};
 	for my $ngname (@window) {
 		$ibx = $groups->{$ngname} and group_line($self, $ibx);
 	}
@@ -146,7 +146,7 @@ sub list_active ($;$) { # called by cmd_list
 sub list_active_times_i {
 	my ($self, $groupnames) = @_;
 	my @window = splice(@$groupnames, 0, 100) or return 0;
-	my $groups = $self->{nntpd}->{pi_config}->{-by_newsgroup};
+	my $groups = $self->{nntpd}->{pi_cfg}->{-by_newsgroup};
 	for my $ngname (@window) {
 		my $ibx = $groups->{$ngname} or next;
 		my $c = eval { $ibx->uidvalidity } // time;
@@ -165,7 +165,7 @@ sub list_active_times ($;$) { # called by cmd_list
 sub list_newsgroups_i {
 	my ($self, $groupnames) = @_;
 	my @window = splice(@$groupnames, 0, 100) or return 0;
-	my $groups = $self->{nntpd}->{pi_config}->{-by_newsgroup};
+	my $groups = $self->{nntpd}->{pi_cfg}->{-by_newsgroup};
 	my $ibx;
 	for my $ngname (@window) {
 		$ibx = $groups->{$ngname} and
@@ -268,7 +268,7 @@ sub group_line ($$) {
 sub newgroups_i {
 	my ($self, $ts, $i, $groupnames) = @_;
 	my $end = $$i + 100;
-	my $groups = $self->{nntpd}->{pi_config}->{-by_newsgroup};
+	my $groups = $self->{nntpd}->{pi_cfg}->{-by_newsgroup};
 	while ($$i < $end) {
 		my $ngname = $groupnames->[$$i++] // return;
 		my $ibx = $groups->{$ngname} or next; # expired on reload
@@ -323,7 +323,7 @@ sub ngpat2re (;$) {
 sub newnews_i {
 	my ($self, $names, $ts, $prev) = @_;
 	my $ngname = $names->[0];
-	if (my $ibx = $self->{nntpd}->{pi_config}->{-by_newsgroup}->{$ngname}) {
+	if (my $ibx = $self->{nntpd}->{pi_cfg}->{-by_newsgroup}->{$ngname}) {
 		if (my $over = $ibx->over) {
 			my $msgs = $over->query_ts($ts, $$prev);
 			if (scalar @$msgs) {
@@ -362,7 +362,7 @@ sub cmd_newnews ($$$$;$$) {
 sub cmd_group ($$) {
 	my ($self, $group) = @_;
 	my $nntpd = $self->{nntpd};
-	my $ibx = $nntpd->{pi_config}->{-by_newsgroup}->{$group} or
+	my $ibx = $nntpd->{pi_cfg}->{-by_newsgroup}->{$group} or
 		return '411 no such news group';
 	$nntpd->idler_start;
 
@@ -439,13 +439,13 @@ sub xref ($$$) {
 	my $nntpd = $self->{nntpd};
 	my $cur_ng = $cur_ibx->{newsgroup};
 	my $xref;
-	if (my $ALL = $nntpd->{pi_config}->ALL) {
+	if (my $ALL = $nntpd->{pi_cfg}->ALL) {
 		$xref = $ALL->nntp_xref_for($cur_ibx, $smsg);
-		xref_by_tc($xref, $nntpd->{pi_config}, $smsg);
+		xref_by_tc($xref, $nntpd->{pi_cfg}, $smsg);
 	} else { # slow path
 		$xref = { $cur_ng => $smsg->{num} };
 		my $mid = $smsg->{mid};
-		for my $ibx (values %{$nntpd->{pi_config}->{-by_newsgroup}}) {
+		for my $ibx (values %{$nntpd->{pi_cfg}->{-by_newsgroup}}) {
 			next if defined($xref->{$ibx->{newsgroup}});
 			my $num = eval { $ibx->mm->num_for($mid) } // next;
 			$xref->{$ibx->{newsgroup}} = $num;
@@ -733,7 +733,7 @@ sub mid_lookup ($$) {
 		my $n = $cur_ibx->mm->num_for($mid);
 		return ($cur_ibx, $n) if defined $n;
 	}
-	my $pi_cfg = $self->{nntpd}->{pi_config};
+	my $pi_cfg = $self->{nntpd}->{pi_cfg};
 	if (my $ALL = $pi_cfg->ALL) {
 		my ($id, $prev);
 		while (my $smsg = $ALL->over->next_by_mid($mid, \$id, \$prev)) {
@@ -1014,7 +1014,7 @@ sub cmd_xpath ($$) {
 	return r501 unless $mid =~ $ONE_MSGID;
 	$mid = $1;
 	my @paths;
-	my $pi_cfg = $self->{nntpd}->{pi_config};
+	my $pi_cfg = $self->{nntpd}->{pi_cfg};
 	my $groups = $pi_cfg->{-by_newsgroup};
 	if (my $ALL = $pi_cfg->ALL) {
 		my ($id, $prev, %seen);
diff --git a/lib/PublicInbox/NNTPD.pm b/lib/PublicInbox/NNTPD.pm
index 03c56db3..953228d0 100644
--- a/lib/PublicInbox/NNTPD.pm
+++ b/lib/PublicInbox/NNTPD.pm
@@ -12,8 +12,8 @@ use PublicInbox::InboxIdle;
 
 sub new {
 	my ($class) = @_;
-	my $pi_config = PublicInbox::Config->new;
-	my $name = $pi_config->{'publicinbox.nntpserver'};
+	my $pi_cfg = PublicInbox::Config->new;
+	my $name = $pi_cfg->{'publicinbox.nntpserver'};
 	if (!defined($name) or $name eq '') {
 		$name = hostname;
 	} elsif (ref($name) eq 'ARRAY') {
@@ -24,7 +24,7 @@ sub new {
 		groups => {},
 		err => \*STDERR,
 		out => \*STDOUT,
-		pi_config => $pi_config,
+		pi_cfg => $pi_cfg,
 		servername => $name,
 		greet => \"201 $name ready - post via email\r\n",
 		# accept_tls => { SSL_server => 1, ..., SSL_reuse_ctx => ... }
@@ -34,9 +34,9 @@ sub new {
 
 sub refresh_groups {
 	my ($self, $sig) = @_;
-	my $pi_config = $sig ? PublicInbox::Config->new : $self->{pi_config};
-	my $groups = $pi_config->{-by_newsgroup}; # filled during each_inbox
-	$pi_config->each_inbox(sub {
+	my $pi_cfg = $sig ? PublicInbox::Config->new : $self->{pi_cfg};
+	my $groups = $pi_cfg->{-by_newsgroup}; # filled during each_inbox
+	$pi_cfg->each_inbox(sub {
 		my ($ibx) = @_;
 		my $ngname = $ibx->{newsgroup};
 		if (defined($ngname) && $ibx->nntp_usable) {
@@ -54,11 +54,11 @@ sub refresh_groups {
 	});
 	$self->{groupnames} = [ sort(keys %$groups) ];
 	# this will destroy old groups that got deleted
-	$self->{pi_config} = $pi_config;
+	$self->{pi_cfg} = $pi_cfg;
 }
 
 sub idler_start {
-	$_[0]->{idler} //= PublicInbox::InboxIdle->new($_[0]->{pi_config});
+	$_[0]->{idler} //= PublicInbox::InboxIdle->new($_[0]->{pi_cfg});
 }
 
 1;
diff --git a/lib/PublicInbox/NewsWWW.pm b/lib/PublicInbox/NewsWWW.pm
index ade8dfd1..61d9ae7c 100644
--- a/lib/PublicInbox/NewsWWW.pm
+++ b/lib/PublicInbox/NewsWWW.pm
@@ -13,9 +13,8 @@ use PublicInbox::MID qw(mid_escape);
 use PublicInbox::Hval qw(prurl);
 
 sub new {
-	my ($class, $pi_config) = @_;
-	$pi_config ||= PublicInbox::Config->new;
-	bless { pi_config => $pi_config }, $class;
+	my ($class, $pi_cfg) = @_;
+	bless { pi_cfg => $pi_cfg // PublicInbox::Config->new }, $class;
 }
 
 sub redirect ($$) {
@@ -47,8 +46,8 @@ sub call {
 	# /inbox.foo.bar/123456
 	my (undef, @parts) = split(m!/!, $env->{PATH_INFO});
 	my ($ng, $article) = @parts;
-	my $pi_config = $self->{pi_config};
-	if (my $ibx = $pi_config->lookup_newsgroup($ng)) {
+	my $pi_cfg = $self->{pi_cfg};
+	if (my $ibx = $pi_cfg->lookup_newsgroup($ng)) {
 		my $url = prurl($env, $ibx->{url});
 		my $code = 301;
 		if (defined $article && $article =~ /\A[0-9]+\z/) {
@@ -71,9 +70,9 @@ sub call {
 		pop @parts;
 		push @try, join('/', @parts);
 	}
-	my $ALL = $pi_config->ALL;
+	my $ALL = $pi_cfg->ALL;
 	if (my $over = $ALL ? $ALL->over : undef) {
-		my $by_eidx_key = $pi_config->{-by_eidx_key};
+		my $by_eidx_key = $pi_cfg->{-by_eidx_key};
 		for my $mid (@try) {
 			my ($id, $prev);
 			while (my $x = $over->next_by_mid($mid, \$id, \$prev)) {
@@ -90,7 +89,7 @@ sub call {
 	} else { # slow path, scan every inbox
 		for my $mid (@try) {
 			my $arg = [ $mid ]; # [1] => result
-			$pi_config->each_inbox(\&try_inbox, $arg);
+			$pi_cfg->each_inbox(\&try_inbox, $arg);
 			return $arg->[1] if $arg->[1];
 		}
 	}
diff --git a/lib/PublicInbox/Qspawn.pm b/lib/PublicInbox/Qspawn.pm
index 88b6d390..2aa2042a 100644
--- a/lib/PublicInbox/Qspawn.pm
+++ b/lib/PublicInbox/Qspawn.pm
@@ -359,12 +359,12 @@ sub new {
 }
 
 sub setup_rlimit {
-	my ($self, $name, $config) = @_;
+	my ($self, $name, $cfg) = @_;
 	foreach my $rlim (@PublicInbox::Spawn::RLIMITS) {
 		my $k = lc($rlim);
 		$k =~ tr/_//d;
 		$k = "publicinboxlimiter.$name.$k";
-		defined(my $v = $config->{$k}) or next;
+		defined(my $v = $cfg->{$k}) or next;
 		my @rlimit = split(/\s*,\s*/, $v);
 		if (scalar(@rlimit) == 1) {
 			push @rlimit, $rlimit[0];
diff --git a/lib/PublicInbox/Spamcheck.pm b/lib/PublicInbox/Spamcheck.pm
index ffebb3cf..218fcc01 100644
--- a/lib/PublicInbox/Spamcheck.pm
+++ b/lib/PublicInbox/Spamcheck.pm
@@ -7,8 +7,8 @@ use strict;
 use warnings;
 
 sub get {
-	my ($config, $key, $default) = @_;
-	my $spamcheck = $config->{$key};
+	my ($cfg, $key, $default) = @_;
+	my $spamcheck = $cfg->{$key};
 	$spamcheck = $default unless $spamcheck;
 
 	return if !$spamcheck || $spamcheck eq 'none';
diff --git a/lib/PublicInbox/Unsubscribe.pm b/lib/PublicInbox/Unsubscribe.pm
index 945e7ae7..b0d3220c 100644
--- a/lib/PublicInbox/Unsubscribe.pm
+++ b/lib/PublicInbox/Unsubscribe.pm
@@ -39,7 +39,7 @@ sub new {
 		die "`unsubscribe' callback not given\n";
 
 	bless {
-		pi_config => $opt{pi_config}, # PublicInbox::Config
+		pi_cfg => $opt{pi_config}, # PublicInbox::Config
 		owner_email => $opt{owner_email},
 		cipher => $cipher,
 		unsubscribe => $unsubscribe,
@@ -149,9 +149,9 @@ sub archive_info {
 	my $archive_url = $self->{archive_urls}->{$list_addr};
 
 	unless ($archive_url) {
-		if (my $config = $self->{pi_config}) {
+		if (my $cfg = $self->{pi_cfg}) {
 			# PublicInbox::Config::lookup
-			my $ibx = $config->lookup($list_addr);
+			my $ibx = $cfg->lookup($list_addr);
 			# PublicInbox::Inbox::base_url
 			$archive_url = $ibx->base_url if $ibx;
 		}
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index 6bae2190..a33d25ab 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -32,9 +32,8 @@ our $ATTACH_RE = qr!([0-9][0-9\.]*)-($PublicInbox::Hval::FN)!;
 our $OID_RE = qr![a-f0-9]{7,}!;
 
 sub new {
-	my ($class, $pi_config) = @_;
-	$pi_config ||= PublicInbox::Config->new;
-	bless { pi_config => $pi_config }, $class;
+	my ($class, $pi_cfg) = @_;
+	bless { pi_cfg => $pi_cfg // PublicInbox::Config->new }, $class;
 }
 
 # backwards compatibility, do not use
@@ -169,14 +168,14 @@ sub preload {
 		eval "require PublicInbox::$_;";
 	}
 	if (ref($self)) {
-		my $pi_config = $self->{pi_config};
-		if (defined($pi_config->{'publicinbox.cgitrc'})) {
-			$pi_config->limiter('-cgit');
+		my $pi_cfg = $self->{pi_cfg};
+		if (defined($pi_cfg->{'publicinbox.cgitrc'})) {
+			$pi_cfg->limiter('-cgit');
 		}
 		$self->cgit;
 		$self->stylesheets_prepare($_) for ('', '../', '../../');
 		$self->news_www;
-		$pi_config->each_inbox(\&preload_inbox);
+		$pi_cfg->each_inbox(\&preload_inbox);
 	}
 }
 
@@ -210,8 +209,8 @@ sub news_cgit_fallback ($) {
 # returns undef if valid, array ref response if invalid
 sub invalid_inbox ($$) {
 	my ($ctx, $inbox) = @_;
-	my $ibx = $ctx->{www}->{pi_config}->lookup_name($inbox) //
-			$ctx->{www}->{pi_config}->lookup_ei($inbox);
+	my $ibx = $ctx->{www}->{pi_cfg}->lookup_name($inbox) //
+			$ctx->{www}->{pi_cfg}->lookup_ei($inbox);
 	if (defined $ibx) {
 		$ctx->{ibx} = $ibx;
 		return;
@@ -481,18 +480,18 @@ sub news_www {
 	my ($self) = @_;
 	$self->{news_www} ||= do {
 		require PublicInbox::NewsWWW;
-		PublicInbox::NewsWWW->new($self->{pi_config});
+		PublicInbox::NewsWWW->new($self->{pi_cfg});
 	}
 }
 
 sub cgit {
 	my ($self) = @_;
 	$self->{cgit} ||= do {
-		my $pi_config = $self->{pi_config};
+		my $pi_cfg = $self->{pi_cfg};
 
-		if (defined($pi_config->{'publicinbox.cgitrc'})) {
+		if (defined($pi_cfg->{'publicinbox.cgitrc'})) {
 			require PublicInbox::Cgit;
-			PublicInbox::Cgit->new($pi_config);
+			PublicInbox::Cgit->new($pi_cfg);
 		} else {
 			require Plack::Util;
 			Plack::Util::inline_object(call => sub { r404() });
@@ -538,7 +537,7 @@ sub stylesheets_prepare ($$) {
 	} || sub { $_[0] };
 
 	my $css_map = {};
-	my $stylesheets = $self->{pi_config}->{css} || [];
+	my $stylesheets = $self->{pi_cfg}->{css} || [];
 	my $links = [];
 	my $inline_ok = 1;
 
diff --git a/lib/PublicInbox/Watch.pm b/lib/PublicInbox/Watch.pm
index 8bbce929..e1246096 100644
--- a/lib/PublicInbox/Watch.pm
+++ b/lib/PublicInbox/Watch.pm
@@ -41,7 +41,7 @@ sub compile_watchheaders ($) {
 }
 
 sub new {
-	my ($class, $config) = @_;
+	my ($class, $cfg) = @_;
 	my (%mdmap, $spamc);
 	my (%imap, %nntp); # url => [inbox objects] or 'watchspam'
 
@@ -50,7 +50,7 @@ sub new {
 	# indefinitely...
 	foreach my $pfx (qw(publicinboxwatch publicinboxlearn)) {
 		my $k = "$pfx.watchspam";
-		defined(my $dirs = $config->{$k}) or next;
+		defined(my $dirs = $cfg->{$k}) or next;
 		$dirs = PublicInbox::Config::_array($dirs);
 		for my $dir (@$dirs) {
 			my $url;
@@ -69,10 +69,10 @@ sub new {
 
 	my $k = 'publicinboxwatch.spamcheck';
 	my $default = undef;
-	my $spamcheck = PublicInbox::Spamcheck::get($config, $k, $default);
+	my $spamcheck = PublicInbox::Spamcheck::get($cfg, $k, $default);
 	$spamcheck = _spamcheck_cb($spamcheck) if $spamcheck;
 
-	$config->each_inbox(sub {
+	$cfg->each_inbox(sub {
 		# need to make all inboxes writable for spam removal:
 		my $ibx = $_[0] = PublicInbox::InboxWritable->new($_[0]);
 
@@ -113,7 +113,7 @@ sub new {
 		spamcheck => $spamcheck,
 		mdmap => \%mdmap,
 		mdre => $mdre,
-		config => $config,
+		pi_cfg => $cfg,
 		imap => scalar keys %imap ? \%imap : undef,
 		nntp => scalar keys %nntp? \%nntp : undef,
 		importers => {},
@@ -175,7 +175,7 @@ sub _remove_spam {
 	$path =~ /:2,[A-R]*S[T-Za-z]*\z/ or return;
 	my $eml = eml_from_path($path) or return;
 	local $SIG{__WARN__} = warn_ignore_cb();
-	$self->{config}->each_inbox(\&remove_eml_i, $self, $eml, $path);
+	$self->{pi_cfg}->each_inbox(\&remove_eml_i, $self, $eml, $path);
 }
 
 sub import_eml ($$$) {
@@ -316,7 +316,7 @@ sub cfg_bool ($$$) {
 # flesh out common IMAP-specific data structures
 sub imap_common_init ($) {
 	my ($self) = @_;
-	my $cfg = $self->{config};
+	my $cfg = $self->{pi_cfg};
 	my $mic_args = {}; # scheme://authority => Mail:IMAPClient arg
 	for my $url (sort keys %{$self->{imap}}) {
 		my $uri = PublicInbox::URIimap->new($url);
@@ -418,7 +418,7 @@ sub imap_import_msg ($$$$$) {
 		if ($flags =~ /\\Seen\b/) {
 			local $SIG{__WARN__} = warn_ignore_cb();
 			my $eml = PublicInbox::Eml->new($raw);
-			$self->{config}->each_inbox(\&remove_eml_i,
+			$self->{pi_cfg}->each_inbox(\&remove_eml_i,
 						$self, $eml, "$url UID:$uid");
 		}
 	} else {
@@ -775,7 +775,7 @@ sub watch_imap_init ($$) {
 # flesh out common NNTP-specific data structures
 sub nntp_common_init ($) {
 	my ($self) = @_;
-	my $cfg = $self->{config};
+	my $cfg = $self->{pi_cfg};
 	my $nn_args = {}; # scheme://authority => Net::NNTP->new arg
 	for my $url (sort keys %{$self->{nntp}}) {
 		my $sec = uri_section(uri_new($url));
@@ -966,7 +966,7 @@ sub nntp_fetch_all ($$$) {
 			}
 		} elsif ($inboxes eq 'watchspam') {
 			my $eml = PublicInbox::Eml->new(\$raw);
-			$self->{config}->each_inbox(\&remove_eml_i,
+			$self->{pi_cfg}->each_inbox(\&remove_eml_i,
 					$self, $eml, "$url ARTICLE $art");
 		} else {
 			die "BUG: destination unknown $inboxes";
diff --git a/lib/PublicInbox/WwwListing.pm b/lib/PublicInbox/WwwListing.pm
index bda2761c..fce0e530 100644
--- a/lib/PublicInbox/WwwListing.pm
+++ b/lib/PublicInbox/WwwListing.pm
@@ -44,7 +44,7 @@ sub url_regexp {
 	my ($ctx, $key, $default) = @_;
 	$key //= 'publicInbox.wwwListing';
 	$default //= '404';
-	my $v = $ctx->{www}->{pi_config}->{lc $key} // $default;
+	my $v = $ctx->{www}->{pi_cfg}->{lc $key} // $default;
 again:
 	if ($v eq 'match=domain') {
 		my $h = $ctx->{env}->{HTTP_HOST} // $ctx->{env}->{SERVER_NAME};
@@ -70,7 +70,7 @@ sub response {
 	my ($class, $ctx) = @_;
 	bless $ctx, $class;
 	my $re = $ctx->url_regexp or return $ctx->psgi_triple;
-	my $iter = PublicInbox::ConfigIter->new($ctx->{www}->{pi_config},
+	my $iter = PublicInbox::ConfigIter->new($ctx->{www}->{pi_cfg},
 						\&list_match_i, $re, $ctx);
 	sub {
 		$ctx->{-wcb} = $_[0]; # HTTP server callback
diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index 849831a6..34e12435 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -81,7 +81,7 @@ sub coderepos ($) {
 	my $ibx = $ctx->{ibx};
 	my @ret;
 	if (defined(my $cr = $ibx->{coderepo})) {
-		my $cfg = $ctx->{www}->{pi_config};
+		my $cfg = $ctx->{www}->{pi_cfg};
 		my $env = $ctx->{env};
 		for my $cr_name (@$cr) {
 			my $urls = $cfg->{"coderepo.$cr_name.cgiturl"};
diff --git a/lib/PublicInbox/WwwText.pm b/lib/PublicInbox/WwwText.pm
index 53e15e45..a8560916 100644
--- a/lib/PublicInbox/WwwText.pm
+++ b/lib/PublicInbox/WwwText.pm
@@ -189,9 +189,9 @@ EOF
 ; line number ranges in `[PATCH]' emails link to /$INBOX_NAME/$OID/s/,
 ; an HTTP endpoint which reconstructs git blobs via git-apply(1).
 EOF
-		my $pi_config = $ctx->{www}->{pi_config};
+		my $pi_cfg = $ctx->{www}->{pi_cfg};
 		for my $cr_name (@$cr) {
-			my $urls = $pi_config->{"coderepo.$cr_name.cgiturl"};
+			my $urls = $pi_cfg->{"coderepo.$cr_name.cgiturl"};
 			my $path = "/path/to/$cr_name";
 			$cr_name = dq_escape($cr_name);
 
diff --git a/script/public-inbox-learn b/script/public-inbox-learn
index fb2d86ec..9352c8ff 100755
--- a/script/public-inbox-learn
+++ b/script/public-inbox-learn
@@ -36,7 +36,7 @@ if ($train !~ /\A(?:ham|spam|rm)\z/) {
 die "--all only works with `rm'\n" if $opt{all} && $train ne 'rm';
 
 my $spamc = PublicInbox::Spamcheck::Spamc->new;
-my $pi_config = PublicInbox::Config->new;
+my $pi_cfg = PublicInbox::Config->new;
 my $err;
 my $mime = PublicInbox::Eml->new(do{
 	local $/;
@@ -87,7 +87,7 @@ sub remove_or_add ($$$$) {
 
 # spam is removed from all known inboxes since it is often Bcc:-ed
 if ($train eq 'spam' || ($train eq 'rm' && $opt{all})) {
-	$pi_config->each_inbox(sub {
+	$pi_cfg->each_inbox(sub {
 		my ($ibx) = @_;
 		$ibx = PublicInbox::InboxWritable->new($ibx);
 		my $im = $ibx->importer(0);
@@ -102,7 +102,7 @@ if ($train eq 'spam' || ($train eq 'rm' && $opt{all})) {
 	for ($mime->header('Cc'), $mime->header('To')) {
 		foreach my $addr (PublicInbox::Address::emails($_)) {
 			$addr = lc($addr);
-			$dests{$addr} //= $pi_config->lookup($addr) // 0;
+			$dests{$addr} //= $pi_cfg->lookup($addr) // 0;
 		}
 	}
 
@@ -113,7 +113,7 @@ if ($train eq 'spam' || ($train eq 'rm' && $opt{all})) {
 		next if $seen{"$ibx"}++;
 		remove_or_add($ibx, $train, $mime, $addr);
 	}
-	my $dests = PublicInbox::MDA->inboxes_for_list_id($pi_config, $mime);
+	my $dests = PublicInbox::MDA->inboxes_for_list_id($pi_cfg, $mime);
 	for my $ibx (@$dests) {
 		next if $seen{"$ibx"}++;
 		remove_or_add($ibx, $train, $mime, $ibx->{-primary_address});
diff --git a/script/public-inbox-mda b/script/public-inbox-mda
index 3ed5abb6..40963f8e 100755
--- a/script/public-inbox-mda
+++ b/script/public-inbox-mda
@@ -42,18 +42,18 @@ my $str = do { local $/; <STDIN> };
 $str =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s;
 $ems->prepare(\$str);
 my $eml = PublicInbox::Eml->new(\$str);
-my $config = PublicInbox::Config->new;
+my $cfg = PublicInbox::Config->new;
 my $key = 'publicinboxmda.spamcheck';
 my $default = 'PublicInbox::Spamcheck::Spamc';
-my $spamc = PublicInbox::Spamcheck::get($config, $key, $default);
+my $spamc = PublicInbox::Spamcheck::get($cfg, $key, $default);
 my $dests = [];
 my $recipient = $ENV{ORIGINAL_RECIPIENT};
 if (defined $recipient) {
-	my $ibx = $config->lookup($recipient); # first check
+	my $ibx = $cfg->lookup($recipient); # first check
 	push @$dests, $ibx if $ibx;
 }
 if (!scalar(@$dests)) {
-	$dests = PublicInbox::MDA->inboxes_for_list_id($config, $eml);
+	$dests = PublicInbox::MDA->inboxes_for_list_id($cfg, $eml);
 	if (!scalar(@$dests) && !defined($recipient)) {
 		die "ORIGINAL_RECIPIENT not defined in ENV\n";
 	}
diff --git a/scripts/import_slrnspool b/scripts/import_slrnspool
index bdcc605c..0acffc1f 100755
--- a/scripts/import_slrnspool
+++ b/scripts/import_slrnspool
@@ -22,8 +22,8 @@ $SIG{TERM} = $sighandler;
 my $spool = shift @ARGV or die usage();
 my $recipient = $ENV{ORIGINAL_RECIPIENT};
 defined $recipient or die usage();
-my $config = PublicInbox::Config->new;
-my $ibx = $config->lookup($recipient);
+my $cfg = PublicInbox::Config->new;
+my $ibx = $cfg->lookup($recipient);
 my $git = $ibx->git;
 my $im;
 if ($ibx->version == 2) {
diff --git a/t/imapd.t b/t/imapd.t
index c1c52839..43ec200c 100644
--- a/t/imapd.t
+++ b/t/imapd.t
@@ -251,8 +251,8 @@ ok($mic->logout, 'logout works');
 
 my $have_inotify = eval { require Linux::Inotify2; 1 };
 
-my $pi_config = PublicInbox::Config->new;
-$pi_config->each_inbox(sub {
+my $pi_cfg = PublicInbox::Config->new;
+$pi_cfg->each_inbox(sub {
 	my ($ibx) = @_;
 	my $env = { ORIGINAL_RECIPIENT => $ibx->{-primary_address} };
 	my $name = $ibx->{name};
diff --git a/t/inbox_idle.t b/t/inbox_idle.t
index e16ee11b..198856bd 100644
--- a/t/inbox_idle.t
+++ b/t/inbox_idle.t
@@ -32,14 +32,14 @@ for my $V (1, 2) {
 		$sidx->set_metadata_once;
 		$sidx->idx_release; # allow watching on lockfile
 	}
-	my $pi_config = PublicInbox::Config->new(\<<EOF);
+	my $pi_cfg = PublicInbox::Config->new(\<<EOF);
 publicinbox.inbox-idle.inboxdir=$inboxdir
 publicinbox.inbox-idle.indexlevel=basic
 publicinbox.inbox-idle.address=test\@example.com
 EOF
 	my $ident = 'whatever';
-	$pi_config->each_inbox(sub { shift->subscribe_unlock($ident, $obj) });
-	my $ii = PublicInbox::InboxIdle->new($pi_config);
+	$pi_cfg->each_inbox(sub { shift->subscribe_unlock($ident, $obj) });
+	my $ii = PublicInbox::InboxIdle->new($pi_cfg);
 	ok($ii, 'InboxIdle created');
 	SKIP: {
 		skip('inotify or kqueue missing', 1) unless $ii->{sock};
@@ -50,7 +50,7 @@ EOF
 	PublicInbox::SearchIdx->new($ibx)->index_sync if $V == 1;
 	$ii->event_step;
 	is(scalar @{$obj->{called}}, 1, 'called on unlock');
-	$pi_config->each_inbox(sub { shift->unsubscribe_unlock($ident) });
+	$pi_cfg->each_inbox(sub { shift->unsubscribe_unlock($ident) });
 	ok($im->add(eml_load('t/data/0001.patch')), "$V added #2");
 	$im->done;
 	PublicInbox::SearchIdx->new($ibx)->index_sync if $V == 1;
diff --git a/t/mda_filter_rubylang.t b/t/mda_filter_rubylang.t
index 754d52f7..489ea223 100644
--- a/t/mda_filter_rubylang.t
+++ b/t/mda_filter_rubylang.t
@@ -44,8 +44,8 @@ something
 EOF
 		ok(run_script(['-mda'], $env, $opt), 'message delivered');
 	}
-	my $config = PublicInbox::Config->new;
-	my $ibx = $config->lookup_name($v);
+	my $cfg = PublicInbox::Config->new;
+	my $ibx = $cfg->lookup_name($v);
 
 	# make sure all serials are searchable:
 	for my $i (1..2) {
diff --git a/t/nntp.t b/t/nntp.t
index 3d2f524c..b745886d 100644
--- a/t/nntp.t
+++ b/t/nntp.t
@@ -113,7 +113,7 @@ use PublicInbox::Config;
 	my $mock_self = {
 		nntpd => {
 			servername => 'example.com',
-			pi_config => bless {}, 'PublicInbox::Config',
+			pi_cfg => bless {}, 'PublicInbox::Config',
 		},
 		ibx => $ibx,
 	};
diff --git a/t/psgi_mount.t b/t/psgi_mount.t
index b4de8274..dac62c1a 100644
--- a/t/psgi_mount.t
+++ b/t/psgi_mount.t
@@ -17,7 +17,7 @@ use_ok 'PublicInbox::WWW';
 use PublicInbox::Import;
 use PublicInbox::Git;
 use PublicInbox::Config;
-my $config = PublicInbox::Config->new(\<<EOF);
+my $cfg = PublicInbox::Config->new(\<<EOF);
 $cfgpfx.address=$addr
 $cfgpfx.inboxdir=$maindir
 EOF
@@ -39,7 +39,7 @@ EOF
 	$im->done;
 }
 
-my $www = PublicInbox::WWW->new($config);
+my $www = PublicInbox::WWW->new($cfg);
 my $app = builder(sub {
 	enable('Head');
 	mount('/a' => builder(sub { sub { $www->call(@_) } }));
@@ -85,7 +85,7 @@ test_psgi($app, sub {
 
 SKIP: {
 	require_mods(qw(DBD::SQLite Search::Xapian IO::Uncompress::Gunzip), 3);
-	my $ibx = $config->lookup_name('test');
+	my $ibx = $cfg->lookup_name('test');
 	require_ok 'PublicInbox::SearchIdx';
 	PublicInbox::SearchIdx->new($ibx, 1)->index_sync;
 	test_psgi($app, sub {
diff --git a/t/psgi_search.t b/t/psgi_search.t
index c1677eb3..07fb4846 100644
--- a/t/psgi_search.t
+++ b/t/psgi_search.t
@@ -67,11 +67,11 @@ $im->done;
 PublicInbox::SearchIdx->new($ibx, 1)->index_sync;
 
 my $cfgpfx = "publicinbox.test";
-my $config = PublicInbox::Config->new(\<<EOF);
+my $cfg = PublicInbox::Config->new(\<<EOF);
 $cfgpfx.address=git\@vger.kernel.org
 $cfgpfx.inboxdir=$tmpdir
 EOF
-my $www = PublicInbox::WWW->new($config);
+my $www = PublicInbox::WWW->new($cfg);
 test_psgi(sub { $www->call(@_) }, sub {
 	my ($cb) = @_;
 	my $res;
@@ -144,7 +144,7 @@ test_psgi(sub { $www->call(@_) }, sub {
 		$xdb->set_metadata('has_threadid', '0');
 		$sidx->idx_release;
 	}
-	$config->each_inbox(sub { delete $_[0]->{search} });
+	$cfg->each_inbox(sub { delete $_[0]->{search} });
 	$res = $cb->(GET('/test/?q=s:test'));
 	is($res->code, 200, 'successful search w/o has_threadid');
 	unlike($html, qr/download mbox\.gz: .*?"full threads"/s,
diff --git a/t/psgi_v2.t b/t/psgi_v2.t
index 11aef5b3..0ceb26ed 100644
--- a/t/psgi_v2.t
+++ b/t/psgi_v2.t
@@ -83,12 +83,11 @@ like($$msg, qr/\AFrom oldbug/s,
 	'"From_" line stored to test old bug workaround');
 
 my $cfgpfx = "publicinbox.v2test";
-my $cfg = <<EOF;
+my $cfg = PublicInbox::Config->new(\<<EOF);
 $cfgpfx.address=$ibx->{-primary_address}
 $cfgpfx.inboxdir=$inboxdir
 EOF
-my $config = PublicInbox::Config->new(\$cfg);
-my $www = PublicInbox::WWW->new($config);
+my $www = PublicInbox::WWW->new($cfg);
 my ($res, $raw, @from_);
 my $client0 = sub {
 	my ($cb) = @_;
@@ -150,7 +149,7 @@ my $client1 = sub {
 	like($raw, qr/^hello ghosts$/m, 'got third message');
 	@from_ = ($raw =~ m/^From /mg);
 	is(scalar(@from_), 3, 'three From_ lines');
-	$config->each_inbox(sub { $_[0]->search->reopen });
+	$cfg->each_inbox(sub { $_[0]->search->reopen });
 
 	SKIP: {
 		eval { require IO::Uncompress::Gunzip };
@@ -240,7 +239,7 @@ $run_httpd->($client1, 38);
 	$im->done;
 	my @h = $mime->header('Message-ID');
 	is_deeply($exp, \@h, 'reused existing Message-ID');
-	$config->each_inbox(sub { $_[0]->search->reopen });
+	$cfg->each_inbox(sub { $_[0]->search->reopen });
 }
 
 my $client2 = sub {
@@ -279,7 +278,7 @@ $run_httpd->($client2, 8);
 		ok($im->add($mime), "added attachment $body");
 	}
 	$im->done;
-	$config->each_inbox(sub { $_[0]->search->reopen });
+	$cfg->each_inbox(sub { $_[0]->search->reopen });
 }
 
 my $client3 = sub {
diff --git a/t/watch_filter_rubylang.t b/t/watch_filter_rubylang.t
index 6513f30b..9c70b4ea 100644
--- a/t/watch_filter_rubylang.t
+++ b/t/watch_filter_rubylang.t
@@ -72,11 +72,11 @@ $cfgpfx.filter=PublicInbox::Filter::RubyLang
 $cfgpfx.altid=serial:alerts:file=msgmap.sqlite3
 publicinboxwatch.watchspam=maildir:$spamdir
 EOF
-	my $config = PublicInbox::Config->new(\$orig);
-	my $ibx = $config->lookup_name($v);
+	my $cfg = PublicInbox::Config->new(\$orig);
+	my $ibx = $cfg->lookup_name($v);
 	ok($ibx, 'found inbox by name');
 
-	my $w = PublicInbox::Watch->new($config);
+	my $w = PublicInbox::Watch->new($cfg);
 	for my $i (1..2) {
 		$w->scan('full');
 	}
@@ -101,8 +101,8 @@ EOF
 	}
 	$w->scan('full');
 
-	$config = PublicInbox::Config->new(\$orig);
-	$ibx = $config->lookup_name($v);
+	$cfg = PublicInbox::Config->new(\$orig);
+	$ibx = $cfg->lookup_name($v);
 	is($ibx->search->reopen->mset('b:spam')->size, 0, 'spam removed');
 
 	is_deeply([], \@warn, 'no warnings');
diff --git a/t/watch_maildir.t b/t/watch_maildir.t
index ae53caf9..c948b41b 100644
--- a/t/watch_maildir.t
+++ b/t/watch_maildir.t
@@ -34,13 +34,13 @@ my $sem = PublicInbox::Emergency->new($spamdir); # create dirs
 {
 	my @w;
 	local $SIG{__WARN__} = sub { push @w, @_ };
-	my $config = PublicInbox::Config->new(\<<EOF);
+	my $cfg = PublicInbox::Config->new(\<<EOF);
 $cfgpfx.address=$addr
 $cfgpfx.inboxdir=$git_dir
 $cfgpfx.watch=maildir:$spamdir
 publicinboxlearn.watchspam=maildir:$spamdir
 EOF
-	my $wm = PublicInbox::Watch->new($config);
+	my $wm = PublicInbox::Watch->new($cfg);
 	is(scalar grep(/is a spam folder/, @w), 1, 'got warning about spam');
 	is_deeply($wm->{mdmap}, { "$spamdir/cur" => 'watchspam' },
 		'only got the spam folder to watch');
@@ -61,8 +61,8 @@ EOF
 	close $fh or BAIL_OUT $!;
 }
 
-my $config = PublicInbox::Config->new($cfg_path);
-PublicInbox::Watch->new($config)->scan('full');
+my $cfg = PublicInbox::Config->new($cfg_path);
+PublicInbox::Watch->new($cfg)->scan('full');
 my $git = PublicInbox::Git->new($git_dir);
 my @list = $git->qx(qw(rev-list refs/heads/master));
 is(scalar @list, 1, 'one revision in rev-list');
@@ -79,7 +79,7 @@ my $write_spam = sub {
 };
 $write_spam->();
 is(unlink(glob("$maildir/new/*")), 1, 'unlinked old spam');
-PublicInbox::Watch->new($config)->scan('full');
+PublicInbox::Watch->new($cfg)->scan('full');
 @list = $git->qx(qw(rev-list refs/heads/master));
 is(scalar @list, 2, 'two revisions in rev-list');
 @list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
@@ -93,7 +93,7 @@ To unsubscribe from this list: send the line "unsubscribe git" in
 the body of a message to majordomo\@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
 	PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-	PublicInbox::Watch->new($config)->scan('full');
+	PublicInbox::Watch->new($cfg)->scan('full');
 	@list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
 	is(scalar @list, 1, 'tree has one file');
 	my $mref = $git->cat_file('HEAD:'.$list[0]);
@@ -101,7 +101,7 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
 
 	is(unlink(glob("$maildir/new/*")), 1, 'unlinked spam');
 	$write_spam->();
-	PublicInbox::Watch->new($config)->scan('full');
+	PublicInbox::Watch->new($cfg)->scan('full');
 	@list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
 	is(scalar @list, 0, 'tree is empty');
 	@list = $git->qx(qw(rev-list refs/heads/master));
@@ -115,10 +115,10 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
 	my $fail_path = "$fail_bin:$ENV{PATH}"; # for spamc ham mock
 	local $ENV{PATH} = $fail_path;
 	PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-	$config->{'publicinboxwatch.spamcheck'} = 'spamc';
+	$cfg->{'publicinboxwatch.spamcheck'} = 'spamc';
 	{
 		local $SIG{__WARN__} = sub {}; # quiet spam check warning
-		PublicInbox::Watch->new($config)->scan('full');
+		PublicInbox::Watch->new($cfg)->scan('full');
 	}
 	@list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
 	is(scalar @list, 0, 'tree has no files spamc checked');
@@ -131,9 +131,9 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
 	my $main_path = "$main_bin:$ENV{PATH}"; # for spamc ham mock
 	local $ENV{PATH} = $main_path;
 	PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-	$config->{'publicinboxwatch.spamcheck'} = 'spamc';
+	$cfg->{'publicinboxwatch.spamcheck'} = 'spamc';
 	@list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
-	PublicInbox::Watch->new($config)->scan('full');
+	PublicInbox::Watch->new($cfg)->scan('full');
 	@list = $git->qx(qw(ls-tree -r --name-only refs/heads/master));
 	is(scalar @list, 1, 'tree has one file after spamc checked');
 
@@ -166,9 +166,9 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
 		$delivered++;
 	};
 	PublicInbox::DS->Reset;
-	my $ii = PublicInbox::InboxIdle->new($config);
+	my $ii = PublicInbox::InboxIdle->new($cfg);
 	my $obj = bless \$cb, 'PublicInbox::TestCommon::InboxWakeup';
-	$config->each_inbox(sub { $_[0]->subscribe_unlock('ident', $obj) });
+	$cfg->each_inbox(sub { $_[0]->subscribe_unlock('ident', $obj) });
 	PublicInbox::DS->SetPostLoopCallback(sub { $delivered == 0 });
 
 	# wait for -watch to setup inotify watches
diff --git a/t/watch_maildir_v2.t b/t/watch_maildir_v2.t
index 12546418..532e5c7c 100644
--- a/t/watch_maildir_v2.t
+++ b/t/watch_maildir_v2.t
@@ -44,11 +44,11 @@ $cfgpfx.watch=maildir:$maildir
 $cfgpfx.filter=PublicInbox::Filter::Vger
 publicinboxlearn.watchspam=maildir:$spamdir
 EOF
-my $config = PublicInbox::Config->new(\$orig);
-my $ibx = $config->lookup_name('test');
+my $cfg = PublicInbox::Config->new(\$orig);
+my $ibx = $cfg->lookup_name('test');
 ok($ibx, 'found inbox by name');
 
-PublicInbox::Watch->new($config)->scan('full');
+PublicInbox::Watch->new($cfg)->scan('full');
 my $total = scalar @{$ibx->over->recent};
 is($total, 1, 'got one revision');
 
@@ -68,7 +68,7 @@ my $write_spam = sub {
 };
 $write_spam->();
 is(unlink(glob("$maildir/new/*")), 1, 'unlinked old spam');
-PublicInbox::Watch->new($config)->scan('full');
+PublicInbox::Watch->new($cfg)->scan('full');
 is_deeply($ibx->over->recent, [], 'deleted file');
 is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam');
 
@@ -79,7 +79,7 @@ To unsubscribe from this list: send the line "unsubscribe git" in
 the body of a message to majordomo\@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
 	PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-	PublicInbox::Watch->new($config)->scan('full');
+	PublicInbox::Watch->new($cfg)->scan('full');
 	my $msgs = $ibx->over->recent;
 	is(scalar(@$msgs), 1, 'got one file back');
 	my $mref = $ibx->msg_by_smsg($msgs->[0]);
@@ -87,7 +87,7 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
 
 	is(unlink(glob("$maildir/new/*")), 1, 'unlinked spam');
 	$write_spam->();
-	PublicInbox::Watch->new($config)->scan('full');
+	PublicInbox::Watch->new($cfg)->scan('full');
 	$msgs = $ibx->over->recent;
 	is(scalar(@$msgs), 0, 'inbox is empty again');
 	is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam');
@@ -99,10 +99,10 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
 	my $fail_path = "$fail_bin:$ENV{PATH}"; # for spamc ham mock
 	local $ENV{PATH} = $fail_path;
 	PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-	$config->{'publicinboxwatch.spamcheck'} = 'spamc';
+	$cfg->{'publicinboxwatch.spamcheck'} = 'spamc';
 	{
 		local $SIG{__WARN__} = sub {}; # quiet spam check warning
-		PublicInbox::Watch->new($config)->scan('full');
+		PublicInbox::Watch->new($cfg)->scan('full');
 	}
 	my $msgs = $ibx->over->recent;
 	is(scalar(@$msgs), 0, 'inbox is still empty');
@@ -115,13 +115,13 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
 	my $main_path = "$main_bin:$ENV{PATH}"; # for spamc ham mock
 	local $ENV{PATH} = $main_path;
 	PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-	$config->{'publicinboxwatch.spamcheck'} = 'spamc';
-	PublicInbox::Watch->new($config)->scan('full');
+	$cfg->{'publicinboxwatch.spamcheck'} = 'spamc';
+	PublicInbox::Watch->new($cfg)->scan('full');
 	my $msgs = $ibx->over->recent;
 	is(scalar(@$msgs), 1, 'inbox has one mail after spamc OK-ed a message');
 	my $mref = $ibx->msg_by_smsg($msgs->[0]);
 	like($$mref, qr/something\n\z/s, 'message scrubbed on import');
-	delete $config->{'publicinboxwatch.spamcheck'};
+	delete $cfg->{'publicinboxwatch.spamcheck'};
 }
 
 {
@@ -129,7 +129,7 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
 	open my $fh, '<', $patch or die "failed to open $patch: $!\n";
 	$msg = do { local $/; <$fh> };
 	PublicInbox::Emergency->new($maildir)->prepare(\$msg);
-	PublicInbox::Watch->new($config)->scan('full');
+	PublicInbox::Watch->new($cfg)->scan('full');
 	my $post = $ibx->search->reopen->mset('dfpost:6e006fd7');
 	is($post->size, 1, 'diff postimage found');
 	my $pre = $ibx->search->mset('dfpre:090d998b6c2c');
@@ -146,12 +146,12 @@ More majordomo info at  http://vger.kernel.org/majordomo-info.html\n);
 	my $v1pfx = "publicinbox.v1";
 	my $v1addr = 'v1-public@example.com';
 	PublicInbox::Import::init_bare($v1repo);
-	my $cfg2 = <<EOF;
+	my $raw = <<EOF;
 $orig$v1pfx.address=$v1addr
 $v1pfx.inboxdir=$v1repo
 $v1pfx.watch=maildir:$maildir
 EOF
-	my $config = PublicInbox::Config->new(\$cfg2);
+	my $cfg = PublicInbox::Config->new(\$raw);
 	my $both = <<EOF;
 From: user\@example.com
 To: $addr, $v1addr
@@ -162,10 +162,10 @@ Date: Sat, 18 Jun 2016 00:00:00 +0000
 both
 EOF
 	PublicInbox::Emergency->new($maildir)->prepare(\$both);
-	PublicInbox::Watch->new($config)->scan('full');
+	PublicInbox::Watch->new($cfg)->scan('full');
 	my $mset = $ibx->search->reopen->mset('m:both@b.com');
 	my $msgs = $ibx->search->mset_to_smsg($ibx, $mset);
-	my $v1 = $config->lookup_name('v1');
+	my $v1 = $cfg->lookup_name('v1');
 	my $msg = $v1->git->cat_file($msgs->[0]->{blob});
 	is($both, $$msg, 'got original message back from v1');
 	$msg = $ibx->git->cat_file($msgs->[0]->{blob});
@@ -184,21 +184,21 @@ List-Id: <do.not.want>
 X-Mailing-List: no@example.com
 Message-ID: <do.not.want@example.com>
 EOF
-	my $cfg = $orig."$cfgpfx.listid=i.want.you.to.want.me\n";
+	my $raw = $orig."$cfgpfx.listid=i.want.you.to.want.me\n";
 	PublicInbox::Emergency->new($maildir)->prepare(\$want);
 	PublicInbox::Emergency->new($maildir)->prepare(\$do_not_want);
-	my $config = PublicInbox::Config->new(\$cfg);
-	PublicInbox::Watch->new($config)->scan('full');
-	$ibx = $config->lookup_name('test');
+	my $cfg = PublicInbox::Config->new(\$raw);
+	PublicInbox::Watch->new($cfg)->scan('full');
+	$ibx = $cfg->lookup_name('test');
 	my $num = $ibx->mm->num_for('do.want@example.com');
 	ok(defined $num, 'List-ID matched for watch');
 	$num = $ibx->mm->num_for('do.not.want@example.com');
 	is($num, undef, 'unaccepted List-ID matched for watch');
 
-	$cfg = $orig."$cfgpfx.watchheader=X-Mailing-List:no\@example.com\n";
-	$config = PublicInbox::Config->new(\$cfg);
-	PublicInbox::Watch->new($config)->scan('full');
-	$ibx = $config->lookup_name('test');
+	$raw = $orig."$cfgpfx.watchheader=X-Mailing-List:no\@example.com\n";
+	$cfg = PublicInbox::Config->new(\$raw);
+	PublicInbox::Watch->new($cfg)->scan('full');
+	$ibx = $cfg->lookup_name('test');
 	$num = $ibx->mm->num_for('do.not.want@example.com');
 	ok(defined $num, 'X-Mailing-List matched');
 }
diff --git a/t/watch_multiple_headers.t b/t/watch_multiple_headers.t
index a0813532..1fe392d4 100644
--- a/t/watch_multiple_headers.t
+++ b/t/watch_multiple_headers.t
@@ -54,16 +54,16 @@ PublicInbox::Emergency->new($maildir)->prepare(\$msg_to);
 PublicInbox::Emergency->new($maildir)->prepare(\$msg_cc);
 PublicInbox::Emergency->new($maildir)->prepare(\$msg_none);
 
-my $cfg = <<EOF;
+my $raw = <<EOF;
 $cfgpfx.address=$addr
 $cfgpfx.inboxdir=$inboxdir
 $cfgpfx.watch=maildir:$maildir
 $cfgpfx.watchheader=To:$addr
 $cfgpfx.watchheader=Cc:$addr
 EOF
-my $config = PublicInbox::Config->new(\$cfg);
-PublicInbox::Watch->new($config)->scan('full');
-my $ibx = $config->lookup_name('test');
+my $cfg = PublicInbox::Config->new(\$raw);
+PublicInbox::Watch->new($cfg)->scan('full');
+my $ibx = $cfg->lookup_name('test');
 ok($ibx, 'found inbox by name');
 
 my $num = $ibx->mm->num_for('to@a.com');

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/6] extindex: do not use current dir like -index does
  2020-12-08 21:21 [PATCH 0/6] minor internal consistency things Eric Wong
                   ` (2 preceding siblings ...)
  2020-12-08 21:21 ` [PATCH 3/6] rename {pi_config} fields to {pi_cfg} Eric Wong
@ 2020-12-08 21:21 ` Eric Wong
  2020-12-08 21:21 ` [PATCH 5/6] admin: resolve_repo_dir => resolve_inboxdir Eric Wong
  2020-12-08 21:21 ` [PATCH 6/6] extsearchidx: ck_existing: set $OID for warning context Eric Wong
  5 siblings, 0 replies; 7+ messages in thread
From: Eric Wong @ 2020-12-08 21:21 UTC (permalink / raw)
  To: meta

At least not for resolving inboxes, since there's no good way
for a user to specify what is an inbox or extindex directory
without a command-line switch.

Instead of changing the -extindex command, we change the -index
command internals to rely on the new {-use_cwd} flag to avoid
internal use of negation, since double-negatives and the like
are confusing to me.
---
 lib/PublicInbox/Admin.pm  | 2 +-
 script/public-inbox-index | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Admin.pm b/lib/PublicInbox/Admin.pm
index 9d48e5eb..ec80b565 100644
--- a/lib/PublicInbox/Admin.pm
+++ b/lib/PublicInbox/Admin.pm
@@ -118,7 +118,7 @@ EOF
 	} else { # directories specified on the command-line
 		my $i = 0;
 		my @dirs = @$argv;
-		push @dirs, '.' unless @dirs;
+		push @dirs, '.' if !@dirs && $opt->{-use_cwd};
 		foreach (@dirs) {
 			my $v;
 			my $dir = resolve_repo_dir($_, \$v);
diff --git a/script/public-inbox-index b/script/public-inbox-index
index 5909801e..8a61817c 100755
--- a/script/public-inbox-index
+++ b/script/public-inbox-index
@@ -51,6 +51,7 @@ require PublicInbox::Admin;
 PublicInbox::Admin::require_or_die('-index');
 
 my $cfg = PublicInbox::Config->new; # Config is loaded by Admin
+$opt->{-use_cwd} = 1;
 my @ibxs = PublicInbox::Admin::resolve_inboxes(\@ARGV, $opt, $cfg);
 PublicInbox::Admin::require_or_die('-index');
 unless (@ibxs) { print STDERR $help; exit 1 }

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/6] admin: resolve_repo_dir => resolve_inboxdir
  2020-12-08 21:21 [PATCH 0/6] minor internal consistency things Eric Wong
                   ` (3 preceding siblings ...)
  2020-12-08 21:21 ` [PATCH 4/6] extindex: do not use current dir like -index does Eric Wong
@ 2020-12-08 21:21 ` Eric Wong
  2020-12-08 21:21 ` [PATCH 6/6] extsearchidx: ck_existing: set $OID for warning context Eric Wong
  5 siblings, 0 replies; 7+ messages in thread
From: Eric Wong @ 2020-12-08 21:21 UTC (permalink / raw)
  To: meta

We've stopped referring to inboxdirs as "repos" a while ago
since v2 inboxes have multiple git repos associated with them.

So update the name to reflect that and avoid an unnecessary
export that's only used by a test case.
---
 lib/PublicInbox/Admin.pm |  6 +++---
 t/admin.t                | 28 ++++++++++++++++------------
 2 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/lib/PublicInbox/Admin.pm b/lib/PublicInbox/Admin.pm
index ec80b565..eeef2f63 100644
--- a/lib/PublicInbox/Admin.pm
+++ b/lib/PublicInbox/Admin.pm
@@ -8,7 +8,7 @@ use strict;
 use parent qw(Exporter);
 use Cwd qw(abs_path);
 use POSIX ();
-our @EXPORT_OK = qw(resolve_repo_dir setup_signals);
+our @EXPORT_OK = qw(setup_signals);
 use PublicInbox::Config;
 use PublicInbox::Inbox;
 use PublicInbox::Spawn qw(popen_rd);
@@ -27,7 +27,7 @@ sub setup_signals {
 	};
 }
 
-sub resolve_repo_dir {
+sub resolve_inboxdir {
 	my ($cd, $ver) = @_;
 	my $prefix = defined $cd ? $cd : './';
 	if (-d $prefix && -f "$prefix/inbox.lock") { # v2
@@ -121,7 +121,7 @@ EOF
 		push @dirs, '.' if !@dirs && $opt->{-use_cwd};
 		foreach (@dirs) {
 			my $v;
-			my $dir = resolve_repo_dir($_, \$v);
+			my $dir = resolve_inboxdir($_, \$v);
 			if ($v < $min_ver) {
 				push @old, $dir;
 				next;
diff --git a/t/admin.t b/t/admin.t
index c25667b2..af132577 100644
--- a/t/admin.t
+++ b/t/admin.t
@@ -5,24 +5,28 @@ use warnings;
 use Test::More;
 use PublicInbox::TestCommon;
 use PublicInbox::Import;
-use_ok 'PublicInbox::Admin', qw(resolve_repo_dir);
+use_ok 'PublicInbox::Admin';
 my ($tmpdir, $for_destroy) = tmpdir();
 my $git_dir = "$tmpdir/v1";
 my $v2_dir = "$tmpdir/v2";
 my ($res, $err, $v);
 
 PublicInbox::Import::init_bare($git_dir);
+*resolve_inboxdir = do {
+	no warnings 'once';
+	*PublicInbox::Admin::resolve_inboxdir;
+};
 
 # v1
-is(resolve_repo_dir($git_dir), $git_dir, 'top-level GIT_DIR resolved');
-is(resolve_repo_dir("$git_dir/objects"), $git_dir, 'GIT_DIR/objects resolved');
+is(resolve_inboxdir($git_dir), $git_dir, 'top-level GIT_DIR resolved');
+is(resolve_inboxdir("$git_dir/objects"), $git_dir, 'GIT_DIR/objects resolved');
 
 ok(chdir($git_dir), 'chdir GIT_DIR works');
-is(resolve_repo_dir(), $git_dir, 'resolve_repo_dir works in GIT_DIR');
+is(resolve_inboxdir(), $git_dir, 'resolve_inboxdir works in GIT_DIR');
 
 ok(chdir("$git_dir/objects"), 'chdir GIT_DIR/objects works');
-is(resolve_repo_dir(), $git_dir, 'resolve_repo_dir works in GIT_DIR');
-$res = resolve_repo_dir(undef, \$v);
+is(resolve_inboxdir(), $git_dir, 'resolve_inboxdir works in GIT_DIR');
+$res = resolve_inboxdir(undef, \$v);
 is($v, 1, 'version 1 detected');
 is($res, $git_dir, 'detects directory along with version');
 
@@ -36,13 +40,13 @@ SKIP: {
 
 	ok(chdir($no_vcs_dir), 'chdir to a non-inbox');
 	open STDERR, '>&', $null or die "redirect stderr to /dev/null: $!";
-	$res = eval { resolve_repo_dir() };
+	$res = eval { resolve_inboxdir() };
 	open STDERR, '>&', $olderr or die "restore stderr: $!";
 	is($res, undef, 'fails inside non-version-controlled dir');
 
 	ok(chdir($tmpdir), 'back to test-specific $tmpdir');
 	open STDERR, '>&', $null or die "redirect stderr to /dev/null: $!";
-	$res = eval { resolve_repo_dir($no_vcs_dir) };
+	$res = eval { resolve_inboxdir($no_vcs_dir) };
 	$err = $@;
 	open STDERR, '>&', $olderr or die "restore stderr: $!";
 	is($res, undef, 'fails on non-version-controlled dir');
@@ -66,11 +70,11 @@ SKIP: {
 	PublicInbox::V2Writable->new($ibx, 1)->idx_init;
 
 	ok(-e "$v2_dir/inbox.lock", 'exists');
-	is(resolve_repo_dir($v2_dir), $v2_dir,
-		'resolve_repo_dir works on v2_dir');
+	is(resolve_inboxdir($v2_dir), $v2_dir,
+		'resolve_inboxdir works on v2_dir');
 	ok(chdir($v2_dir), 'chdir v2_dir OK');
-	is(resolve_repo_dir(), $v2_dir, 'resolve_repo_dir works inside v2_dir');
-	$res = resolve_repo_dir(undef, \$v);
+	is(resolve_inboxdir(), $v2_dir, 'resolve_inboxdir works inside v2_dir');
+	$res = resolve_inboxdir(undef, \$v);
 	is($v, 2, 'version 2 detected');
 	is($res, $v2_dir, 'detects directory along with version');
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 6/6] extsearchidx: ck_existing: set $OID for warning context
  2020-12-08 21:21 [PATCH 0/6] minor internal consistency things Eric Wong
                   ` (4 preceding siblings ...)
  2020-12-08 21:21 ` [PATCH 5/6] admin: resolve_repo_dir => resolve_inboxdir Eric Wong
@ 2020-12-08 21:21 ` Eric Wong
  5 siblings, 0 replies; 7+ messages in thread
From: Eric Wong @ 2020-12-08 21:21 UTC (permalink / raw)
  To: meta

The content_hash() hash in the same scope may trigger warnings
for a given blob, so ensure we correctly report the blob where
it happens.
---
 lib/PublicInbox/ExtSearchIdx.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm
index c82d1633..11f7786d 100644
--- a/lib/PublicInbox/ExtSearchIdx.pm
+++ b/lib/PublicInbox/ExtSearchIdx.pm
@@ -222,6 +222,8 @@ sub ck_existing { # git->cat_async callback
 	if ($type eq 'missing') {
 		_blob_missing($req);
 	} elsif (!is_bad_blob($oid, $type, $size, $smsg->{blob})) {
+		my $self = $req->{self} // die 'BUG: {self} missing';
+		local $self->{current_info} = "$self->{current_info} $oid";
 		my $cur = PublicInbox::Eml->new($bref);
 		if (content_hash($cur) eq $req->{chash}) {
 			push @{$req->{indexed}}, $smsg; # for do_xpost

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-12-08 21:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08 21:21 [PATCH 0/6] minor internal consistency things Eric Wong
2020-12-08 21:21 ` [PATCH 1/6] treewide: replace {-inbox} with {ibx} for consistency Eric Wong
2020-12-08 21:21 ` [PATCH 2/6] nntp: replace {ng} " Eric Wong
2020-12-08 21:21 ` [PATCH 3/6] rename {pi_config} fields to {pi_cfg} Eric Wong
2020-12-08 21:21 ` [PATCH 4/6] extindex: do not use current dir like -index does Eric Wong
2020-12-08 21:21 ` [PATCH 5/6] admin: resolve_repo_dir => resolve_inboxdir Eric Wong
2020-12-08 21:21 ` [PATCH 6/6] extsearchidx: ck_existing: set $OID for warning context Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).