Skip to content

Commit 12b0aa8

Browse files
nobuhsbt
authored andcommitted
Run r66972 assertion only when a sticky-bit makes sense
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent f3f850e commit 12b0aa8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

test/fileutils/test_fileutils.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -742,13 +742,14 @@ def test_remove_entry_secure
742742
assert_file_not_exist 'tmp/tmpdir/c'
743743

744744
File.chmod(01777, 'tmp/tmpdir')
745-
Dir.mkdir 'tmp/tmpdir/d', 0
746-
assert_raise(Errno::EACCES) {remove_entry_secure 'tmp/tmpdir/d'}
747-
File.chmod 0777, 'tmp/tmpdir/d'
748-
Dir.rmdir 'tmp/tmpdir/d'
745+
if File.sticky?('tmp/tmpdir')
746+
Dir.mkdir 'tmp/tmpdir/d', 0
747+
assert_raise(Errno::EACCES) {remove_entry_secure 'tmp/tmpdir/d'}
748+
File.chmod 0777, 'tmp/tmpdir/d'
749+
Dir.rmdir 'tmp/tmpdir/d'
750+
end
749751

750752
Dir.rmdir 'tmp/tmpdir'
751-
752753
end
753754

754755
def test_remove_entry_secure_symlink

0 commit comments

Comments
 (0)