Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.4
    • Fix Version/s: JRuby 1.5
    • Component/s: Core Classes/Modules
    • Labels:
      None
    • Environment:
      Windows/MacOS/Linux
    • Number of attachments :
      1

      Description

      Ruby 1.8.x has the following behavior:

      irb(main):006:0> File.open("c:/bla/foo", "wb")
      Errno::ENOENT: No such file or directory - c:/bla/foo
              from (irb):6:in `initialize'
              from (irb):6:in `open'
              from (irb):6
      

      JRuby instead gives the following:

      irb(main):001:0> File.open("c:/bla/foo", "wb")
      IOError: Das System kann den angegebenen Pfad nicht finden
              from (irb):2:in `initialize'
              from (irb):2:in `open'
              from (irb):2
      

      The problem is that IOError is thrown in JRuby while Errno::ENOENT in Ruby MRI.

      I found this problem while using Radiant 0.8.1 which has rack-cache on board.
      Rack-Cache rescues only Errno::ENOENT and therefore fails to run Radiant.
      Here is the code for rack-cache (GEM_HOME\gems\radiant-0.8.1\vendor\rack-cache\lib\rack\cache\metastore.rb):

            def write(key, entries)
              path = key_path(key)
              File.open(path, 'wb') do |io|
                Marshal.dump(entries, io, -1) 
              end
            rescue Errno::ENOENT
              Dir.mkdir(File.dirname(path), 0755)
              retry
            end 
      

      I'll write a spec and apply a patch soon.

        Activity

        Hide
        Vladimir Sizikov added a comment -

        Yes, this is JRuby incompatibility. Will fix.

        Michael, when you say "write a spec and apply a patch soon", what do you mean? A rubyspec for this particular case, right? And the patch, you mean for JRuby or for radiant?

        I have a preliminary patch for this issue as well, but it would be really good to have the specs/tests for that.

        Show
        Vladimir Sizikov added a comment - Yes, this is JRuby incompatibility. Will fix. Michael, when you say "write a spec and apply a patch soon", what do you mean? A rubyspec for this particular case, right? And the patch, you mean for JRuby or for radiant? I have a preliminary patch for this issue as well, but it would be really good to have the specs/tests for that.
        Hide
        Michael Johann added a comment -

        I thought about fixing JRuby on this, to atleast provide one patch instead of issues
        But if you have a patch feel free to provide it. I will take care of the spec stuff.

        I meant fixing JRuby not Radiant. Radiant can be fixed by editing rack-cache as a workaround. I will inform the radiant team about a possible solution.

        Show
        Michael Johann added a comment - I thought about fixing JRuby on this, to atleast provide one patch instead of issues But if you have a patch feel free to provide it. I will take care of the spec stuff. I meant fixing JRuby not Radiant. Radiant can be fixed by editing rack-cache as a workaround. I will inform the radiant team about a possible solution.
        Hide
        Vladimir Sizikov added a comment -

        Michael: got it, thanks!

        Meanwhile, here's the patch (in my dev repo): http://github.com/vvs/jruby/tree/file-ioerror
        I'll wait for your spec/tests and then commit to the official master repository.

        P.S. And I should read bug reports more carefully, so that I wouldn't miss at first reading the last line of your report about desire to work on the patch, sorry about that.

        Show
        Vladimir Sizikov added a comment - Michael: got it, thanks! Meanwhile, here's the patch (in my dev repo): http://github.com/vvs/jruby/tree/file-ioerror I'll wait for your spec/tests and then commit to the official master repository. P.S. And I should read bug reports more carefully, so that I wouldn't miss at first reading the last line of your report about desire to work on the patch, sorry about that.
        Hide
        Michael Johann added a comment -

        Here's a patch with a new test spec

        Show
        Michael Johann added a comment - Here's a patch with a new test spec
        Hide
        Michael Johann added a comment -

        Vladimir,

        I attached a patch file with a test.
        Is this the correct way to provide patches?
        Any further readings regarding the contribution process?

        Show
        Michael Johann added a comment - Vladimir, I attached a patch file with a test. Is this the correct way to provide patches? Any further readings regarding the contribution process?
        Hide
        Vladimir Sizikov added a comment -

        The test patch is good. Thanks!

        Applied the fix and the test in rev. b87f3cd.

        Show
        Vladimir Sizikov added a comment - The test patch is good. Thanks! Applied the fix and the test in rev. b87f3cd.
        Hide
        Vladimir Sizikov added a comment -

        Michael, as for reading, take a look at http://kenai.com/projects/jruby/pages/Home, section "Getting Involved".

        Typically, the process is simple and straightforward, pick up a bug to work on, fix it, most preferably with the accompanied test, and attach a patch to the jira issue. That's all. As for formatting, just follow the existing sources (no TABs).

        Alternatively, there is RubySpec project, please consider contributing there as well, with all the ruby specification issues. That way, these tests will be used by multiple implementations (C-Ruby, JRuby, rubinius, MacRuby etc). http://rubyspec.org/

        Show
        Vladimir Sizikov added a comment - Michael, as for reading, take a look at http://kenai.com/projects/jruby/pages/Home , section "Getting Involved". Typically, the process is simple and straightforward, pick up a bug to work on, fix it, most preferably with the accompanied test, and attach a patch to the jira issue. That's all. As for formatting, just follow the existing sources (no TABs). Alternatively, there is RubySpec project, please consider contributing there as well, with all the ruby specification issues. That way, these tests will be used by multiple implementations (C-Ruby, JRuby, rubinius, MacRuby etc). http://rubyspec.org/

          People

          • Assignee:
            Vladimir Sizikov
            Reporter:
            Michael Johann
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: