From e377d3bb755f5126dce2e655e3469a13e1ed885c Mon Sep 17 00:00:00 2001 From: nagachika Date: Mon, 3 Jun 2013 15:49:06 +0000 Subject: merge revision(s) 40887,40888,40894,40896: [Backport #8431] * win32/win32.c (setup_overlapped, finish_overlapped): extract from rb_w32_read() and rb_w32_write(). * win32/win32.c (setup_overlapped): check the error code in addition to the result of SetFilePointer() to determine if an error occurred, because INVALID_SET_FILE_POINTER is a valid value. [ruby-core:55098] [Bug #8431] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@41056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index c19b1608df..d10926d2c9 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -2655,4 +2655,35 @@ End IO.select(tempfiles) }, bug8080 end + + def test_read_32bit_boundary + bug8431 = '[ruby-core:55098] [Bug #8431]' + make_tempfile {|t| + assert_separately(["-", bug8431, t.path], <<-"end;") + msg = ARGV.shift + f = open(ARGV[0], "rb") + f.seek(0xffff_ffff) + assert_nil(f.read(1), msg) + end; + } + end if /mswin|mingw/ =~ RUBY_PLATFORM + + def test_write_32bit_boundary + bug8431 = '[ruby-core:55098] [Bug #8431]' + make_tempfile {|t| + assert_separately(["-", bug8431, t.path], <<-"end;", timeout: 30) + msg = ARGV.shift + f = open(ARGV[0], "wb") + f.seek(0xffff_ffff) + begin + # this will consume very long time or fail by ENOSPC on a + # filesystem which sparse file is not supported + f.write('1') + rescue SystemCallError + else + assert_equal(0x1_0000_0000, f.tell, msg) + end + end; + } + end if /mswin|mingw/ =~ RUBY_PLATFORM end -- cgit v1.2.3