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-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,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 A22101F4C0; Thu, 10 Oct 2019 19:08:26 +0000 (UTC) Date: Thu, 10 Oct 2019 19:08:26 +0000 From: Eric Wong To: "Eric W. Biederman" Cc: meta@public-inbox.org Subject: ibx->{listid} autoviv fixup [was: [PATCH 0/4] Various bits to support import_imap_mailbox] Message-ID: <20191010190826.GA5440@dcvr> References: <87imp05hlm.fsf@alyssa.is> <20191008001050.rwd7bh7cek7qrydi@dcvr> <87wodfctwd.fsf@x220.int.ebiederm.org> <20191008221108.3wsso25kviiwd7ek@dcvr> <87wodec1um.fsf@x220.int.ebiederm.org> <20191008224104.GA24142@dcvr> <87h84ibb9m.fsf@x220.int.ebiederm.org> <87wode9vxw.fsf_-_@x220.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87wode9vxw.fsf_-_@x220.int.ebiederm.org> List-Id: "Eric W. Biederman" wrote: > Eric Wong, > > These should all of my generic patches to support my import_imap_mailbox > script. The really important patch that adds to the support for List-ID > to public inbox configuration file I have already sent. > > I haven't written tests and I get the following test failure when I run > make test > > > t/config.t ................. 1/? > > # Failed test 'lookup matches expected output' > > # at t/config.t line 26. > > # Structures begin differing at: > > # $got->{listid} = ARRAY(0x55c1d4e3b6a8) > > # $expected->{listid} = Does not exist > > > > # Failed test 'lookup matches expected output for test' > > # at t/config.t line 42. > > # Structures begin differing at: > > # $got->{listid} = ARRAY(0x55c1d508d8d0) > > # $expected->{listid} = Does not exist > > # Looks like you failed 2 tests of 69. > > t/config.t ................. Dubious, test returned 2 (wstat 512, 0x200) > > I haven't looked into what is happening there. Hey Eric, I'll squash this in to fix the tests: diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm index 9f3f8df7..c2fa40f9 100644 --- a/lib/PublicInbox/Config.pm +++ b/lib/PublicInbox/Config.pm @@ -449,8 +449,10 @@ sub _fill { $self->{-by_addr}->{$lc_addr} = $ibx; $self->{-no_obfuscate}->{$lc_addr} = 1; } - foreach my $list_id (@{$ibx->{listid}}) { - $self->{-by_list_id}->{$list_id} = $ibx; + if (my $listids = $ibx->{listid}) { + foreach my $list_id (@$listids) { + $self->{-by_list_id}->{$list_id} = $ibx; + } } if (my $ng = $ibx->{newsgroup}) { $self->{-by_newsgroup}->{$ng} = $ibx; Perl has this weird feature where it autovivifies arrayrefs (and hashrefs) on member access.