Project

General

Profile

Actions

Bug #12413

closed

Dir#close does not raise IOError on already closed handle on OS X

Added by djberg96 (Daniel Berger) almost 8 years ago. Updated almost 8 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
[ruby-core:75679]

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
Actions #1

Updated by Anonymous almost 8 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 8 years ago

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 8 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 8 years ago

Thanks for the doc update!

Updated by usa (Usaku NAKAMURA) almost 8 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) almost 8 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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0