user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: Jonathan Corbet <corbet@lwn.net>
Cc: meta@public-inbox.org
Subject: Re: [PATCH 1/2] Put the NNTP server name into Xref lines
Date: Wed, 5 Sep 2018 21:34:10 +0000	[thread overview]
Message-ID: <20180905213410.GA20964@dcvr> (raw)
In-Reply-To: <20180904152820.15594-2-corbet@lwn.net>

Jonathan Corbet <corbet@lwn.net> 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->{<nntp@example.com>} = '$HOSTNAME test-nntpd:1'
#     $expected->{<nntp@example.com>} = '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->{<nntp@example.com>} = '$HOSTNAME test-nntpd:1'
#     $expected->{<nntp@example.com>} = '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.

  reply	other threads:[~2018-09-05 21:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-04 15:28 [PATCH 0/2] Make NNTP Xrefs work better Jonathan Corbet
2018-09-04 15:28 ` [PATCH 1/2] Put the NNTP server name into Xref lines Jonathan Corbet
2018-09-05 21:34   ` Eric Wong [this message]
2018-09-05 22:26     ` Jonathan Corbet
2018-09-04 15:28 ` [PATCH 2/2] Add Xrefs to over/xover lines Jonathan Corbet
  -- strict thread matches above, loose matches on Subject: below --
2018-10-13 21:42 [PATCH v2 0/2] Make NNTP Xrefs work better Jonathan Corbet
2018-10-13 21:42 ` [PATCH 1/2] Put the NNTP server name into Xref lines Jonathan Corbet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180905213410.GA20964@dcvr \
    --to=e@80x24.org \
    --cc=corbet@lwn.net \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).