Project

General

Profile

Bug #3484

IO.copy_stream w/sendfile fails on large files under 32-bit

Added by normalperson (Eric Wong) over 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
ruby -v:
ruby 1.9.3dev (2010-06-26 trunk 28443) [i686-linux]
Backport:

Description

=begin
When IO.copy_stream uses sendfile() under 32-bit Linux, it fails for
large files (>2G) because a single sendfile() is limited to the maximum value
of ssize_t (LONG_MAX). Attached is a short patch that breaks up large sendfile()
calls and reuses the existing retry logic.
=end


Files

io_copy_stream_sendfile.patch (693 Bytes) io_copy_stream_sendfile.patch patch to fix the issue normalperson (Eric Wong), 06/26/2010 11:27 AM
#1

Updated by normalperson (Eric Wong) over 10 years ago

=begin
Err, fails as in truncates files greater than UINT_MAX bytes long and
hits EINVAL and falls back to the read/write loop for files between
INT_MAX and UINT_MAX bytes long

=end

#2

Updated by normalperson (Eric Wong) over 10 years ago

=begin
And the stupid ugly cast in my patch for ssize_t_max can fail under some compilers,
Just using "size_t_max = LONG_MAX" would be more fool-proof and easier to read.
=end

#3

Updated by kosaki (Motohiro KOSAKI) over 10 years ago

=begin
note: akr-san committed the fix as r28450.

=end

#4

Updated by kosaki (Motohiro KOSAKI) over 10 years ago

  • Status changed from Open to Closed

=begin

=end

Also available in: Atom PDF