Bug #4507 ยป fileutils_cp_permissions.patch
ChangeLog (working copy) | ||
---|---|---|
Fri Mar 18 06:22:27 2011 Oleg Shaldybin <oleg.shaldybin@gmail.com>
|
||
* lib/fileutils.rb (FileUtils::Entry_#copy_file): updated FileUtils.cp
|
||
to still copy file permissions when :preserve is false (as cp does
|
||
this even when -p isn't set).
|
||
Fri Mar 18 00:59:38 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||
* ext/win32ole/extconf.rb (create_docfile): removed. should not
|
lib/fileutils.rb (working copy) | ||
---|---|---|
end
|
||
def copy_file(dest)
|
||
st = stat()
|
||
File.open(path()) do |s|
|
||
File.open(dest, 'wb') do |f|
|
||
File.open(dest, 'wb', st.mode) do |f|
|
||
IO.copy_stream(s, f)
|
||
end
|
||
end
|
test/fileutils/test_fileutils.rb (working copy) | ||
---|---|---|
}
|
||
end
|
||
def test_cp_preserve_permissions
|
||
touch 'tmp/cptmp'
|
||
chmod 0755, 'tmp/cptmp'
|
||
cp 'tmp/cptmp', 'tmp/cptmp2'
|
||
assert_equal File.stat('tmp/cptmp').mode, File.stat('tmp/cptmp2').mode
|
||
end
|
||
def test_cp_symlink
|
||
touch 'tmp/cptmp'
|
||
# src==dest (2) symlink and its target
|