develooper Front page | perl.perl5.porters | Postings from September 2019

[perl #134446] Only cache io_socket_proto if protocol is truthy

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
September 23, 2019 11:45
Subject:
[perl #134446] Only cache io_socket_proto if protocol is truthy
Message ID:
rt-4.0.24-28951-1569239127-1049.134446-15-0@perl.org
On Mon, 23 Sep 2019 01:58:25 GMT, jkeenan wrote:
> On Mon, 23 Sep 2019 01:03:12 GMT, afresh1@openbsd.org wrote:
> >
> > This is a bug report for perl from andrew@afresh1.com,
> > generated with the help of perlbug 1.41 running under perl 5.30.0.
> >
> >
> > -----------------------------------------------------------------
> > [Please describe your issue here]
> >
> > When OpenBSD implemented support for SO_PROTOCOL to getsockopt(2)[1],
> > suddenly IO/t/cachepropagate-unix.t started failing the 'protocol
> > match'
> > tests for `new_from_fd` sockets.
> >
> > I had trouble deciding on whether to actually just remove the entire
> > cache of protocol from "sub socket" or just to avoid caching it when
> > it
> > is falsy.  This may cause $sock->protocol to be undef on some systems
> > that don't support SO_PROTOCOL where it was 0 before, but that is
> > arguably more correct.
> >
> > In either case, this causes this test to pass because
> > $listener->protocol and $new->protocol now match.
> >
> > $ perl dist/IO/t/cachepropagate-unix.t
> > 1..15
> > ok 1 - stream socket created
> > ok 2 - protocol defined
> > ok 3 - domain defined
> > ok 4 - type defined
> > ok 5 - spawned a child
> > ok 6 - domain match
> > ok 7 - protocol match
> > ok 8 - type match
> > ok 9 - datagram socket created
> > ok 10 - protocol defined
> > ok 11 - domain defined
> > ok 12 - type defined
> > ok 13 - domain match
> > not ok 14 - protocol match
> > #   Failed test 'protocol match'
> > #   at dist/IO/t/cachepropagate-unix.t line 106.
> > #          got: '1'
> > #     expected: '0'
> > ok 15 - type match
> > # Looks like you failed 1 test of 15.
> >
> >
> > This test program on OpenBSD-current prints without the attached
> > patch:
> >
> > guess: 0
> > proto: 1
> >
> >
> > --- BEGIN testprogram.pl ---
> >
> > #!/usr/bin/perl;
> > use strict;
> > use warnings;
> >
> > use IO::Socket::UNIX;
> >
> > use File::Temp   qw< tempdir >;
> >
> > my $socketpath = tempdir( CLEANUP => 1 ) . '/testsock';
> >
> > my $old = IO::Socket::UNIX->new(Type => SOCK_DGRAM, Local =>
> > $socketpath);
> > print "guess: " . ( defined $old->protocol ? $old->protocol : 'undef'
> > ) . "\n";
> > my $protocol = unpack "i", getsockopt($old, Socket::SOL_SOCKET,
> > Socket::SO_PROTOCOL );
> > print "proto: " . ( defined $protocol ? $protocol : 'undef' ) . "\n";
> >
> > unlink($socketpath);
> >
> > --- END testprogram.pl ---
> >
> > [1]
> > https://github.com/openbsd/src/commit/15b62b7eb58273c052caf9c854e2aa813dbaa7d3
> >
> 
> Applied patch attached to a branch for smoke-testing:
> smoke-me/jkeenan/afresh/134446-socket
> 
> Thank you very much.

With the patch the branch is experiencing failures in dist/IO/t/cachepropagate-unix.t on all our NetBSD smoke-testing rigs.  It's experiencing other failures on one of them (http://perl5.test-smoke.org/report/95354 but ignore the failures in syslog.t).

Thank you very much.

-- 
James E Keenan (jkeenan@cpan.org)

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=134446

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About