From 0e2b20d6eb0754426d021d8db1fb8db7584dd925 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 14 Nov 2023 00:32:20 +0000 Subject: config: avoid eidx_key and newsgroup conflicts Start lowercasing newsgroup names automatically since uppercase names are incompatible with IMAP and POP3 and also causes problems with both -extindex and -cindex. We'll also warn on eidx_key and newsgroup conflicts to avoid sometimes subtle breakage when using -extindex and -cindex. --- lib/PublicInbox/Config.pm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/Config.pm') diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm index 01cb536d..9bee94b8 100644 --- a/lib/PublicInbox/Config.pm +++ b/lib/PublicInbox/Config.pm @@ -509,9 +509,16 @@ sub _fill_ibx { delete $ibx->{newsgroup}; warn "newsgroup name invalid: `$ngname'\n"; } else { + my $lc = $ibx->{newsgroup} = lc $ngname; + warn <nntp_usable # checks, keep this lean for startup speed - $self->{-by_newsgroup}->{$ngname} = $ibx; + my $cur = $self->{-by_newsgroup}->{$lc} //= $ibx; + warn <{name}' and `$ibx->{name}' +EOM } } unless (defined $ibx->{newsgroup}) { # for ->eidx_key @@ -531,7 +538,10 @@ sub _fill_ibx { require PublicInbox::Isearch; $ibx->{isrch} = PublicInbox::Isearch->new($ibx, $es); } - $self->{-by_eidx_key}->{$ibx->eidx_key} = $ibx; + my $cur = $self->{-by_eidx_key}->{my $ekey = $ibx->eidx_key} //= $ibx; + $cur == $ibx or warn + "W: `$ekey' used by both `$cur->{name}' and `$ibx->{name}'\n"; + $ibx; } sub _fill_ei ($$) { -- cgit v1.2.3-24-ge0c7