New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
t/io/socket.t failing on hurd: peer from recv() should be empty or the remote name #14052
Comments
From @jmdhAs 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 |
From @tonycozOn Sat Aug 30 17:17:18 2014, dom wrote:
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. Tony |
The RT System itself - Status changed from 'new' to 'open' |
From svante.signell@gmail.comOn Mon, 2014-09-22 at 17:32 -0700, Tony Cook via RT wrote:
I think there is something wrong with this test, even comparing with ok_child(connect($child, $bind_name), "connect() works") my $buf; The return value of recv() should be the number of bytes returned?? I've From the man page of recv(): RETURN VALUE These calls return the number of bytes received, or -1 if an error When a stream socket peer has performed an orderly shutdown, the return Datagram sockets in various domains (e.g., the UNIX and Internet The value 0 may also be returned if the requested number of bytes to |
From @tonycozOn Tue Sep 23 06:22:14 2014, svante.signell@gmail.com wrote:
From the perl documentation for recv(): Returns the address of the sender if Tony |
From svante.signell@gmail.comOn Tue, 2014-09-23 at 16:39 -0700, Tony Cook via RT wrote:
Did not find that when searching the web, and thought the return value Attached is a patch modified Debian patch which works in both GNU/Linux BTW: What's the difference between $var and my $var? Thanks! |
From svante.signell@gmail.comFrom 9256a6f74e501b42d4a820728327763a651cfa4f Mon Sep 17 00:00:00 2001 According to Samuel Thibault this test is questionable and should be "The test seems fishy to me: it is making sure that the name as returned Bug-Debian: http://bugs.debian.org/758718 t/io/socket.t | 8 ++++++-- Index: perl-5.20.1/t/io/socket.t--- perl-5.20.1.orig/t/io/socket.t |
From @LeontOn Wed, Sep 24, 2014 at 10:48 AM, Svante Signell <svante.signell@gmail.com>
Your patch is nonsensical.
And that question explains why. The my keyword created a new lexical Leon |
From @LeontOn Tue, Sep 23, 2014 at 2:32 AM, Tony Cook via RT <perlbug-followup@perl.org
Yes, that would be a more sensible test. Patch to that effect attached. Leon |
From @Leont0001-Compare-recv-return-value-to-peername-in-socket-test.patchFrom 34faf418933fa03c23374d777313a39238fea375 Mon Sep 17 00:00:00 2001
From: Leon Timmermans <fawaka@gmail.com>
Date: Wed, 24 Sep 2014 23:17:21 +0200
Subject: [PATCH] Compare recv return value to peername in socket test
---
t/io/socket.t | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/io/socket.t b/t/io/socket.t
index b723e3c..345d196 100644
--- a/t/io/socket.t
+++ b/t/io/socket.t
@@ -102,7 +102,7 @@ SKIP: {
my $buf;
my $recv_peer = recv($child, $buf, 1000, 0);
# [perl #118843]
- ok_child($recv_peer eq '' || $recv_peer eq $bind_name,
+ ok_child($recv_peer eq '' || $recv_peer eq getpeername $child,
"peer from recv() should be empty or the remote name");
while(defined recv($child, my $tmp, 1000, 0)) {
last if length $tmp == 0;
--
2.1.1-391-g7a54a76
|
From svante.signell@gmail.comOn Thu, 2014-09-25 at 10:51 +0200, Svante Signell wrote:
The attached patch make the test work on GNU/Hurd maybe |
From svante.signell@gmail.comsocket.t.patch--- ./t_io_socket.t.orig 2014-09-25 11:10:40.000000000 +0200
+++ perl-5.20.1/t/io/socket.t 2014-09-25 11:08:29.000000000 +0200
@@ -102,8 +102,13 @@
my $buf;
my $recv_peer = recv($child, $buf, 1000, 0);
# [perl #118843]
- ok_child($recv_peer eq '' || $recv_peer eq $bind_name,
- "peer from recv() should be empty or the remote name");
+ my ($recv_port, $recv_addr) = sockaddr_in($recv_peer);
+ my $peer_name = getpeername($child);
+ my ($peer_port, $peer_addr) = sockaddr_in($peer_name);
+ printf("# peer_port %d\n", $peer_port);
+ printf("# peer_addr %s\n", inet_ntoa($peer_addr));
+ ok_child($recv_peer eq '' || $recv_addr eq $peer_addr,
+ "peer from recv() should be empty or the peer address");
while(defined recv($child, my $tmp, 1000, 0)) {
last if length $tmp == 0;
$buf .= $tmp;
|
From svante.signell@gmail.comOn Wed, 2014-09-24 at 14:32 -0700, Leon Timmermans via RT wrote:
FYI: With your patch the test still fails on GNU/Hurd :( Please: How to add (correct) print statements to see what is returned, |
From svante.signell@gmail.comOn Wed, 2014-09-24 at 13:47 -0700, Leon Timmermans via RT wrote:
See below!
I would really appreciate comments to people not even knowing the famous I think you have just created a non-fan of "perl", not a student willing Thanks! |
From svante.signell@gmail.comOn Thu, 2014-09-25 at 11:28 +0200, Svante Signell wrote:
Attached is a patch that works on Linux, kFreeBSD and Hurd: OK? |
From svante.signell@gmail.comsocket.t.patch--- t_io_socket.t.orig 2014-09-25 11:10:40.000000000 +0200
+++ t_io_socket.t 2014-09-25 13:41:23.000000000 +0200
@@ -102,8 +102,18 @@
my $buf;
my $recv_peer = recv($child, $buf, 1000, 0);
# [perl #118843]
- ok_child($recv_peer eq '' || $recv_peer eq $bind_name,
- "peer from recv() should be empty or the remote name");
+ if ($recv_peer ne '')
+ {
+ my $peer_name = getpeername($child);
+ my ($peer_port, $peer_addr) = sockaddr_in($peer_name);
+ my ($recv_port, $recv_addr) = sockaddr_in($recv_peer);
+ ok_child($recv_addr eq $peer_addr,
+ "peer from recv() should be empty or the peer address");
+ } else {
+ ok_child($recv_peer eq '',
+ "peer from recv() should be empty or the peer address");
+ }
+
while(defined recv($child, my $tmp, 1000, 0)) {
last if length $tmp == 0;
$buf .= $tmp;
|
From @LeontOn Thu, Sep 25, 2014 at 12:17 AM, Svante Signell <svante.signell@gmail.com>
My apologies, I had no intention of offending you. My choice of words may Leon |
From @LeontOn Thu, Sep 25, 2014 at 10:51 AM, Svante Signell <svante.signell@gmail.com>
That is unexpected.
printf "%s\n", unpack "H*", $recv_peer; That should give a hex-dump, which should give some information on why they Leon |
From svante.signell@gmail.comOn Thu, 2014-09-25 at 09:04 -0700, Leon Timmermans via RT wrote:
100289c37f0000011f0000001f000000 |
From @LeontOn Fri, Sep 26, 2014 at 7:38 PM, Svante Signell <svante.signell@gmail.com>
Actually, I'd be curious about the $bind_addr too, but in the big picture The 7f000001 is localhost, 89c3 must be the port number (35267). 1002 must That looks to me like a bug in the Hurd, regardless of how perl should Leon |
From svante.signell@gmail.comOn Fri, 2014-09-26 at 11:13 -0700, Leon Timmermans via RT wrote:
$bind_name: 100289c57f000001ffffffff01000000
I'll forward this to the Hurd developers. Are you planning to change |
From svante.signell@gmail.comOn Fri, 2014-09-26 at 21:14 +0200, Svante Signell wrote:
Hi, below are some comments from Samuel Thibault on IRC: As seen above you are comparing padding bytes, and that content is not |
From @LeontOn Sat, Sep 27, 2014 at 11:24 AM, Svante Signell <svante.signell@gmail.com>
$recv_peer is containing exactly 16 bytes (or 32 hex characters). 1 for the
The standard is rather silent on this matter, hence I don't believe that is The sensible thing to me is to either return the correct amount of relevant And quite frankly, I'd worry more about what data Hurd is leaking… Also, if one ever wants to add fields to the sockaddr_in (not that that's
That's exactly what we're doing right now. Leon |
From svante.signell@gmail.comOn Sat, 2014-09-27 at 07:02 -0700, Leon Timmermans via RT wrote:
You were right, there was a bug in the Linux code borrowed for the Thank you for your time,
|
From samuel.thibault@ens-lyon.orgHello, Samuel Thibault wrote:
Oops, sorry. I was in a hurry when answering that, and miscounted the printed Father Chrysostomos wrote:
Indeed. It seems it's a bug which was present in the Linux code that we have Samuel |
From @tonycozOn Fri Sep 26 12:14:24 2014, svante.signell@gmail.com wrote:
I plan to apply Leon's fix. Do you have any idea when a new hurd kernel might be released with the fixes? If it won't be fixed soon I'll make that test a TODO test so it won't fail the build. Tony |
From @LeontOn Thu, Oct 2, 2014 at 1:56 AM, Tony Cook via RT <perlbug-followup@perl.org>
I was planning to do just that, but hadn't come around to it. Waiting for a Leon |
From @tonycozOn Thu Oct 02 02:03:03 2014, LeonT wrote:
I've pushed your fix, and made the the test TODO on hurd. I used TODO instead of skip so that once it's fixed there's some visible change in behaviour so we can remove the TODO or make it release specific. Closing this ticket. Tony |
@tonycoz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#122657 (status was 'resolved')
Searchable as RT122657$
The text was updated successfully, but these errors were encountered: