No file descriptor on directories
---------------------------------

                 Key: JRUBY-3613
                 URL: http://jira.codehaus.org/browse/JRUBY-3613
             Project: JRuby
          Issue Type: Bug
          Components: Miscellaneous
         Environment: $ uname -v
Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008; 
root:xnu-1228.9.59~1/RELEASE_I386
$ jruby -v
jruby 1.2.0 (ruby 1.8.6 patchlevel 287) (2009-03-16 rev 9419) [i386-java]

            Reporter: Bram Wijnands


When calling sysopen on a directory i get the following error:
-----
$ jruby irb
irb(main):001:0> IO::sysopen "/dev"
Errno::ENOENT: No such file or directory - /dev
        from (irb):2:in `sysopen'
        from (irb):2
-----

Is this intended not to work ? When i tried this i assumed everything on the os 
was a file and directory where essentially files tagged as directories, Running 
this example in CRuby gives me back a file descriptor. 

When trying to achieve this with Java integration i run into a strange error.
------
jruby_file  = org.jruby.util.JRubyFile.create("/dev/","/dev")
p jruby_file.exists()
flags = ModeFlags.new(ModeFlags::RDONLY)
c = ChannelDescriptor.open("/dev/", "/dev", flags, 0, nil)
p c
------
Will print true and crash right after on creating the new ChannelDescriptor.  
Which i find rather strange as it crashes on:
----ChannelDescriptor.java----

JRubyFile theFile = JRubyFile.create("/dev/", "/dev");
.....
            RandomAccessFile file = new RandomAccessFile(theFile, 
flags.toJavaModeString());   // <---- boom
-------

Isn't this error basiclly something that's been catched earlyer in the method 
but gets recreated because the flags are always set to r&w on the 
RandomAccessFile ?
( if (theFile.isDirectory() && flags.isWritable()) )



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to