[#10193] String.ord — David Flanagan <david@...>

Hi,

41 messages 2007/02/05
[#10197] Re: String.ord — Yukihiro Matsumoto <matz@...> 2007/02/06

Hi,

[#10198] Re: String.ord — David Flanagan <david@...> 2007/02/06

Yukihiro Matsumoto wrote:

[#10199] Re: String.ord — Daniel Berger <djberg96@...> 2007/02/06

David Flanagan wrote:

[#10200] Re: String.ord — David Flanagan <david@...> 2007/02/06

Daniel Berger wrote:

[#10208] Re: String.ord — "Nikolai Weibull" <now@...> 2007/02/06

On 2/6/07, David Flanagan <david@davidflanagan.com> wrote:

[#10213] Re: String.ord — David Flanagan <david@...> 2007/02/06

Nikolai Weibull wrote:

[#10215] Re: String.ord — "Nikolai Weibull" <now@...> 2007/02/06

On 2/6/07, David Flanagan <david@davidflanagan.com> wrote:

[#10216] Re: String.ord — David Flanagan <david@...> 2007/02/07

Nikolai Weibull wrote:

[#10288] Socket library should support abstract unix sockets — <noreply@...>

Bugs item #8597, was opened at 2007-02-13 16:10

12 messages 2007/02/13

[#10321] File.basename fails on Windows root paths — <noreply@...>

Bugs item #8676, was opened at 2007-02-15 10:09

11 messages 2007/02/15

[#10323] Trouble with xmlrpc — James Edward Gray II <james@...>

Some of the Ruby code used by TextMate makes use of xmlrpc/

31 messages 2007/02/15
[#10324] Re: Trouble with xmlrpc — "Berger, Daniel" <Daniel.Berger@...> 2007/02/15

> -----Original Message-----

[#10326] Re: Trouble with xmlrpc — James Edward Gray II <james@...> 2007/02/15

On Feb 15, 2007, at 1:29 PM, Berger, Daniel wrote:

[#10342] Re: Trouble with xmlrpc — James Edward Gray II <james@...> 2007/02/16

While I am complaining about xmlrpc, we have another issue. It's

[#10343] Re: Trouble with xmlrpc — Alex Young <alex@...> 2007/02/16

James Edward Gray II wrote:

[#10344] Re: Trouble with xmlrpc — James Edward Gray II <james@...> 2007/02/16

On Feb 16, 2007, at 12:08 PM, Alex Young wrote:

Re: [ ruby-Bugs-8597 ] Socket library should support abstract unix sockets

From: Bram Senders <bram@...>
Date: 2007-02-17 21:25:30 UTC
List: ruby-core #10360
On Wed, Feb 14, 2007 at 12:10:37AM +0900, noreply@rubyforge.org wrote:
> Bugs item #8597, was opened at 2007-02-13 16:10
> You can respond by visiting: 
> http://rubyforge.org/tracker/?func=detail&atid=1698&aid=8597&group_id=426
> 
> Category: Standard Library
> Group: 1.8.4
> Status: Open
> Resolution: None
> Priority: 3
> Submitted By: Kristoffer Lund駭 (stoffe)
> Assigned to: Nobody (None)
> Summary: Socket library should support abstract unix sockets
> 
> Initial Comment:
> See this post about abstract unix sockets, discussion is about implementing native D-BUS support in Ruby: http://sourceforge.net/mailarchive/message.php?msg_id=38052001

This is easy to patch for ruby 1.9 SVN, see below:

% svn diff
Index: ext/socket/socket.c
===================================================================
--- ext/socket/socket.c	(revision 11768)
+++ ext/socket/socket.c	(working copy)
@@ -1573,6 +1573,7 @@
 #ifdef HAVE_SYS_UN_H
 struct unixsock_arg {
     struct sockaddr_un *sockaddr;
+    int addrlen;
     int fd;
 };
 
@@ -1580,14 +1581,14 @@
 unixsock_connect_internal(struct unixsock_arg *arg)
 {
     return (VALUE)ruby_connect(arg->fd, (struct sockaddr*)arg->sockaddr,
-			       sizeof(*arg->sockaddr), 0);
+			       arg->addrlen, 0);
 }
 
 static VALUE
 init_unixsock(VALUE sock, VALUE path, int server)
 {
     struct sockaddr_un sockaddr;
-    int fd, status;
+    int fd, status, addrlen;
     OpenFile *fptr;
 
     SafeStringValue(path);
@@ -1603,14 +1604,17 @@
             (int)sizeof(sockaddr.sun_path)-1);
     }
     memcpy(sockaddr.sun_path, RSTRING_PTR(path), RSTRING_LEN(path));
+    addrlen = (long) ((char *) &((struct sockaddr_un *) 0)->sun_path) +
+        RSTRING_LEN(path);
 
     if (server) {
-        status = bind(fd, (struct sockaddr*)&sockaddr, sizeof(sockaddr));
+        status = bind(fd, (struct sockaddr*)&sockaddr, addrlen);
     }
     else {
 	int prot;
 	struct unixsock_arg arg;
 	arg.sockaddr = &sockaddr;
+	arg.addrlen = addrlen;
 	arg.fd = fd;
         status = rb_protect((VALUE(*)(VALUE))unixsock_connect_internal,
 			    (VALUE)&arg, &prot);


The only thing this patch does is to always give the exact length of the
real contents of the sockaddr_un struct to the bind() and connect()
calls (which is necessary for abstract sockets, since they are not
zero-terminated, so it needs to know the exact length).  This makes
abstract sockets work correctly.

Cheers,
Bram Senders

In This Thread