From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: 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.1 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 8CE941F428; Wed, 5 Sep 2018 21:34:10 +0000 (UTC) Date: Wed, 5 Sep 2018 21:34:10 +0000 From: Eric Wong To: Jonathan Corbet Cc: meta@public-inbox.org Subject: Re: [PATCH 1/2] Put the NNTP server name into Xref lines Message-ID: <20180905213410.GA20964@dcvr> References: <20180904152820.15594-1-corbet@lwn.net> <20180904152820.15594-2-corbet@lwn.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180904152820.15594-2-corbet@lwn.net> List-Id: Jonathan Corbet wrote: > RFC 5536 sec 3.2.14 says that the server-name in an Xref line is "which > news server generated the header field"; indeed, that is necessary for > newsreaders like gnus to handle references properly. So pick up the server > name from the config if available, from the host name otherwise, and use it > rather than the domain name of the list server. Thanks. Oops, I didn't realize the server-name was supposed to be there :x. But it looks like some test cases need to be adjusted for these. (see below) > diff --git a/lib/PublicInbox/NNTPD.pm b/lib/PublicInbox/NNTPD.pm > index 117c9c0..666c53b 100644 > --- a/lib/PublicInbox/NNTPD.pm > +++ b/lib/PublicInbox/NNTPD.pm > @@ -6,15 +6,21 @@ > package PublicInbox::NNTPD; > use strict; > use warnings; > +use Sys::Hostname; > require PublicInbox::Config; > > sub new { > my ($class) = @_; > + my $pi_config = PublicInbox::Config->new; > + my $name = $pi_config->{'publicinbox.nntpserver'}; > + if ($name eq '') { $name = hostname; } > + I haven't tested, but I think this needs to account for multi-value nntpserver in the config (picking the first value is fine, I suppose) For example, I use the following config on news.public-inbox.org because it's also available as a Tor hidden service: [publicinbox] nntpserver = news.public-inbox.org nntpserver = ou63pmih66umazou.onion And here are test failures from t/nntp.t and t/nntpd.t: ("grep -v ^ok") Use of uninitialized value $name in string eq at $HOME/public-inbox/lib/PublicInbox/NNTPD.pm line 16. # Failed test 'got greeting' # at t/nntpd.t line 149. # got: '201 $HOSTNAME ready - post via email # ' # expected: '201 server ready - post via email # ' # Failed test 'got greeting' # at t/nntpd.t line 159. # got: '201 $HOSTNAME ready - post via email # ' # expected: '201 server ready - post via email # ' # Failed test 'XHDR xref by message-id works' # at t/nntpd.t line 167. # Structures begin differing at: # $got->{} = '$HOSTNAME test-nntpd:1' # $expected->{} = 'example.com test-nntpd:1' # Failed test 'xref by article number works' # at t/nntpd.t line 169. # Structures begin differing at: # $got->{1} = '$HOSTNAME test-nntpd:1' # $expected->{1} = 'example.com test-nntpd:1' # Failed test 'xref by article range works' # at t/nntpd.t line 171. # Structures begin differing at: # $got->{1} = '$HOSTNAME test-nntpd:1' # $expected->{1} = 'example.com test-nntpd:1' # Failed test 'got expected response for HDR' # at t/nntpd.t line 178. # got: '0 $HOSTNAME test-nntpd:1' # expected: '0 example.com test-nntpd:1' # Failed test 'xref by message-id works without group' # at t/nntpd.t line 184. # Structures begin differing at: # $got->{} = '$HOSTNAME test-nntpd:1' # $expected->{} = 'example.com test-nntpd:1' # Looks like you failed 7 tests of 92. t/nntpd.t .. not ok 15 - got greeting not ok 19 - got greeting not ok 46 - XHDR xref by message-id works not ok 47 - xref by article number works not ok 48 - xref by article range works not ok 50 - got expected response for HDR not ok 66 - xref by message-id works without group 1..92 Dubious, test returned 7 (wstat 1792, 0x700) Failed 7/92 subtests Use of uninitialized value in concatenation (.) or string at $HOME/public-inbox/lib/PublicInbox/NNTP.pm line 413. # Failed test 'Xref: set' # at t/nntp.t line 125. # Structures begin differing at: # $got->[0] = ' test:1' # $expected->[0] = 'example.com test:1' Use of uninitialized value in concatenation (.) or string at $HOME/public-inbox/lib/PublicInbox/NNTP.pm line 413. # Failed test 'Old Xref: clobbered' # at t/nntp.t line 135. # Structures begin differing at: # $got->[0] = ' test:2' # $expected->[0] = 'example.com test:2' # Looks like you failed 2 tests of 27. t/nntp.t ... not ok 24 - Xref: set not ok 27 - Old Xref: clobbered 1..27 Dubious, test returned 2 (wstat 512, 0x200) Failed 2/27 subtests Test Summary Report ------------------- t/nntpd.t (Wstat: 1792 Tests: 92 Failed: 7) Failed tests: 15, 19, 46-48, 50, 66 Non-zero exit status: 7 t/nntp.t (Wstat: 512 Tests: 27 Failed: 2) Failed tests: 24, 27 Non-zero exit status: 2 Files=2, Tests=119, 1 wallclock secs ( 0.05 usr 0.00 sys + 0.97 cusr 0.21 csys = 1.23 CPU) Result: FAIL Thanks again.