Hi,
I craeted a patch, but I don't have "really slow machines" and cannot
test it on them. Could you please try this patch? If it works well,
I'll commit it to the upstream repository.
Thanks,
-nori
Index: subversion/bindings/swig/ruby/test/util.rb
===================================================================
--- subversion/bindings/swig/ruby/test/util.rb (revision 20790)
+++ subversion/bindings/swig/ruby/test/util.rb (working copy)
@@ -1,4 +1,5 @@
require "fileutils"
+require "socket"
require "svn/client"
require "svn/repos"
@@ -109,6 +110,7 @@
if status and status.exited?
STDERR.puts "port #{port} couldn't be used for svnserve"
else
+ wait_until_svnserve_gets_available_at(port)
@svnserve_port = port
@repos_svnserve_uri =
"svn://[EMAIL PROTECTED]:[EMAIL PROTECTED]@full_repos_path}"
@@ -222,4 +224,19 @@
auth_baton[Svn::Core::AUTH_PARAM_CONFIG_DIR] = @config_path
auth_baton[Svn::Core::AUTH_PARAM_DEFAULT_USERNAME] = @author
end
+
+ # Waits until svnserve gets available at port +port+, avoiding the race
+ # condition between starting up a svnserve process and trying to connect
+ # to it (Bug#378837 in Debian's BTS).
+ def wait_until_svnserve_gets_available_at(port)
+ begin
+ 50.times do |n|
+ TCPServer.new(port).close
+ sleep 0.2
+ end
+ raise "svnserve couldn't get available at port #{port}"
+ rescue Errno::EADDRINUSE
+ return
+ end
+ end
end