Project

General

Profile

Bug #12413

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

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

Status:
Closed
Priority:
Normal
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

Associated revisions

Revision bee0756e
Added by normal almost 3 years ago

dir.c (dir_close): update RDoc for 2.3 #close change

[ruby-core:75679] [Bug #12413]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 55120
Added by normalperson (Eric Wong) almost 3 years ago

dir.c (dir_close): update RDoc for 2.3 #close change

[ruby-core:75679] [Bug #12413]

Revision 55120
Added by normal almost 3 years ago

dir.c (dir_close): update RDoc for 2.3 #close change

[ruby-core:75679] [Bug #12413]

Revision 55120
Added by normal almost 3 years ago

dir.c (dir_close): update RDoc for 2.3 #close change

[ruby-core:75679] [Bug #12413]

Revision 55120
Added by normal almost 3 years ago

dir.c (dir_close): update RDoc for 2.3 #close change

[ruby-core:75679] [Bug #12413]

Revision ac9d6faa
Added by nagachika (Tomoyuki Chikanaga) almost 3 years ago

merge revision(s) 55120: [Backport #12413]

    * dir.c (dir_close): update RDoc for 2.3 #close change
      [ruby-core:75679] [Bug #12413]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 55405
Added by nagachika (Tomoyuki Chikanaga) almost 3 years ago

merge revision(s) 55120: [Backport #12413]

* dir.c (dir_close): update RDoc for 2.3 #close change
  [ruby-core:75679] [Bug #12413]

History

#1

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

Thanks for the doc update!

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

Also available in: Atom PDF