it seems that i found a bug in fileutils with symbolic.links
my System:
debian/woody with ruby-backport
ruby 1.8.1 (2004-02-03) [i386-linux]
i made a symlink on a directory like the following example:
loew@ssflx01_v4:/tmp/ruby$ ls -laR
.:
total 16
drwxr-xr-x 4 loew loew 4096 Mar 10 09:48 .
drwxrwxrwt 4 root root 4096 Mar 10 09:48 …
drwxr-xr-x 2 loew loew 4096 Mar 10 09:48 tst
drwxr-xr-x 2 loew loew 4096 Mar 10 09:48 tst2
./tst:
total 8
drwxr-xr-x 2 loew loew 4096 Mar 10 09:48 .
drwxr-xr-x 4 loew loew 4096 Mar 10 09:48 …
lrwxrwxrwx 1 loew loew 7 Mar 10 09:48 tst2 -> …/tst2
./tst2:
total 8
drwxr-xr-x 2 loew loew 4096 Mar 10 09:48 .
drwxr-xr-x 4 loew loew 4096 Mar 10 09:48 …
loew@ssflx01_v4:/tmp/ruby$ ruby1.8 -e ‘require “fileutils”; FileUtils.rm_r("/tmp/ruby/tst")’
/usr/lib/ruby/1.8/fileutils.rb:591:in rmdir’: Not a directory -
/tmp/ruby/tst/tst2 (Errno::ENOTDIR)
from /usr/lib/ruby/1.8/fileutils.rb:591:in remove_dir’
from /usr/lib/ruby/1.8/fileutils.rb:585:in remove_dir’
from /usr/lib/ruby/1.8/fileutils.rb:581:in foreach’
from /usr/lib/ruby/1.8/fileutils.rb:581:in remove_dir’
from /usr/lib/ruby/1.8/fileutils.rb:542:in rm_r’
from /usr/lib/ruby/1.8/fileutils.rb:534:in each’
from /usr/lib/ruby/1.8/fileutils.rb:534:in rm_r’
from -e:1
my patch:
ssflx01_v4:/usr/lib/ruby/1.8# diff -a -c fileutils.rb.old fileutils.rb
*** fileutils.rb.old Wed Mar 10 09:42:34 2004
— fileutils.rb Wed Mar 10 09:56:03 2004
···
*** 581,587 ****
Dir.foreach(dir) do |file|
next if /\A…?\z/ === file
path = “#{dir}/#{file}”
! if File.directory?(path)
remove_dir path, force
else
remove_file path, force
— 581,589 ----
Dir.foreach(dir) do |file|
next if /\A…?\z/ === file
path = “#{dir}/#{file}”
! if File.symlink?(path)
! remove_file path, force
! elsif File.directory?(path)
remove_dir path, force
else
remove_file path, force
regards,
Löw Christian