IO.select on all platforms to wait for input
with recvfrom_nonblock and accept_nonblock Resolves: rhbz#1719743
This commit is contained in:
parent
86bf30d871
commit
e3b4b9752e
@ -0,0 +1,131 @@
|
||||
From 920b924e5652884064a9529ffbd80d458a46fbc6 Mon Sep 17 00:00:00 2001
|
||||
From: eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
|
||||
Date: Tue, 5 Feb 2019 09:58:50 +0000
|
||||
Subject: [PATCH] Make sure to wait with IO.select before using
|
||||
Socket#recvfrom_nonblock
|
||||
|
||||
* On all platforms, as this is the recommended code pattern.
|
||||
|
||||
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
||||
---
|
||||
spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb b/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb
|
||||
index c1239ae637e0..74fd286c42ad 100644
|
||||
--- a/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb
|
||||
+++ b/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb
|
||||
@@ -36,12 +36,11 @@
|
||||
describe 'with data available' do
|
||||
before do
|
||||
@client.write('hello')
|
||||
-
|
||||
- platform_is(:darwin, :freebsd) { IO.select([@server]) }
|
||||
end
|
||||
|
||||
platform_is_not :windows do
|
||||
it 'returns an Array containing the data and an Addrinfo' do
|
||||
+ IO.select([@server])
|
||||
ret = @server.recvfrom_nonblock(1)
|
||||
|
||||
ret.should be_an_instance_of(Array)
|
||||
@@ -54,8 +53,7 @@
|
||||
5.times do
|
||||
@client.write('hello')
|
||||
|
||||
- platform_is(:darwin, :freebsd) { IO.select([@server]) }
|
||||
-
|
||||
+ IO.select([@server])
|
||||
msg, _ = @server.recvfrom_nonblock(5)
|
||||
|
||||
msg.should == 'hello'
|
||||
@@ -66,6 +64,7 @@
|
||||
platform_is_not :windows do
|
||||
describe 'the returned Array' do
|
||||
before do
|
||||
+ IO.select([@server])
|
||||
@array = @server.recvfrom_nonblock(1)
|
||||
end
|
||||
|
||||
@@ -80,6 +79,7 @@
|
||||
|
||||
describe 'the returned Addrinfo' do
|
||||
before do
|
||||
+ IO.select([@server])
|
||||
@addr = @server.recvfrom_nonblock(1)[1]
|
||||
end
|
||||
|
||||
From c1f0daeb6ac5c5414c9a4a58bb778a118006ae1f Mon Sep 17 00:00:00 2001
|
||||
From: eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
|
||||
Date: Tue, 5 Feb 2019 10:19:29 +0000
|
||||
Subject: [PATCH] Make sure to wait with IO.select before using
|
||||
Socket#accept_nonblock and recvfrom_nonblock
|
||||
|
||||
* On all platforms, as this is the recommended code pattern.
|
||||
|
||||
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
||||
---
|
||||
spec/ruby/library/socket/socket/accept_nonblock_spec.rb | 4 ++--
|
||||
spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb | 5 +++--
|
||||
2 files changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/spec/ruby/library/socket/socket/accept_nonblock_spec.rb b/spec/ruby/library/socket/socket/accept_nonblock_spec.rb
|
||||
index 3ef219ed05a9..cde9e6a4b669 100644
|
||||
--- a/spec/ruby/library/socket/socket/accept_nonblock_spec.rb
|
||||
+++ b/spec/ruby/library/socket/socket/accept_nonblock_spec.rb
|
||||
@@ -86,8 +86,6 @@
|
||||
@client = Socket.new(family, :STREAM, 0)
|
||||
|
||||
@client.connect(addr)
|
||||
-
|
||||
- platform_is(:darwin, :freebsd, :solaris) { IO.select([@server]) }
|
||||
end
|
||||
|
||||
after do
|
||||
@@ -96,6 +94,7 @@
|
||||
end
|
||||
|
||||
it 'returns an Array containing a Socket and an Addrinfo' do
|
||||
+ IO.select([@server])
|
||||
@socket, addrinfo = @server.accept_nonblock
|
||||
|
||||
@socket.should be_an_instance_of(Socket)
|
||||
@@ -104,6 +103,7 @@
|
||||
|
||||
describe 'the returned Addrinfo' do
|
||||
before do
|
||||
+ IO.select([@server])
|
||||
@socket, @addr = @server.accept_nonblock
|
||||
end
|
||||
|
||||
diff --git a/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb b/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb
|
||||
index 015109a05200..62bbaf0dc93a 100644
|
||||
--- a/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb
|
||||
+++ b/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb
|
||||
@@ -40,16 +40,16 @@
|
||||
describe 'with data available' do
|
||||
before do
|
||||
@client.write('hello')
|
||||
-
|
||||
- platform_is(:darwin, :freebsd) { IO.select([@server]) }
|
||||
end
|
||||
|
||||
it 'returns an Array containing the data and an Array' do
|
||||
+ IO.select([@server])
|
||||
@server.recvfrom_nonblock(1).should be_an_instance_of(Array)
|
||||
end
|
||||
|
||||
describe 'the returned Array' do
|
||||
before do
|
||||
+ IO.select([@server])
|
||||
@array = @server.recvfrom_nonblock(1)
|
||||
end
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
|
||||
describe 'the returned address Array' do
|
||||
before do
|
||||
+ IO.select([@server])
|
||||
@addr = @server.recvfrom_nonblock(1)[1]
|
||||
end
|
||||
|
15
ruby.spec
15
ruby.spec
@ -154,6 +154,13 @@ Patch22: ruby-2.6.0-config-support-include-directive.patch
|
||||
# https://github.com/ruby/openssl/pull/217
|
||||
Patch23: ruby-2.6.0-use-larger-keys-for-SSL-tests.patch
|
||||
|
||||
# IO.select on all platforms to wait for input with recvfrom_nonblock
|
||||
# and accept_nonblock
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1719743
|
||||
# https://github.com/ruby/ruby/commit/920b924e5652884064a9529ffbd80d458a46fbc6
|
||||
# https://github.com/ruby/ruby/commit/c1f0daeb6ac5c5414c9a4a58bb778a118006ae1f
|
||||
Patch24: ruby-2.7.0-preview1-IO.select-on-all-platforms-to-wait-for-input-with-recvfr.patch
|
||||
|
||||
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
||||
Suggests: rubypick
|
||||
Recommends: ruby(rubygems) >= %{rubygems_version}
|
||||
@ -546,6 +553,7 @@ rm -rf ext/fiddle/libffi*
|
||||
%patch12 -p1
|
||||
%patch22 -p1
|
||||
%patch23 -p1
|
||||
%patch24 -p1
|
||||
|
||||
# Provide an example of usage of the tapset:
|
||||
cp -a %{SOURCE3} .
|
||||
@ -848,13 +856,6 @@ DISABLE_TESTS="$DISABLE_TESTS -n !/test_segv_\(setproctitle\|test\|loaded_featur
|
||||
# https://bugs.ruby-lang.org/issues/14175
|
||||
sed -i '/def test_mdns_each_address$/,/^ end$/ s/^/#/' test/resolv/test_mdns.rb
|
||||
|
||||
# Skip random failed UDPSocket#recvfrom_nonblock tests
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1719743
|
||||
sed -i "/^ describe 'with data available' do$/,/^ end$/ s/^/#/" \
|
||||
spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb
|
||||
sed -i "/^ describe 'with data available' do$/,/^ end$/ s/^/#/" \
|
||||
spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb
|
||||
|
||||
# RHEL8 is using stronger crypto policies then Fedora ATM and upstream does
|
||||
# not support them yet. Disable the RHEL8 configuration for the moment.
|
||||
# https://github.com/ruby/openssl/issues/215
|
||||
|
Loading…
Reference in New Issue
Block a user