Skip to content

File.seek fails on large file #3435

@jegt

Description

@jegt

File.seek fails on files 2GB or larger on Solaris and Linux.

Test program:
[2147483647, 2147483648].each do |position|
file = File.open('test.tar', 'rb')
file.seek(position)
puts "seek to #{position} succeeded"
end

output:
seek to 2147483647 succeeded
Errno::EBADF: Bad file number - test.tar
seek at org/jruby/RubyIO.java:1648
block in seek.rb at seek.rb:3
each at org/jruby/RubyArray.java:1560
at seek.rb:1

jruby 9.0.3.0 (2.2.2) 2015-10-21 633c9aa Java HotSpot(TM) 64-Bit Server VM 25.65-b01 on 1.8.0_65-b17 +jit [SunOS-amd64]

SunOS org00 5.11 omnios-f090f73 i86pc i386 i86pc

jruby 9.0.3.0 (2.2.2) 2015-10-21 633c9aa OpenJDK 64-Bit Server VM 25.45-b02 on 1.8.0_45-internal-b14 +jit [linux-amd64]

Linux worker04 3.13.0-67-generic #110-Ubuntu SMP Fri Oct 23 13:24:41 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

I discovered this when trying to use multipart uploads to S3 using the official aws-sdk gem.

When using the gem i got mostly Errno::EAGAIN and sometimes Errno::ENOENT. The test program seems to always fail with Errno::EBADF.

The same test program works fine on MRI: ruby 2.1.3p242 (2014-09-19 revision 47630) [i386-solaris2.11]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions