[#63592] [ruby-trunk - Bug #10009] IO operation is 10x slower in multi-thread environment — normalperson@...
Issue #10009 has been updated by Eric Wong.
3 messages
2014/07/08
[#63682] [ruby-trunk - Feature #10030] [PATCH] reduce rb_iseq_struct to 296 bytes — ko1@...
Issue #10030 has been updated by Koichi Sasada.
3 messages
2014/07/13
[#63703] [ruby-trunk - Feature #10030] [PATCH] reduce rb_iseq_struct to 296 bytes — ko1@...
Issue #10030 has been updated by Koichi Sasada.
3 messages
2014/07/14
[#63743] [ruby-trunk - Bug #10037] Since r46798 on Solaris, "[BUG] rb_vm_get_cref: unreachable" during make — ngotogenome@...
Issue #10037 has been updated by Naohisa Goto.
3 messages
2014/07/15
[#64136] Ruby 2.1.2 (and 2.1.1 and probably others) assumes a libffi with 3 version numbers in extconf.rb — "Jeffrey 'jf' Lim" <jfs.world@...>
As per subject.
4 messages
2014/07/31
[#64138] Re: Ruby 2.1.2 (and 2.1.1 and probably others) assumes a libffi with 3 version numbers in extconf.rb
— "Jeffrey 'jf' Lim" <jfs.world@...>
2014/07/31
On Thu, Jul 31, 2014 at 6:03 PM, Jeffrey 'jf' Lim <jfs.world@gmail.com>
[ruby-core:63747] [ruby-trunk - Bug #10039] [Open] "a+" mode for File.open doesn’t work
From:
quintus@...
Date:
2014-07-15 18:47:54 UTC
List:
ruby-core #63747
Issue #10039 has been reported by Marvin Gテシlker.
----------------------------------------
Bug #10039: "a+" mode for File.open doesn窶冲 work
https://bugs.ruby-lang.org/issues/10039
* Author: Marvin Gテシlker
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
* ruby -v: ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
Hi there,
According to [the documentation](http://www.ruby-doc.org/core-2.1.2/IO.html#method-c-new) the "a+" file open mode should open a file:
> Read-write, starts at end of file if file exists
However, it appears that the "a+" mode behaves exactly as "r+", i.e. the file pointer is placed at the beginning of the file instead of the end.
This example demonstrates the problem:
~~~
(288) [20:37:02 quintus@hades] /tmp/foobar
% cat test.txt
test
test2
(289) [20:37:07 quintus@hades] /tmp/foobar
% irb
irb(main):001:0> f = File.open("test.txt", "a+")
=> #<File:test.txt>
irb(main):002:0> f.pos
=> 0
irb(main):003:0> f.eof?
=> false
irb(main):004:0> f.read
=> "test\ntest2\n"
irb(main):005:0> f.pos
=> 10
irb(main):006:0> f.close
=> nil
irb(main):007:0>
~~~
The file position pointer should have been placed at the end of the file (i.e. position 10), not at the beginning (which is what "r+" is for).
Vale,
Quintus
--
https://bugs.ruby-lang.org/