Bug #12413
closedDir#close does not raise IOError on already closed handle on OS X
Description
The docs for Dir#close say "Closes the directory stream. Any further attempts to access dir will raise an IOError."
dir = Dir.new(Dir.pwd)
dir.close # nil
Here, I would expect another call to dir to raise an IOError, but it doesn't. On OS X it just returns nil.
dir.close # nil again (and again)
Whereas on both Linux and Windows I get the expected error:
IOError: closed directory
Updated by Anonymous almost 10 years ago
- Status changed from Open to Closed
Applied in changeset r55120.
dir.c (dir_close): update RDoc for 2.3 #close change
[ruby-core:75679] [Bug #12413]
Updated by normalperson (Eric Wong) almost 10 years ago
djberg96@gmail.com wrote:
Bug #12413: Dir#close does not raise IOError on already closed handle on OS X
https://bugs.ruby-lang.org/issues/12413
- ruby -v: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
The docs for Dir#close say "Closes the directory stream. Any further
attempts to access dir will raise an IOError."
Seems to be a documentation bug, fixed in r55120
IO#close and Dir#close are idempotent on 2.3+
https://bugs.ruby-lang.org/issues/10718
Whereas on both Linux and Windows I get the expected error:
IOError: closed directory
Older version of Ruby?
Updated by djberg96 (Daniel Berger) almost 10 years ago
Ah, yep, sorry. I was on an older version on the VM's and didn't notice. Disregard.
Updated by djberg96 (Daniel Berger) almost 10 years ago
Thanks for the doc update!
Updated by usa (Usaku NAKAMURA) over 9 years ago
- Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: DONTNEED, 2.2: DONTNEED, 2.3: REQUIRED
Updated by nagachika (Tomoyuki Chikanaga) over 9 years ago
- Backport changed from 2.1: DONTNEED, 2.2: DONTNEED, 2.3: REQUIRED to 2.1: DONTNEED, 2.2: DONTNEED, 2.3: DONE
ruby_2_3 r55405 merged revision(s) 55120.