diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-02 03:54:00 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-02 03:54:00 +0000 |
commit | 7dc77be29960a965363a55d33feb537bf55aee7e (patch) | |
tree | cfd40b4516cfbcfdda2e3f207b000d56da07ad44 /test/fileutils | |
parent | 87d3c2d6d47e36223d7a6cccf1991b72dc307865 (diff) | |
download | ruby-7dc77be29960a965363a55d33feb537bf55aee7e.tar.gz |
* lib/fileutils.rb (copy_entry, wrap_traverse): preserve attributes of
directories on FileUtils.cp_r. The fix was proposed by Jan
Wedekind. [Bug #7246]
* test/fileutils/test_fileutils.rb: add a test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/fileutils')
-rw-r--r-- | test/fileutils/test_fileutils.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb index c1104f31ca..54742d1d18 100644 --- a/test/fileutils/test_fileutils.rb +++ b/test/fileutils/test_fileutils.rb @@ -239,6 +239,22 @@ class TestFileUtils bug4507) end + def test_cp_preserve_permissions_dir + bug7246 = '[ruby-core:48603]' + mkdir 'tmp/cptmp' + mkdir 'tmp/cptmp/d1' + chmod 0745, 'tmp/cptmp/d1' + mkdir 'tmp/cptmp/d2' + chmod 0700, 'tmp/cptmp/d2' + cp_r 'tmp/cptmp', 'tmp/cptmp2', :preserve => true + assert_equal(File.stat('tmp/cptmp/d1').mode, + File.stat('tmp/cptmp2/d1').mode, + bug7246) + assert_equal(File.stat('tmp/cptmp/d2').mode, + File.stat('tmp/cptmp2/d2').mode, + bug7246) + end + def test_cp_symlink touch 'tmp/cptmp' # src==dest (2) symlink and its target |