Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.7.0.pre1
    • Fix Version/s: JRuby 1.7.0.pre2
    • Component/s: Core Classes/Modules
    • Labels:
      None
    • Environment:
      ubuntu
    • Number of attachments :
      0

      Description

      rvm jruby-1.7.0.preview1
      irb
      File.open('foo', File::WRONLY | File::APPEND | File::CREAT).close
      puts `ls -l foo`
      #=> --xS-x 1 inglua inglua 0 Jul 16 10:06 foo
      exit

      rvm 1.9.3-p194
      irb
      File.open('foo2', File::WRONLY | File::APPEND | File::CREAT).close
      puts `ls -l foo2`
      rw-rr- 1 inglua inglua 0 Jul 16 10:07 foo2

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        Seems to be the CREAT flag doing it. Investigating.

        Show
        Charles Oliver Nutter added a comment - Seems to be the CREAT flag doing it. Investigating.
        Hide
        Charles Oliver Nutter added a comment -

        I have a fix, but it causes test failures because we've apparently been doing 'a+' mode wrong all this time. Continuing.

        Show
        Charles Oliver Nutter added a comment - I have a fix, but it causes test failures because we've apparently been doing 'a+' mode wrong all this time. Continuing.
        Hide
        Charles Oliver Nutter added a comment -
        commit 533b30428668c35e240ef272f1685347999592a3
        Author: Charles Oliver Nutter <headius@headius.com>
        Date:   Fri Jul 20 20:45:00 2012 -0500
        
            Fix JRUBY-6780
            
            File.open creates file without permissions
            
            Two fixes:
            
            * We were using a numeric arg[1] from File.open as permission.
            Permission is always passed as a third argument (or perhaps as a
            hash argument). Removed the relevant code, since we had other
            logic to properly handle permission elsewhere.
            * Append modes should not seek to the end of the file immediately;
            rather, they seek only on each write. Because the above change
            fixed how we handled a+ mode, this other bug was exposed. Fixed by
            removing a seek-to-end on file open.
        
        :100644 100644 91e2870... 4d3c77d... M	src/org/jruby/RubyFile.java
        :100644 100644 858a733... 062f510... M	src/org/jruby/util/io/ChannelDescriptor.java
        :100644 100644 5abc275... c0d2939... M	src/org/jruby/util/io/ChannelStream.java
        
        Show
        Charles Oliver Nutter added a comment - commit 533b30428668c35e240ef272f1685347999592a3 Author: Charles Oliver Nutter <headius@headius.com> Date: Fri Jul 20 20:45:00 2012 -0500 Fix JRUBY-6780 File.open creates file without permissions Two fixes: * We were using a numeric arg[1] from File.open as permission. Permission is always passed as a third argument (or perhaps as a hash argument). Removed the relevant code, since we had other logic to properly handle permission elsewhere. * Append modes should not seek to the end of the file immediately; rather, they seek only on each write. Because the above change fixed how we handled a+ mode, this other bug was exposed. Fixed by removing a seek-to-end on file open. :100644 100644 91e2870... 4d3c77d... M src/org/jruby/RubyFile.java :100644 100644 858a733... 062f510... M src/org/jruby/util/io/ChannelDescriptor.java :100644 100644 5abc275... c0d2939... M src/org/jruby/util/io/ChannelStream.java

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Michiel de Mare
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: