file size error on windows #770

Closed
pickerel opened this Issue May 26, 2013 · 3 comments

Projects

None yet

4 participants

@pickerel

It's my test code: test.rb

f = File.new("test.txt", "a")
p f.size

when i executed it with ruby 1.9.3p125, i got the result:
c:\test>ruby export.rb
0

but when i executed it with jruby 1.7.4 (1.9.3p392), i got the result:
c:\test>jruby export.rb
SystemCallError: Unknown error - Unknown Error (20047) - -1
size at org/jruby/RubyFile.java:1081
(root) at export.rb:2

@BanzaiMan
Member

I have a hunch that this may be related to #547.

@keeguon
keeguon commented Nov 21, 2013

As @BanzaiMan mentioned it I created the ticket #1240 with the same issue what's the status on this...?

@enebo enebo added a commit that referenced this issue Nov 27, 2013
@enebo enebo Fixes #1272 and hopefully #770 91097da
@enebo
Member
enebo commented Nov 27, 2013

I changed the impl of size to use a different mechanism for determing size. This should work as well as File.stat.size does so I am assuming it will fix the problem here. fwiw, the original test case in this bug did not error for me when I started working on this but #1272 uncovered a second problem with jnr-posix fstat impl. Speculatively closing. Re-open if you have a problem still.

@enebo enebo closed this Nov 27, 2013
@jayjlawrence jayjlawrence added a commit to jayjlawrence/jruby that referenced this issue Dec 4, 2013
@enebo @jayjlawrence enebo + jayjlawrence Fixes #1272 and hopefully #770 ced5edc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment