From 7d89ecdc523aab7b9908501b6743da2c26a53825 Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 30 Apr 2012 14:37:54 +0000 Subject: * lib/fileutils.rb (copy_metadata): use File.lchown and File.lchmod to update meta data of symlinks. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/fileutils/test_fileutils.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/fileutils') diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb index f563068eda..2549458fa2 100644 --- a/test/fileutils/test_fileutils.rb +++ b/test/fileutils/test_fileutils.rb @@ -325,6 +325,17 @@ class TestFileUtils assert_equal 'SLdest', File.readlink('tmp/cpr_dest2/symlink') end if have_symlink? + def test_cp_r_symlink_preserve + mkdir 'tmp/cross' + mkdir 'tmp/cross/a' + mkdir 'tmp/cross/b' + touch 'tmp/cross/a/f' + touch 'tmp/cross/b/f' + ln_s '../a/f', 'tmp/cross/b/l' + ln_s '../b/f', 'tmp/cross/a/l' + cp_r 'tmp/cross', 'tmp/cross2', :preserve => true + end if have_symlink? + def test_cp_r_pathname # pathname touch 'tmp/cprtmp' -- cgit v1.2.3