1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

fileutils.rb: fix traversal loop

* lib/fileutils.rb (FileUtils#rmdir): fix traversal loop, not trying
  remove same directory only.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-06-13 13:12:35 +00:00
parent d479419ad3
commit 4b5267018a
3 changed files with 7 additions and 0 deletions

View file

@ -1,3 +1,8 @@
Thu Jun 13 22:12:32 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/fileutils.rb (FileUtils#rmdir): fix traversal loop, not trying
remove same directory only.
Thu Jun 13 21:30:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (opt-dir), tool/ifchange: get rid of "alternate value"

View file

@ -273,6 +273,7 @@ module FileUtils
Dir.rmdir(dir = remove_tailing_slash(dir))
if parents
until (parent = File.dirname(dir)) == '.' or parent == dir
dir = parent
Dir.rmdir(dir)
end
end

View file

@ -1239,6 +1239,7 @@ class TestFileUtils
assert_nothing_raised(Errno::ENOENT) {
rmdir(subdir, parents: true)
}
assert_file_not_exist(subdir)
assert_file_not_exist('data/sub')
assert_directory('data')
end