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

Re: [perl #122657] t/io/socket.t failing on hurd: peer from recv()should be empty or the remote name

Thread Previous | Thread Next
From:
Svante Signell
Date:
September 24, 2014 18:02
Subject:
Re: [perl #122657] t/io/socket.t failing on hurd: peer from recv()should be empty or the remote name
Message ID:
1411548482.28919.52.camel@G3620.my.own.domain
On Tue, 2014-09-23 at 16:39 -0700, Tony Cook via RT wrote:
> On Tue Sep 23 06:22:14 2014, svante.signell@gmail.com wrote:
> > On Mon, 2014-09-22 at 17:32 -0700, Tony Cook via RT wrote:
> > > On Sat Aug 30 17:17:18 2014, dom wrote:
> > > > As reported in <https://bugs.debian.org/cgi-
> > > > bin/bugreport.cgi?bug=758718> this test (introduced as part of [perl
> > > > #118843]) fails on Hurd. The comment from the Hurd porting team is:
> > > > 
> > > > "The test seems fishy to me: it is making sure that the name as
> > > > returned
> > > > by recv is *exactly* the same as what the server socket is bound to,
> > > > which is 0.0.0.0:some_port but I would expect recv to return the
> > > > actual
> > > > IP address used in the socket, not 0.0.0.0.  It happens that Linux
> > > > doesn't return anything at all so it goes fine there, but that's not a
> > > > reason."
> > > 
> > > If it compared against getpeername(), would that pass?
> > > 
> > > As you say, comparing against the bind address is just plain wrong.
> > > 
> > > I don't have ready access to Hurd.

> From the perl documentation for recv():
> 
>                                   Returns the address of the sender if
>                SOCKET's protocol supports this; returns an empty string
>                otherwise.  If there's an error, returns the undefined value.
>                This call is actually implemented in terms of recvfrom(2)
>                system call.

Did not find that when searching the web, and thought the return value
was as the system call. Found it now:
http://perldoc.perl.org/functions/recv.html

Attached is a patch modified Debian patch which works in both GNU/Linux
and GNU/Hurd. Of course you can find a better solution, and the print
statements should be removed. Comparing $recv_peer eq my $peer_name does
not work.

BTW: What's the difference between $var and my $var?

Thanks!




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