FileUtils.mv does not overwrite files in --1.9
----------------------------------------------
Key: JRUBY-5826
URL: http://jira.codehaus.org/browse/JRUBY-5826
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.6.2
Environment: jruby 1.6.2 (ruby-1.9.2-p136) (2011-05-23 e2ea975) (Java
HotSpot(TM) Client VM 1.6.0_24) [Windows 7-x86-java]
Reporter: Marti Kaljuve
The private method {{FileUtils.fu_same?}} used File.expand_path(a) ==
File.expand_path(b) in --1.8, but it now uses *File.identical?(a, b)* in --1.9,
which I don't think is the right behavior.
*How to reproduce:*
1. Create 'a.txt'
2. Copy 'a.txt' to 'b.txt'
3. Run 'jruby --1.9 -S jirb'
{code}
irb(main):001:0> require 'fileutils'
=> true
irb(main):002:0> FileUtils.mv 'a.txt', 'b.txt'
ArgumentError: same file: a.txt and b.txt
from c:/jruby-1.6.2/lib/ruby/1.9/fileutils.rb:1417:in `fu_each_src_dest'
from c:/jruby-1.6.2/lib/ruby/1.9/fileutils.rb:1432:in
`fu_each_src_dest0'
from c:/jruby-1.6.2/lib/ruby/1.9/fileutils.rb:1416:in `fu_each_src_dest'
from c:/jruby-1.6.2/lib/ruby/1.9/fileutils.rb:504:in `mv'
from (irb):2:in `evaluate'
from org/jruby/RubyKernel.java:1093:in `eval'
from org/jruby/RubyKernel.java:1419:in `loop'
from org/jruby/RubyKernel.java:1205:in `catch'
from org/jruby/RubyKernel.java:1205:in `catch'
from c:\jruby-1.6.2\bin\jirb:13:in `(root)'
{code}
Result: Both files remain.
*Expected output:*
In 'jruby --1.8 -S jirb' it works as expected (same as in MRI 1.9.2):
{code}
irb(main):001:0> require 'fileutils'
=> true
irb(main):002:0> FileUtils.mv 'a.txt', 'b.txt'
=> 0
{code}
Result: a.txt is removed, b.txt is replaced.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email