Details

    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      jruby --1.9 -ve "p File.new('README').size"
      jruby 1.6.0.dev (ruby 1.9.2dev trunk -1) (2010-05-24 6be8758) (Java HotSpot(TM) Client VM 1.6.0_20) [x86-java]
      -e:1:in `size': No such file or directory - -1 (Errno::ENOENT)
              from -e:1
      

      This also leads to a bunch of RubySpec failures in 1.9 mode. Will fix.

      mspec ci -tj -T --1.9 core\file\size_spec.rb
      jruby 1.6.0.dev (ruby 1.9.2dev trunk -1) (2010-05-24 6be8758) (Java HotSpot(TM) Client VM 1.6.0_20) [x86-java]
      .........EEEEE
      
      1)
      File#size returns the file's size as a Fixnum ERROR
      Errno::ENOENT: No such file or directory - -1
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:56:in `size'
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:56
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:37
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:36
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:56:in `load'
      D:/work/jruby-dev/mspec.git/bin/mspec-ci:8
      
      2)
      File#size returns the file's size in bytes ERROR
      Errno::ENOENT: No such file or directory - -1
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:60:in `size'
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:60
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:37
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:36
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:56:in `load'
      D:/work/jruby-dev/mspec.git/bin/mspec-ci:8
      
      3)
      File#size returns the cached size of the file if subsequently deleted ERROR
      Errno::EACCES: Permission denied - D:/work/jruby-dev/rubyspec.git/rubyspec_temp/12-i_exist
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:64
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:37
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:36
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:56:in `load'
      D:/work/jruby-dev/mspec.git/bin/mspec-ci:8
      
      4)
      File#size returns the file's current size even if modified ERROR
      Errno::ENOENT: No such file or directory - -1
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:70:in `size'
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:70
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:37
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:36
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:56:in `load'
      D:/work/jruby-dev/mspec.git/bin/mspec-ci:8
      
      5)
      File#size returns 0 for an empty file ERROR
      Errno::ENOENT: No such file or directory - -1
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:76:in `size'
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:76
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:37
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:36
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:56:in `load'
      D:/work/jruby-dev/mspec.git/bin/mspec-ci:8
      
      6)
      An exception occurred during: after :each
      File#size returns 0 for an empty file ERROR
      Errno::EACCES: Permission denied - D:/work/jruby-dev/rubyspec.git/rubyspec_temp/14-i_exist
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:48
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:37
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:36
      D:/work/jruby-dev/rubyspec.git/core/file/size_spec.rb:56:in `load'
      D:/work/jruby-dev/mspec.git/bin/mspec-ci:8
      
      Finished in 0.104000 seconds
      
      1 file, 14 examples, 9 expectations, 0 failures, 6 errors
      

        Issue Links

          Activity

          Hide
          Vladimir Sizikov added a comment -

          We need a functioning jnr-posix's fstat() on Windows, since that's the reason why File.size fails. See also JRUBY-4149.

          Show
          Vladimir Sizikov added a comment - We need a functioning jnr-posix's fstat() on Windows, since that's the reason why File.size fails. See also JRUBY-4149 .
          Hide
          Roger Pack added a comment -

          looks like this is still the case.

          C:\dev\ruby\downloads\jruby>bin\jruby --1.9 -ve "p File.new('README').size"
          jruby 1.6.0.RC1 (ruby 1.9.2 patchlevel 136) (2011-01-13 75ced7c) (Java HotSpot(TM) Client VM 1.6.0_18) [Windows 7-x86-java]
          org/jruby/RubyFile.java:1751:in `size': No such file or directory - -1 (Errno::ENOENT)
          from -e:1:in `(root)'

          Show
          Roger Pack added a comment - looks like this is still the case. C:\dev\ruby\downloads\jruby>bin\jruby --1.9 -ve "p File.new('README').size" jruby 1.6.0.RC1 (ruby 1.9.2 patchlevel 136) (2011-01-13 75ced7c) (Java HotSpot(TM) Client VM 1.6.0_18) [Windows 7-x86-java] org/jruby/RubyFile.java:1751:in `size': No such file or directory - -1 (Errno::ENOENT) from -e:1:in `(root)'
          Hide
          Doug Hathaway added a comment -

          Confirmed still broken in 1.6.4

          $ jruby --1.9 -ve "p File.new('README').size"
          jruby 1.6.4 (ruby-1.9.2-p136) (2011-08-23 17ea768) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_25) [Windows 7-amd64-java]
          Errno::ENOENT: No such file or directory - -1
          size at org/jruby/RubyFile.java:1816
          (root) at -e:1

          Show
          Doug Hathaway added a comment - Confirmed still broken in 1.6.4 $ jruby --1.9 -ve "p File.new('README').size" jruby 1.6.4 (ruby-1.9.2-p136) (2011-08-23 17ea768) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_25) [Windows 7-amd64-java] Errno::ENOENT: No such file or directory - -1 size at org/jruby/RubyFile.java:1816 (root) at -e:1
          Hide
          Charles Oliver Nutter added a comment -

          Optimistically calling this fixed, since we have specs running on Windows now (right?) and have done several rounds of fixes and improvements to native support since this bug was last updated.

          Show
          Charles Oliver Nutter added a comment - Optimistically calling this fixed, since we have specs running on Windows now (right?) and have done several rounds of fixes and improvements to native support since this bug was last updated.
          Hide
          a bc added a comment -

          hit this issue on latest Jruby1.7.3 and rails 3.2.11 and windows7.
          it's a basic function, should be used by many libraries/applications.

          Show
          a bc added a comment - hit this issue on latest Jruby1.7.3 and rails 3.2.11 and windows7. it's a basic function, should be used by many libraries/applications.
          Hide
          Thomas E Enebo added a comment -

          Re-opening to make sure we reexamine this. I did not see any actual confirmation originally that this was fixed.

          Show
          Thomas E Enebo added a comment - Re-opening to make sure we reexamine this. I did not see any actual confirmation originally that this was fixed.
          Hide
          Thomas E Enebo added a comment -

          This should be fixed in commit 27f00a9. fstat() as implemented in jnr-posix was calling the unix fd extraction method. On windows we needed to get the HANDLE out of FileDescriptor then open via _osf_openHandle(HANDLE) + _close when done. Seemed to work first try.

          Please try this out and reopen if you find this is not working. My only big concern (and this concern overlaps into stat and lstat) is that we seem to be using the 32 bit stat struct. Seems like Windows has like 6 types of stat structs now

          Show
          Thomas E Enebo added a comment - This should be fixed in commit 27f00a9. fstat() as implemented in jnr-posix was calling the unix fd extraction method. On windows we needed to get the HANDLE out of FileDescriptor then open via _osf_openHandle(HANDLE) + _close when done. Seemed to work first try. Please try this out and reopen if you find this is not working. My only big concern (and this concern overlaps into stat and lstat) is that we seem to be using the 32 bit stat struct. Seems like Windows has like 6 types of stat structs now
          Hide
          Thomas E Enebo added a comment -

          See last comment on what was changed and please test to confirm for your Windows variant...

          Fixed in commit 27f00a9

          Show
          Thomas E Enebo added a comment - See last comment on what was changed and please test to confirm for your Windows variant... Fixed in commit 27f00a9

            People

            • Assignee:
              Thomas E Enebo
              Reporter:
              Vladimir Sizikov
            • Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: