From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 2D3EB1FA04 for ; Tue, 26 May 2020 09:05:25 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/2] learn: fix buggy typo on List-ID mapping Date: Tue, 26 May 2020 09:05:23 +0000 Message-Id: <20200526090524.2831-2-e@yhbt.net> In-Reply-To: <20200526090524.2831-1-e@yhbt.net> References: <20200526090524.2831-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: There is obviously a typo here, so fix it and add a test case to guard against future regressions. Fixes: 74a3206babe0572a ("mda: support multiple List-ID matches") --- script/public-inbox-learn | 2 +- t/mda.t | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/script/public-inbox-learn b/script/public-inbox-learn index a33d813ad01..0cb2c8e96e5 100644 --- a/script/public-inbox-learn +++ b/script/public-inbox-learn @@ -97,7 +97,7 @@ if ($train eq 'spam') { } my $dests = PublicInbox::MDA->inboxes_for_list_id($pi_config, $mime); for my $ibx (@$dests) { - next if !$seen{"$ibx"}++; + next if $seen{"$ibx"}++; remove_or_add($ibx, $train, $mime, $ibx->{-primary_address}); } } diff --git a/t/mda.t b/t/mda.t index 759c0b020ab..c7caf3e0cca 100644 --- a/t/mda.t +++ b/t/mda.t @@ -299,9 +299,17 @@ EOF ok(run_script(['-mda'], undef, $rdr), 'mda OK with multiple List-Id matches'); $cur = $git->qx(qw(diff HEAD~1..HEAD)); - like($cur, qr/Message-ID: <2lids\@example>/, + like($cur, qr/^\+Message-ID: <2lids\@example>/sm, 'multi List-ID match delivered'); like($err, qr/multiple List-ID/, 'warned about multiple List-ID'); + + # ensure -learn rm works after inbox address is updated + ($out, $err) = ('', ''); + xsys(qw(git config --file), $pi_config, "$cfgpfx.address", + 'updated-address@example.com'); + ok(run_script(['-learn', 'rm'], undef, $rdr), 'rm-ed via -learn'); + $cur = $git->qx(qw(diff HEAD~1..HEAD)); + like($cur, qr/^-Message-ID: <2lids\@example>/sm, 'changed in git'); } done_testing();