Skip to content

test t/io_unix.t failed in ubuntu #8

@TheAthlete

Description

@TheAthlete

Hello! I'm trying to install module IO::Socket::Timeout in Ubuntu 12.04, but the installation failed on the test t/io_unix.t

Here is the test output:

$ prove -l t/io_unix.t 
t/io_unix.t .. Can't call method "read_timeout" on an undefined value at t/io_unix.t line 69.
t/io_unix.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 5/5 subtests 

Test Summary Report
-------------------
t/io_unix.t (Wstat: 256 Tests: 0 Failed: 0)
  Non-zero exit status: 1
  Parse errors: Bad plan.  You planned 5 tests but ran 0.
Files=1, Tests=0,  0 wallclock secs ( 0.04 usr  0.03 sys +  0.04 cusr  0.03 csys =  0.14 CPU)
Result: FAIL

The problem is that the test creates a path to the socket in the form

$PATH = "sock-$$";

although Ubuntu is not supported linking that name with domain UNIX socket. If you prescribe the full path in the "/tmp/sock-$$", then the error will not occur

Here is a sample code which demonstrates this:

use strict;
use warnings;
use utf8;

use Socket;

# my $path = "/tmp/sock-$$";
my $path = "sock-$$";

socket(my $socket, AF_UNIX, SOCK_STREAM, 0) or die "socket: $!";

my $addr = sockaddr_un($path);
bind($socket, $addr) or die "Can't bind: $!";

If $path = "sock-$$", an error message is generated:

$ perl test.pl
Can't bind: Operation not permitted at test.pl

If $path = "/tmp/sock-$$", then no error is thrown.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions