Skip Menu |

This queue is for tickets about the Audio-MPD CPAN distribution.

Report information
The Basics
Id: 73035
Status: open
Priority: 0/
Queue: Audio-MPD

People
Owner: Nobody in particular
Requestors: KENTNL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 1.113280
  • 2.000
Fixed in: (no value)



Subject: t/20-connection.t fails with "uninitialized value $line" and "not a mpd server"
t/20-connection.t ..
1..20
ok 1 - The object isa Audio::MPD
ok 2 - error during socket creation
ok 3 # skip need some sendmail server running
Use of uninitialized value $line in scalar chomp at /home/kent/.cpanm/work/1323153091.802713/Audio-MPD-1.113280/blib/lib/Audio/MPD.pm line 107.
Use of uninitialized value $line in pattern match (m//) at /home/kent/.cpanm/work/1323153091.802713/Audio-MPD-1.113280/blib/lib/Audio/MPD.pm line 108.
Use of uninitialized value $line in concatenation (.) or string at /home/kent/.cpanm/work/1323153091.802713/Audio-MPD-1.113280/blib/lib/Audio/MPD.pm line 108.
Not a mpd server - welcome string was: []
Show quoted text
# Looks like you planned 20 tests but ran 3.
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 17/20 subtests
        (less 1 skipped subtest: 2 okay)

Test Summary Report
-------------------
t/20-connection.t (Wstat: 65280 Tests: 3 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 20 tests but ran 3.
Files=1, Tests=3,  4 wallclock secs ( 0.07 usr  0.00 sys +  1.30 cusr  0.11 csys =  1.48 CPU)
Result: FAIL


Context:

 

t/000-report-versions-tiny.t .. #
Show quoted text

#
# perl: v5.14.2 (wanted 5.010) on linux from /usr/bin/perl5.14.2
#
# Audio::MPD::Common::Item                      => 1.110550   (want any version)
# Audio::MPD::Common::Output                    => 1.110550   (want any version)
# Audio::MPD::Common::Stats                     => 1.110550   (want any version)
# Audio::MPD::Common::Status                    => 1.110550   (want any version)
# DB_File                                       => 1.824      (want any version)
# Encode                                        => 2.44       (want any version)
# File::Find                                    => 1.19       (want any version)
# File::Temp                                    => 0.22       (want any version)
# Getopt::Euclid                                => 0.3.0      (want any version)
# IO::Socket::IP                                => 0.07       (want any version)
# Module::Build                                 => 0.38       (want 0.3601)
# Moose                                         => 2.0401     (want any version)
# Moose::Util::TypeConstraints                  => 2.0401     (want any version)
# MooseX::Has::Sugar                            => 0.05070419 (want any version)
# MooseX::SemiAffordanceAccessor                => 0.09       (want any version)
# Proc::Daemon                                  => 0.14       (want any version)
# Test::Corpus::Audio::MPD                      => 1.113282   (want 1.113282)
# Test::More                                    => 0.98       (want 0.88)
# Time::HiRes                                   => 1.9724     (want any version)
# strict                                        => 1.04       (want any version)
# warnings                                      => 1.12       (want any version)

 

Just hit this again, have yet to upgrade the ::Common package so don't know if that affects this bug yet =)

 

t/000-report-versions-tiny.t .. 1/? #                                                                                       [54/29779]# perl: v5.14.2 (wanted 5.010) on linux from /usr/bin/perl5.14.2

Show quoted text
#
# Audio::MPD::Common::Item                      => 1.110550   (want any version)
# Audio::MPD::Common::Output                    => 1.110550   (want any version)
# Audio::MPD::Common::Stats                     => 1.110550   (want any version)
# Audio::MPD::Common::Status                    => 1.110550   (want any version)
# DB_File                                       => 1.826      (want any version)
# Encode                                        => 2.44       (want any version)
# File::Find                                    => 1.19       (want any version)
# File::Temp                                    => 0.22       (want any version)
# Getopt::Euclid                                => 0.3.5      (want any version)
# IO::Socket::IP                                => 0.08       (want any version)
# Module::Build                                 => 0.38       (want 0.3601)
# Moose                                         => 2.0402     (want any version)
# Moose::Util::TypeConstraints                  => 2.0402     (want any version)
# MooseX::Has::Sugar                            => 0.05070420 (want any version)
# MooseX::SemiAffordanceAccessor                => 0.09       (want any version)
# Proc::Daemon                                  => 0.14       (want any version)
# Test::Corpus::Audio::MPD                      => 1.113282   (want 1.113282)
# Test::More                                    => 0.98       (want 0.88)  
# Time::HiRes                                   => 1.9725     (want any version)
# strict                                        => 1.04       (want any version)
# warnings                                      => 1.12       (want any version)
#
# Thanks for using my code.  I hope it works for you.
# If not, please try and include this output in the bug report.
# That will help me reproduce the issue and solve you problem.
#
t/000-report-versions-tiny.t .. ok  
t/20-connection.t ............. 1/20 Use of uninitialized value $line in scalar chomp at /tmp/portage/dev-perl-Audio-MPD-1.120.610/wor
k/Audio-MPD-1.120610/blib/lib/Audio/MPD.pm line 107.
Use of uninitialized value $line in pattern match (m//) at /tmp/portage/dev-perl-Audio-MPD-1.120.610/work/Audio-MPD-1.120610/blib/lib/
Audio/MPD.pm line 108.
Use of uninitialized value $line in concatenation (.) or string at /tmp/portage/dev-perl-Audio-MPD-1.120.610/work/Audio-MPD-1.120610/b
lib/lib/Audio/MPD.pm line 108.
Not a mpd server - welcome string was: []
t/20-connection.t ............. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 17/20 subtests
        (less 1 skipped subtest: 2 okay)
Show quoted text
# Looks like you planned 20 tests but ran 3.
t/21-new.t .................... ok    
t/22-general.t ................ ok  
t/23-output.t ................. ok  
t/24-info.t ................... ok    
t/25-settings.t ............... ok    
t/26-playback.t ............... ok    
t/30-collection.t ............. ok    
t/40-playlist.t ............... ok    
t/release-has-version.t ....... skipped: these tests are for release candidate testing
t/release-kwalitee.t .......... skipped: these tests are for release candidate testing
t/release-minimum-version.t ... skipped: these tests are for release candidate testing

Nope, no improvement.

 

Looking at the code says the socket->getline is returning undef.

so its either EOF or an error is occurring, and there's no handling code there for that case.

 

So, chucked this code blob in:

    # parse version information.
    my $line = $socket->getline;
    if ( not defined $line ){
      my $problem = " at " . $self->host . ":" . $self->port;
      die "EOF $problem" if $socket->eof;
      die "ERROR $problem" if $socket->error;
    }
    chomp $line;

 

And re-run the socket test verbosely, and this is what I get:

 

t/20-connection.t ..
1..20
ok 1 - The object isa Audio::MPD
ok 2 - error during socket creation
ok 3 # skip need some sendmail server running
EOF  at ::1:6600 at /tmp/portage/dev-perl-Audio-MPD-1.120.610/work/Audio-MPD-1.120610/lib/Audio/MPD.pm line 109.
Show quoted text

# Looks like you planned 20 tests but ran 3.
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 17/20 subtests
        (less 1 skipped subtest: 2 okay)

Test Summary Report
-------------------
t/20-connection.t (Wstat: 65280 Tests: 3 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 20 tests but ran 3.
Files=1, Tests=3,  3 wallclock secs ( 0.04 usr  0.01 sys +  0.65 cusr  0.08 csys =  0.78 CPU)
Result: FAIL

 

Hope that helps =)
 

is ipv6 enabled on your host? (the test failing is the test to a ipv6 localhost)
On 2012-03-02 05:34:12, JQUELIN wrote:
Show quoted text
> is ipv6 enabled on your host?
> (the test failing is the test to a ipv6 localhost)


 ping6 ::1
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.033 ms
64 bytes from ::1: icmp_seq=2 ttl=64 time=0.076 ms
64 bytes from ::1: icmp_seq=3 ttl=64 time=0.053 ms
64 bytes from ::1: icmp_seq=4 ttl=64 time=0.088 ms
64 bytes from ::1: icmp_seq=5 ttl=64 time=0.076 ms
64 bytes from ::1: icmp_seq=6 ttl=64 time=0.086 ms
64 bytes from ::1: icmp_seq=7 ttl=64 time=0.095 ms
^C
--- ::1 ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 5999ms
rtt min/avg/max/mdev = 0.033/0.072/0.095/0.021 ms

 

I can do a netcat to myself via ::1 over IPv6

I can ping6 arround the network ( but I have to pass -I because its not set up properly somewhere )

can't netcat accross the network though because it doesn't like me for some reason,

ping6  -I wlan0 fe80::221:70ff:fe92:5ec
PING fe80::221:70ff:fe92:5ec(fe80::221:70ff:fe92:5ec) from fe80::221:70ff:fe92:5ef wlan0: 56 data bytes
64 bytes from fe80::221:70ff:fe92:5ec: icmp_seq=1 ttl=64 time=29.2 ms
64 bytes from fe80::221:70ff:fe92:5ec: icmp_seq=2 ttl=64 time=40.5 ms
64 bytes from fe80::221:70ff:fe92:5ec: icmp_seq=3 ttl=64 time=29.1 ms
^C
--- fe80::221:70ff:fe92:5ec ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 29.165/32.964/40.503/5.332 ms
 

 nc -n -v -6 fe80::221:70ff:fe92:5ec 6600
(UNKNOWN) [fe80::221:70ff:fe92:5ec] 6600 (?) : Network is unreachable
 

But that shouldn't matter right?

 

 It would appear so, and mpd is also built with ipv6 support if that matters.
 

I finally found out what is going on here.

libwrap tcp wrappers are rejecting the IPv6 connection.

https://bbs.archlinux.org/viewtopic.php?id=113493

You can test for this case quite easily:

After spinning up the connection, nc  to it via both ipv4 and ipv6 on the required port.

In the "bad" case, the IPv6 connection immediately returns with no output. ( Which is what happens with the $socket->getline ! )

 

Thus, I think every test should be guarded against this with a pre-check that the server is accessible on the given host:port and then skipping the test if it is not ( instead of failing ).

Also, the default configuration of the client is such that your tests that test for IPv4 based behaviour are in fact connecting using IPv6  by default.

 

This is because while the Test::Corpus binds to IPs explicitly, the _TEST_ uses 'localhost', not an IP.

 

And localhost will of course easily resolve to an IPv6 address with IO::Socket::IP =)

 

Additionally, I would request your test configuration *not* do any tests involving the default MPD port, because tests not being runnable due to MPD running is very annoying.

 

On Sat Jun 20 14:23:07 2015, KENTNL wrote: Show quoted text
> Thus, I think every test should be guarded against this with a pre- > check that > the server is accessible on the given host:port and then skipping the > test if it is not ( instead of failing ).
A bit tedious to do that before each test... Better to have this once per file test, don't you think? Or forcing 127.0.0.1 instead of localhost? But then it might fail again if somehow it isn't accessible. So better test connection. Hmmm, needs to think about that. wdyt?

If there's no specific fix we can do better, you could probably conditionalise tests that *could* be prone to this bug with an ENV control var.

At least, that way you're disabling tests that are "known faulty".

Tests that fail for false reasons are worse than no tests at all, because they discourage running tests.

But you could probably easily throw some util in t/lib that implements some kind of "can I actually connect to this socket? y/n" test to skip tests on.  You don't need to  try to validate what is "on the other end", all you need to test for is "Can I actually connect to the socket enough to know there's something on the other end".

But as to "tedious" ... well. yeah. Tests are themselves tedious, a level of tedium in making good tests aught to be expected. ;)