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: AS6315 166.70.0.0/16 X-Spam-Status: No, score=-3.6 required=3.0 tests=AWL,BAYES_00, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out03.mta.xmission.com (out03.mta.xmission.com [166.70.13.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 00DA11F4C0; Thu, 10 Oct 2019 21:24:21 +0000 (UTC) Received: from in02.mta.xmission.com ([166.70.13.52]) by out03.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1iIfv0-00037o-0c; Thu, 10 Oct 2019 15:24:18 -0600 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95] helo=x220.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.87) (envelope-from ) id 1iIfuy-0005RS-Qn; Thu, 10 Oct 2019 15:24:17 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Eric Wong Cc: meta@public-inbox.org 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> <20191010190826.GA5440@dcvr> Date: Thu, 10 Oct 2019 16:23:29 -0500 In-Reply-To: <20191010190826.GA5440@dcvr> (Eric Wong's message of "Thu, 10 Oct 2019 19:08:26 +0000") Message-ID: <87sgo02t2m.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1iIfuy-0005RS-Qn;;;mid=<87sgo02t2m.fsf@x220.int.ebiederm.org>;;;hst=in02.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18CXKk8V7ZP/zC09n/YtF4FEzVwJWobqow= X-SA-Exim-Connect-IP: 68.227.160.95 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: Re: ibx->{listid} autoviv fixup [was: [PATCH 0/4] Various bits to support import_imap_mailbox] X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) List-Id: Eric Wong writes: > "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. Thank you. It makes complete sense from that perspective. If I didn't already know things were rough around the edges with these patches I would be embarrased. Eric