C
Chad Fowler
I'm experiencing the following behavior in the latest CVS copy of ruby on
both Windows and Linux. I think it's a bug.
[chad@ns1 chad]$ cat test
Goodbye Cruel World!
[chad@ns1 chad]$ ruby -rfileutils -e 'FileUtils.cp("test", "test")'
[chad@ns1 chad]$ cat test
[chad@ns1 chad]$ ls -l test
-rw-rw-r-- 1 chad chad 0 Nov 17 08:35 test
[chad@ns1 chad]$
I would suggest the following small change.
Do others agree that this is a bug?
Thanks,
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 13:11:43 -0000
***************
*** 312,317 ****
--- 312,318 ----
return if options[:noop]
fu_each_src_dest(src, dest) do |s,d|
+ raise ArgumentError, "`#{src}' and `#{dest}' are the same file"
unless (
src != dest)
fu_preserve_attr(options[reserve], s, d) {
copy_file s, d
}
both Windows and Linux. I think it's a bug.
[chad@ns1 chad]$ cat test
Goodbye Cruel World!
[chad@ns1 chad]$ ruby -rfileutils -e 'FileUtils.cp("test", "test")'
[chad@ns1 chad]$ cat test
[chad@ns1 chad]$ ls -l test
-rw-rw-r-- 1 chad chad 0 Nov 17 08:35 test
[chad@ns1 chad]$
I would suggest the following small change.
Do others agree that this is a bug?
Thanks,
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 13:11:43 -0000
***************
*** 312,317 ****
--- 312,318 ----
return if options[:noop]
fu_each_src_dest(src, dest) do |s,d|
+ raise ArgumentError, "`#{src}' and `#{dest}' are the same file"
unless (
src != dest)
fu_preserve_attr(options[reserve], s, d) {
copy_file s, d
}