diff options
author | Tony Cook <tony@develop-help.com> | 2020-01-21 15:17:30 +1100 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2020-01-29 09:58:18 +1100 |
commit | 8e30fd6e957f275702aadd65d41ca0f3537b0714 (patch) | |
tree | 7ff1424cdfd872da58a97959fdb9231b7da715ad /dist/IO | |
parent | 6212a44b69c49a5b78d8fafd2d7618642df7b708 (diff) | |
download | perl-8e30fd6e957f275702aadd65d41ca0f3537b0714.tar.gz |
NetBSD, Darwin, Cygwin don't appear to support SO_PROTOCOL
at least on AF_UNIX sockets.
We supply zero for protocol when creating AF_UNIX sockets, and
we no longer cache that incorrect value. On systems such as NetBSD
that don't implement SO_PROTOCOL this means we can't fetch
the protocol and the protocol() method will hence return undef.
The same applies to Darwin and Cygwin.
Diffstat (limited to 'dist/IO')
-rw-r--r-- | dist/IO/t/cachepropagate-unix.t | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/dist/IO/t/cachepropagate-unix.t b/dist/IO/t/cachepropagate-unix.t index 9ec42b0455..8427e9f2fa 100644 --- a/dist/IO/t/cachepropagate-unix.t +++ b/dist/IO/t/cachepropagate-unix.t @@ -40,7 +40,19 @@ my $listener = IO::Socket::UNIX->new(Type => SOCK_STREAM, ok(defined($listener), 'stream socket created'); my $p = $listener->protocol(); -ok(defined($p), 'protocol defined'); +{ + # the value of protocol isn't well defined for AF_UNIX, when we + # create the socket we supply 0, which leaves it up to the implementation + # to select a protocol, so we (now) don't save a 0 protocol during socket + # creation. This test then breaks if the implementation doesn't support + # SO_SOCKET (at least on AF_UNIX). + # This specifically includes NetBSD, Darwin and cygwin. + # This is a TODO instead of a skip so if these ever implement SO_PROTOCOL + # we'll be notified about the passing TODO so the test can be updated. + local $TODO = "$^O doesn't support SO_PROTOCOL on AF_UNIX" + if $^O =~ /^(netbsd|darwin|cygwin)$/; + ok(defined($p), 'protocol defined'); +} my $d = $listener->sockdomain(); ok(defined($d), 'domain defined'); my $s = $listener->socktype(); @@ -90,7 +102,12 @@ SKIP: { ok(defined($listener), 'datagram socket created'); $p = $listener->protocol(); - ok(defined($p), 'protocol defined'); + { + # see comment above + local $TODO = "$^O doesn't support SO_PROTOCOL on AF_UNIX" + if $^O =~ /^(netbsd|darwin|cygwin)$/; + ok(defined($p), 'protocol defined'); + } $d = $listener->sockdomain(); ok(defined($d), 'domain defined'); $s = $listener->socktype(); |