Project

General

Profile

Actions

Bug #3484

closed

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

Added by normalperson (Eric Wong) almost 14 years ago. Updated almost 13 years ago.

Status:
Closed
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
Actions #1

Updated by normalperson (Eric Wong) almost 14 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

Actions #2

Updated by normalperson (Eric Wong) almost 14 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

Actions #3

Updated by kosaki (Motohiro KOSAKI) almost 14 years ago

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

=end

Actions #4

Updated by kosaki (Motohiro KOSAKI) almost 14 years ago

  • Status changed from Open to Closed

=begin

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0