Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.6RC2
-
Fix Version/s: JRuby 1.7.0.pre1
-
Component/s: JRuby-extras
-
Labels:None
-
Environment:Linux
-
Number of attachments :
Description
I tried to use the ruby-dbus gem to create desktop notifications from jruby. While it works in native ruby, jruby complains about the socket address.
It would be great, if jruby could detect the unix socket type and use the RubyUNIXSocket appropriately instead raising an exception.
Code triggering the behaviour (from bus.rb in the dbus gem)
@socket = Socket.new(Socket::Constants::PF_UNIX,Socket::Constants::SOCK_STREAM, 0) @socket.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) if ! params['abstract'].nil? if HOST_END == LIL_END sockaddr = "\1\0\0#{params['abstract']}" else sockaddr = "\0\1\0#{params['abstract']}" end elsif ! params['path'].nil? sockaddr = Socket.pack_sockaddr_un(params['path']) end @socket.connect(sockaddr)
The socket path is /tmp/dbus-kvq7FW2 and the error message raised is
org/jruby/ext/socket/RubySocket.java:557:in `unpack_sockaddr_in': can't resolve socket address of wrong type (ArgumentError)
from org/jruby/ext/socket/RubySocket.java:377:in `connect'
from /home/tkruse/NetBeansProjects/Notify/rblib/dbus/bus.rb:269:in `connect_to_unix'
Activity
Charles Oliver Nutter
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Resolution | Fixed [ 1 ] | |
| Fix Version/s | JRuby 1.7 [ 17049 ] | |
| Assignee | Charles Oliver Nutter [ headius ] | |
| Status | Open [ 1 ] | Resolved [ 5 ] |
The problem we have in Socket is that it's the "everytool" for socket stuff in MRI, but in Java we have to choose the socket type at construction time. So there's no way we can have a single Socket class cover all types of sockets.
I'm not sure we have any way to fix this at present. Why doesn't bus.rb just use UNIXSocket directly?