Hi,
I found a bug in ruby 1.8.4 in FileUtils.mv() function. When moving a
file from one filesystem to another, it does not unlink the source file.
Ruby 1.8.2 worked fine.
Patch against 1.8.4 release:
--- lib/fileutils.rb.orig Sun Nov 20 02:23:41 2005
+++ lib/fileutils.rb Mon Jan 16 02:08:47 2006
@@ -501,6 +501,7 @@
File.rename s, d
rescue Errno::EXDEV
copy_entry s, d, true
+ File.unlink s
end
rescue SystemCallError
raise unless options[:force]
Testcase:
require 'fileutils'
FileUtils.mv '/home/pav/91771', '/var/tmp/91771'
when
Filesystem Size Used Avail Capacity Mounted on
/dev/ad10s2e 104G 90G 11G 89% /usr
/dev/ad10s2d 248M 173M 55M 76% /var
/home and /var are on different file systems leaves 91771 in /home/pav.
Operating system is FreeBSD 6.0, if that matters.
--
Pav Lucistnik <pav / oook.cz>
<pav / FreeBSD.org>
Knight: We shall say Ny! again to you if you do not appease us.
Arthur: All right. What do you want?
Knight: We want... a shruberry!