Project

General

Profile

Actions

Bug #9571

closed

"Error: TestFileUtils#test_rmdir: Errno::EEXIST: File exists @ dir_s_rmdir - data" on Solaris

Added by ngoto (Naohisa Goto) almost 11 years ago. Updated about 10 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.0dev (2014-02-26) [sparc64-solaris2.10]
[ruby-dev:48017]

Description

Solarisにて、いつからかは忘れましたが、make test-all にて以下のErrorが生じています。

52) Error:
TestFileUtils#test_rmdir:
Errno::EEXIST: File exists @ dir_s_rmdir - data
/XXXXX/lib/fileutils.rb:277:in `rmdir'
/XXXXX/lib/fileutils.rb:277:in `block in rmdir'
/XXXXX/lib/fileutils.rb:271:in `each'
/XXXXX/lib/fileutils.rb:271:in `rmdir'
/XXXXX/test/fileutils/test_fileutils.rb:1380:in `block in test_rmdir'
/XXXXX/lib/test/unit/assertions.rb:166:in `assert_nothing_raised'
/XXXXX/test/fileutils/test_fileutils.rb:1379:in `test_rmdir'

Solaris では、中身が残っているディレクトリをrmdirしようとしたとき、errno に EEXIST をセットします。
http://docs.oracle.com/cd/E23824_01/html/821-1463/rmdir-2.html

$ irb
irb(main):001:0> Dir.mkdir('aaa')
=> 0
irb(main):002:0> Dir.mkdir('aaa/bbb')
=> 0
irb(main):003:0> Dir.rmdir('aaa')
Errno::EEXIST: File exists - aaa
from (irb):3:in `rmdir'
from (irb):3
from /usr/local/64/bin/irb:12:in `<main>'
irb(main):004:0> 

SunOS 4 では ENOTEMPTY を使用していたが Solaris では EEXIST に変更になったとの記述も見つけました。
http://docs.oracle.com/cd/E19455-01/806-2724/6jbu1b2ck/index.html

しかし、fileutils.rbのrmdirは、これに対応していないため、エラーになるようです。

Updated by ngoto (Naohisa Goto) over 10 years ago

SUSv3 に以下の記述があり、Solaris以外でもエラーになるOSがあるかもしれません。

If the directory is not an empty directory, rmdir() shall fail and set errno to [EEXIST] or [ENOTEMPTY].

http://pubs.opengroup.org/onlinepubs/000095399/functions/rmdir.html

Updated by ngoto (Naohisa Goto) over 10 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset r45720.


  • lib/fileutils.rb (rmdir): rescue Errno::EEXIST in addition to
    ENOTEMPTY (and ENOENT), because SUSv3 describes that "If the
    directory is not an empty directory, rmdir() shall fail and set
    errno to [EEXIST] or [ENOTEMPTY]" and Solaris uses EEXIST.
    [Bug #9571] [ruby-dev:48017]

Updated by usa (Usaku NAKAMURA) over 10 years ago

  • Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN to 1.9.3: REQUIRED, 2.0.0: UNKNOWN, 2.1: REQUIRED

Updated by nagachika (Tomoyuki Chikanaga) over 10 years ago

  • Backport changed from 1.9.3: REQUIRED, 2.0.0: UNKNOWN, 2.1: REQUIRED to 1.9.3: REQUIRED, 2.0.0: UNKNOWN, 2.1: DONE

Backported into ruby_2_1 branch at r46910.

Updated by usa (Usaku NAKAMURA) about 10 years ago

  • Backport changed from 1.9.3: REQUIRED, 2.0.0: UNKNOWN, 2.1: DONE to 2.0.0: DONE, 2.1: DONE

backported into ruby_2_0_0 at r47336.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0