[#69616] [Ruby trunk - Feature #11258] add 'x' mode character for O_EXCL — cremno@...
Issue #11258 has been updated by cremno phobia.
3 messages
2015/06/16
[#69643] [Ruby trunk - Misc #11276] [RFC] compile.c: convert to use ccan/list — normalperson@...
Issue #11276 has been updated by Eric Wong.
3 messages
2015/06/17
[#69751] [Ruby trunk - Bug #11001] 2.2.1 Segmentation fault in reserve_stack() function. — kubo@...
Issue #11001 has been updated by Takehiro Kubo.
3 messages
2015/06/27
[ruby-core:69529] [Ruby trunk - Feature #7148] Improved Tempfile w/o DelegateClass
From:
matz@...
Date:
2015-06-12 06:12:52 UTC
List:
ruby-core #69529
Issue #7148 has been updated by Yukihiro Matsumoto.
It's OK for me to implement Tempfile without using DelegateClass. If JRuby does similar thing already, it might be a good idea to share implementation. Besides that, we might need to think about killing/redefining some unnecessary/invalid methods of File class, e.g. reopen. I am afraid dup is one of them.
Matz.
----------------------------------------
Feature #7148: Improved Tempfile w/o DelegateClass
https://bugs.ruby-lang.org/issues/7148#change-52847
* Author: Masaki Matsushita
* Status: Assigned
* Priority: Low
* Assignee: Yukihiro Matsumoto
----------------------------------------
I propose improved `Tempfile` without `DelegateClass()`.
Present `Tempfile` has following problems.
1. confusing inspect
~~~ruby
t = Tempfile.new("foo") #=> #<File:/tmp/foo20121012-6762-12w11to>
t.is_a? File #=> false
~~~
2. `#dup` doesn't duplicate `IO`
~~~ruby
t = Tempfile.new("foo")
t.dup.close
t.read #=> IOError: closed stream
~~~
3. finalizer performs unlink even when it has been duplicated
~~~ruby
t = Tempfile.new("foo")
path = t.path #=> "/tmp/foo20121012-7533-1q537gq"
File.exist? path #=> true
tt = t.dup
t = nil
GC.start
File.exist? path #=> false
~~~
I think these problems caused by using `DelegateClass()`.
Therefore, I made a patch to resolve the problems.
The patched Tempfile class is a subclass of File.
---Files--------------------------------
patch.diff (3.52 KB)
--
https://bugs.ruby-lang.org/