Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.3.1, JRuby 1.4.0RC1
    • Fix Version/s: JRuby 1.7.16
    • Component/s: Core Classes/Modules
    • Labels:
      None
    • Environment:
      linux
    • Number of attachments :
      0

      Description

      ~| ruby -v
      jruby 1.4.0RC1 (ruby 1.8.7 patchlevel 174) (2009-09-30 80c263b) (Java HotSpot(TM) Client VM 1.6.0_16) [i386-java]
      ~| irb
      jruby-1.4.0RC1 > path = '/tmp/foo'; Dir.rmdir(path) if File.directory?(path); Dir.mkdir(path); File.open(path) {}  
      Errno::EACCES: Permission denied - Permission denied - /tmp/foo
      	from (irb):3:in `initialize'
      	from (irb):3:in `open'
      	from (irb):3
      jruby-1.4.0RC1 >
      
      ~| ruby -v
      jruby 1.3.1 (ruby 1.8.6p287) (2009-06-15 2fd6c3d) (Java HotSpot(TM) Client VM 1.6.0_16) [i386-java]
      ~| irb
      irb(main):001:0> path = '/tmp/foo'; Dir.rmdir(path) if File.directory?(path); Dir.mkdir(path); File.open(path) {}
      Errno::EACCES: Permission denied - Permission denied - /tmp/foo
      	from (irb):2:in `open'
      	from (irb):2
      irb(main):002:0> 
      
      ~| ruby -v
      ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux]
      ~| irb
      irb(main):001:0> path = '/tmp/foo'; Dir.rmdir(path) if File.directory?(path); Dir.mkdir(path); File.open(path) {}
      => nil
      irb(main):002:0> 
      
      1.8.7's behaviour is the same as with:
        ruby 1.8.6 (2009-08-04 patchlevel 383) [i686-linux]
        ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux]
        ruby 1.9.2dev (2009-07-18 trunk 24186) [i686-linux]
      

        Activity

        Hide
        mynyml added a comment - - edited

        This also affects Dir.mktmpdir {}, FileUtils.remove_entry_secure, etc

        require 'tmpdir'; Dir.mktmpdir {}
        Errno::EACCES: Permission denied - Permission denied - /tmp/d20091010-4450-15icvg5/.
        	from /home/martin/.rvm/jruby-1.4.0RC1/lib/ruby/1.8/fileutils.rb:698:in `initialize'
        	from /home/martin/.rvm/jruby-1.4.0RC1/lib/ruby/1.8/fileutils.rb:698:in `open'
        	from /home/martin/.rvm/jruby-1.4.0RC1/lib/ruby/1.8/fileutils.rb:698:in `remove_entry_secure'
        	from /home/martin/.rvm/jruby-1.4.0RC1/lib/ruby/1.8/tmpdir.rb:131:in `mktmpdir'
        	from (irb):3
        
        Show
        mynyml added a comment - - edited This also affects Dir.mktmpdir {}, FileUtils.remove_entry_secure, etc require 'tmpdir'; Dir.mktmpdir {} Errno::EACCES: Permission denied - Permission denied - /tmp/d20091010-4450-15icvg5/. from /home/martin/.rvm/jruby-1.4.0RC1/lib/ruby/1.8/fileutils.rb:698:in `initialize' from /home/martin/.rvm/jruby-1.4.0RC1/lib/ruby/1.8/fileutils.rb:698:in `open' from /home/martin/.rvm/jruby-1.4.0RC1/lib/ruby/1.8/fileutils.rb:698:in `remove_entry_secure' from /home/martin/.rvm/jruby-1.4.0RC1/lib/ruby/1.8/tmpdir.rb:131:in `mktmpdir' from (irb):3
        Hide
        David Calavera added a comment -

        Seem RubyFile uses RandomAccessFile to get the channel decriptor in org.jruby.util.io.ChannelDescriptor.java:662 and I suppose it doesn't work with directories.

        Show
        David Calavera added a comment - Seem RubyFile uses RandomAccessFile to get the channel decriptor in org.jruby.util.io.ChannelDescriptor.java:662 and I suppose it doesn't work with directories.
        Hide
        mynyml added a comment -

        rubyspec patch for this issue: http://rubyspec.org/issues/show/157

        Show
        mynyml added a comment - rubyspec patch for this issue: http://rubyspec.org/issues/show/157
        Hide
        Charles Oliver Nutter added a comment -

        See also JRUBY-4033.

        Show
        Charles Oliver Nutter added a comment - See also JRUBY-4033 .
        Hide
        Nicholas Jefferson added a comment -

        Maybe re-implement FileUtils.remove_entry_secure to avoid this issue in that method (used by Dir.mktmpdir {})?

        Show
        Nicholas Jefferson added a comment - Maybe re-implement FileUtils.remove_entry_secure to avoid this issue in that method (used by Dir.mktmpdir {})?
        Hide
        Erik Hollensbe added a comment -

        Just here to mention this is still present in 1.6.0, at least in 1.9 mode.

        Show
        Erik Hollensbe added a comment - Just here to mention this is still present in 1.6.0, at least in 1.9 mode.

          People

          • Assignee:
            Unassigned
            Reporter:
            mynyml
          • Votes:
            5 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: