Project

General

Profile

Actions

Bug #1052

closed

When using File.open with seek and readpartial, pos isn't updated.

Added by MenThal (Kent Dahl) about 15 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
[ruby-core:21561]

Description

=begin
When using File.open in ruby 1.8.7 with seek and readpartial, pos doesn't work.

If I seek and use readpartial on a file opened for reading, pos is not updated properly. Sample code:

File.open(filename){|f|
f.seek 0 # Comment out this, and it works.
f.readpartial(10)
p f.pos # Expect 10, not 0.
}

Output:
ruby1.8 file_seek_pos_issue.rb => 0
ruby1.9 file_seek_pos_issue.rb => 10

System:

  • ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
  • ruby 1.9.0 (2008-06-20 revision 17482) [i486-linux]
  • Ubuntu 8.10 (Linux wintermute 2.6.27-7-generic #1 SMP Tue Nov 4 19:33:20 UTC 2008 i686 GNU/Linux)
    =end

Files

file_seek_pos_issue.rb (555 Bytes) file_seek_pos_issue.rb Small example for reproducing problem with seek, readpartial and pos. MenThal (Kent Dahl), 01/26/2009 06:17 PM
Actions #1

Updated by akr (Akira Tanaka) about 15 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r21913.
=end

Actions

Also available in: Atom PDF

Like0
Like0