Backport #2267
IO#sync = true causes offset to not be updated after writing on OS X/FreeBSD
| Status: | Closed | Start date: | 10/26/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 100% |
||
| Category: | - | |||
| Target version: | - |
Description
#!/usr/bin/env ruby
f = File.open("bar", File::RDWR|File::CREAT, 0600)
f.sync=true
f.read
f.write "Hello"
puts "Should be 5: #{f.pos}"
f.close
`rm bar`
# from http://gist.github.com/216703
# The output under FreeBSD (7.2) and OS X with both
# Ruby 1.8.7 p160 and 1.8.7 p72 is:
#
# Should be 5: 0
#
# ref: http://thread.gmane.org/gmane.comp.lang.ruby.unicorn.general/100
Associated revisions
* io.c (io_fwrite): adjust stdio file position after direct write on
BSDish platforms. [ruby-core:26300]
io.c: Backport #2267 [ruby-core:26300]; Fix problem with IO so that the file position is correct after a direct write on BSDish platforms like OS X.
test/ruby/test_io.rb: Added a test for the fix.
History
Updated by nobu (Nobuyoshi Nakada) over 2 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r25485. Eric, thank you for reporting this issue. Your contribution to Ruby is greatly appreciated. May Ruby be with you.
Updated by shyouhei (Shyouhei Urabe) over 2 years ago
- Status changed from Closed to Assigned
- Assignee set to wyhaines (Kirk Haines)
I don't have neither environment to reproduce so please reject it if not, but it seems to me that this issue affects 1.8.6.
Updated by wyhaines (Kirk Haines) almost 2 years ago
- Status changed from Assigned to Closed
This issue was solved with changeset r28393. Eric, thank you for reporting this issue. Your contribution to Ruby is greatly appreciated. May Ruby be with you.