ruby-changes:27047
From: usa <ko1@a...>
Date: Wed, 6 Feb 2013 15:54:40 +0900 (JST)
Subject: [ruby-changes:27047] usa:r39099 (ruby_1_9_3): fixed commit miss of previous commit.
usa 2013-02-06 15:49:28 +0900 (Wed, 06 Feb 2013) New Revision: 39099 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39099 Log: fixed commit miss of previous commit. Modified files: branches/ruby_1_9_3/ChangeLog branches/ruby_1_9_3/ext/socket/unixsocket.c branches/ruby_1_9_3/version.h Index: ruby_1_9_3/ChangeLog =================================================================== --- ruby_1_9_3/ChangeLog (revision 39098) +++ ruby_1_9_3/ChangeLog (revision 39099) @@ -1,3 +1,70 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ChangeLog#L1 +Wed Feb 6 14:27:25 2013 Shugo Maeda <shugo@r...> + + * ext/socket/raddrinfo.c (rsock_unix_sockaddr_len): return + sizeof(sa_familiy_t) if path is empty. see "Autobind Feature" in + unix(7) for details. + + * ext/socket/lib/socket.rb (unix_socket_abstract_name?): treat an + empty path as an abstract name. + + * test/socket/test_unix.rb: related test. + + * ext/socket/unixsocket.c (rsock_init_unixsock): use rb_inspect() + because rb_sys_fail_str() fails if its argument contains NUL. + + * test/socket/test_unix.rb: related test. + + * ext/socket/socket.c (sock_s_pack_sockaddr_un): calculate the + correct address length of an abstract socket. + + * test/socket/test_unix.rb: related test. + + * ext/socket/raddrinfo (rsock_unix_sockaddr_len): renamed from + rsock_unixpath_len, because it returns not the length of the path, + but the length of a socket address for the path. + + * ext/socket/raddrinfo.c (rsock_unixpath_len, init_unix_addrinfo), + ext/socket/unixsocket.c (unixsock_connect_internal, + rsock_init_unixsock): calculate the correct address length of + an abstract socket. Without this fix, sizeof(struct sockaddr_un) + is specified as the length of an abstract socket for bind(2) or + connect(2), so the address of the socket is filled with extra NUL + characters. See unix(7) for details. + + * ext/socket/lib/socket.rb (unix_server_socket): don't access the + file system if the platform is Linux and path starts with NUL, + which means that the socket is an abstract socket. + + * test/socket/test_unix.rb: related test. + + * ext/socket/socket.c (sock_s_pack_sockaddr_un): support the longest + path in sockaddr_un, really. + reported by nagachika. + http://d.hatena.ne.jp/nagachika/20120426/ruby_trunk_changes_35474_35476 + + * ext/socket/raddrinfo.c (init_unix_addrinfo): support the longest + path in sockaddr_un. + (inspect_sockaddr): ditto. + (addrinfo_mdump): ditto. + (addrinfo_mload): ditto. + (rsock_unixpath_str): new function. + (rsock_unixpath): removed. + (rsock_unixaddr): use rsock_unixpath_str. + + * ext/socket/socket.c (sock_s_pack_sockaddr_un): support the longest + path in sockaddr_un. + (sock_s_unpack_sockaddr_un): ditto. + (sock_s_gethostbyaddr): unused variable removed. + + * ext/socket/unixsocket.c (rsock_init_unixsock): support the longest + path in sockaddr_un. + + * ext/socket/rubysocket.h (rsock_unixpath_str): declared. + (rsock_unixpath): removed. + + * test/socket/test_unix.rb: comment out test_nul because abstract unix + sockets may contain NULs. + Wed Feb 6 14:20:12 2013 Tanaka Akira <akr@f...> * ext/socket/basicsocket.c (bsock_getsockname): ignore truncated Index: ruby_1_9_3/ext/socket/unixsocket.c =================================================================== --- ruby_1_9_3/ext/socket/unixsocket.c (revision 39098) +++ ruby_1_9_3/ext/socket/unixsocket.c (revision 39099) @@ -124,7 +124,7 @@ unix_path(VALUE sock) https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/socket/unixsocket.c#L124 if (getsockname(fptr->fd, (struct sockaddr*)&addr, &len) < 0) rb_sys_fail(0); if (len0 < len) len = len0; - fptr->pathv = rb_obj_freeze(rb_str_new_cstr(rsock_unixpath(&addr, len))); + fptr->pathv = rb_obj_freeze(rsock_unixpath_str(&addr, len)); } return rb_str_dup(fptr->pathv); } Index: ruby_1_9_3/version.h =================================================================== --- ruby_1_9_3/version.h (revision 39098) +++ ruby_1_9_3/version.h (revision 39099) @@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/version.h#L1 #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 381 +#define RUBY_PATCHLEVEL 382 #define RUBY_RELEASE_DATE "2013-02-06" #define RUBY_RELEASE_YEAR 2013 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/