[62943] trunk/dports/lang/ruby
kimuraw at macports.org
kimuraw at macports.org
Fri Jan 22 05:59:05 PST 2010
Revision: 62943
http://trac.macports.org/changeset/62943
Author: kimuraw at macports.org
Date: 2010-01-22 05:59:04 -0800 (Fri, 22 Jan 2010)
Log Message:
-----------
lang/ruby: 1.8.7-p174_2, add two patches.
fix failure of start drb TCPServer, such as drb, with the follwing error.
> SocketError: getaddrinfo: nodename nor servname provided, or not known
(1) patch-bug15528.diff
reproduce #15528 with Mac OS X 10.6.2 and port:ruby-1.8.7-p174_1
TCPServer.open('localhost', 0) fails on some Mac.
(2) patch-ruby-core21033.diff
backport [ruby-core:21033]
http://redmine.ruby-lang.org/issues/show/1425
The DRb code in drb.rb does not correctly deal with multiple network
families if they're present.
NOTE: ruby-1.8.7-p249 is not stable on Mac OS X 10.6.2.
make test-all occurs many segmemtation faults.
Modified Paths:
--------------
trunk/dports/lang/ruby/Portfile
Added Paths:
-----------
trunk/dports/lang/ruby/files/patch-bug15528.diff
trunk/dports/lang/ruby/files/patch-ruby-core21033.diff
Modified: trunk/dports/lang/ruby/Portfile
===================================================================
--- trunk/dports/lang/ruby/Portfile 2010-01-22 13:55:04 UTC (rev 62942)
+++ trunk/dports/lang/ruby/Portfile 2010-01-22 13:59:04 UTC (rev 62943)
@@ -4,7 +4,7 @@
name ruby
version 1.8.7-p174
-revision 1
+revision 2
categories lang ruby
maintainers kimuraw
@@ -36,11 +36,18 @@
# vendordir: enable vendor-specific.rb
# #3604: gcc4 fails to detect linking at configure
# #19050: use $(CC) not cc, this change has been merged at ruby-1.8 trunk
+# #15528: on some Mac, TCPServer.open("localhost", 0) raises SocketError
+# like "getaddrinfo: nodename nor servname provided, or not
+# known (SocketError)"
# #22361: Hash equivalence fails when a value is a Fixnum >= 2**29 or 2**61
+# ruby-core:21033: the DRb code in drb.rb does not correctly deal with
+# multiple network families if they're present.
patchfiles patch-vendordir.diff \
patch-bug3604.diff \
patch-bug19050.diff \
- patch-bug22361.diff
+ patch-bug15528.diff \
+ patch-bug22361.diff \
+ patch-ruby-core21033.diff
# ignore getcontext() and setcontext()
# on 10.5, these functions have some problems (SEGV on ppc, slower than 1.8.6)
Added: trunk/dports/lang/ruby/files/patch-bug15528.diff
===================================================================
--- trunk/dports/lang/ruby/files/patch-bug15528.diff (rev 0)
+++ trunk/dports/lang/ruby/files/patch-bug15528.diff 2010-01-22 13:59:04 UTC (rev 62943)
@@ -0,0 +1,69 @@
+diff -ur ../ruby-1.8.7-p249.org/ext/socket/socket.c ./ext/socket/socket.c
+--- ../ruby-1.8.7-p249.org/ext/socket/socket.c 2009-01-27 15:18:04.000000000 +0900
++++ ./ext/socket/socket.c 2010-01-20 23:02:35.000000000 +0900
+@@ -877,6 +877,14 @@
+ }
+ else if (FIXNUM_P(port)) {
+ snprintf(pbuf, len, "%ld", FIX2LONG(port));
++ /* It looks like getaddrinfo changed in Mac OS X 10.5.3 so that sending "0"
++ * as the argument for the port number makes it return EAI_NONAME
++ * but feeding it a port number of NULL seems to do the trick.
++ * RSD - 2008-06-05
++ */
++ if (FIX2LONG(port) == 0) {
++ return "";
++ }
+ return pbuf;
+ }
+ else {
+@@ -3592,6 +3600,14 @@
+ else if (FIXNUM_P(port)) {
+ snprintf(pbuf, sizeof(pbuf), "%ld", FIX2LONG(port));
+ pptr = pbuf;
++ /* It looks like getaddrinfo changed in Mac OS X 10.5.3 so that sending "0"
++ * as the argument for the port number makes it return EAI_NONAME
++ * but feeding it a port number of NULL seems to do the trick.
++ * RSD - 2008-06-05
++ */
++ if (FIX2LONG(port) == 0) {
++ pptr = NULL;
++ }
+ }
+ else {
+ strncpy(pbuf, StringValuePtr(port), sizeof(pbuf));
+@@ -3717,7 +3733,15 @@
+ }
+ else if (FIXNUM_P(port)) {
+ snprintf(pbuf, sizeof(pbuf), "%ld", NUM2LONG(port));
+- pptr = pbuf;
++ pptr = pbuf;
++ /* It looks like getaddrinfo changed in Mac OS X 10.5.3 so that sending "0"
++ * as the argument for the port number makes it return EAI_NONAME
++ * but feeding it a port number of NULL seems to do the trick.
++ * RSD - 2008-06-05
++ */
++ if (NUM2LONG(port) == 0) {
++ pptr = NULL;
++ }
+ }
+ else {
+ strncpy(pbuf, StringValuePtr(port), sizeof(pbuf));
+Only in ./ext/socket: socket.c.orig
+diff -ur ../ruby-1.8.7-p249.org/test/socket/test_socket.rb ./test/socket/test_socket.rb
+--- ../ruby-1.8.7-p249.org/test/socket/test_socket.rb 2007-02-13 08:01:19.000000000 +0900
++++ ./test/socket/test_socket.rb 2010-01-20 23:02:40.000000000 +0900
+@@ -57,6 +57,14 @@
+ }
+ end
+ end
++
++ def test_getaddrinfo_raises_no_errors_on_port_argument_of_0
++ # Added 2008-06-05 to ensure that Mac OS X 10.5.3's changes to getaddrinfo don't cause
++ # Ruby's Socket-based classes to fail.
++ # Here are two of the situations I found that were causing erroneous errors
++ assert_nothing_raised(){Socket.getaddrinfo(Socket.gethostname, 0, Socket::AF_INET, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)}
++ assert_nothing_raised(){TCPServer.open('localhost', 0)}
++ end
+
+ def test_listen
+ s = nil
Added: trunk/dports/lang/ruby/files/patch-ruby-core21033.diff
===================================================================
--- trunk/dports/lang/ruby/files/patch-ruby-core21033.diff (rev 0)
+++ trunk/dports/lang/ruby/files/patch-ruby-core21033.diff 2010-01-22 13:59:04 UTC (rev 62943)
@@ -0,0 +1,22 @@
+--- lib/drb/drb.rb.orig 2009-02-16 22:37:06.000000000 +0900
++++ lib/drb/drb.rb 2010-01-22 22:12:00.000000000 +0900
+@@ -842,15 +842,10 @@
+ Socket::SOCK_STREAM,
+ 0,
+ Socket::AI_PASSIVE)
+- family = infos.collect { |af, *_| af }.uniq
+- case family
+- when ['AF_INET']
+- return TCPServer.open('0.0.0.0', port)
+- when ['AF_INET6']
+- return TCPServer.open('::', port)
+- else
+- return TCPServer.open(port)
+- end
++ families = Hash[*infos.collect { |af, *_| af }.uniq.zip([]).flatten]
++ return TCPServer.open('0.0.0.0', port) if families.has_key?('AF_INET')
++ return TCPServer.open('::', port) if families.has_key?('AF_INET6')
++ return TCPServer.open(port)
+ end
+
+ # Open a server listening for connections at +uri+ using
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100122/81e65dcb/attachment-0001.html>
More information about the macports-changes
mailing list