As posted in ruby-talk:85349, I believe there is a bug in FileUtils.cp's
handling of copying a file onto itself. Attached is a small proposed fix.
Chad
Index: fileutils.rb
===================================================================
RCS file: /src/ruby/lib/fileutils.rb,v
retrieving revision 1.22
diff -u -c -r1.22 fileutils.rb
cvs server: conflicting specifications of output style
*** fileutils.rb 30 Oct 2003 09:36:39 -0000 1.22
--- fileutils.rb 17 Nov 2003 17:19:06 -0000
***************
*** 312,317 ****
--- 312,318 ----
return if options[:noop]
fu_each_src_dest(src, dest) do |s,d|
+ raise ArgumentError, "`#{s}' and `#{d}' are the same file" unless
(File.
expand_path("src") == File.expand_path("dest"))
fu_preserve_attr(options[:preserve], s, d) {
copy_file s, d
}