Find.find() doesn't work with broken symlinks

I am using ruby 1.8.5 (2006-12-25 patchlevel 12) [i686-darwin8.8.1]. I will do more testing tonight. The broken symlinks pointed to network mounts.

···

-------------- Original message ----------------------
From: Stefano Crocco <stefano.crocco@alice.it>

Alle lunedì 26 marzo 2007, robertlaferla@comcast.net ha scritto:
> Find.find() seems to filter out broken symlinks. I was hoping to use it to
> get a recursive list of files in directory so I could run various tests on
> each file (like whether or not a symlink points to a valid file)
>
> What can I use instead of Find.find()? Is there a better way?
>
> def testsymlinks(srcpath)
> Find.find(srcpath) do |path|
> if File.symlink?(path)
> begin
> File.stat(path)
> rescue Exception => e
> $stderr.puts "The symlink " + path + " does not point to a
> valid file. Please check that you have all your network volumes mounted."
> exit(-1)
> end
> end
> end
> end

Are you sure of this? I tried a small setup (made a directory, created a file
and made a symlink to it, then removed the file) and it works. Find.find
passes the broken symlink to the block and File.stat raises a SystemCall
error (Errno::ENOENT). I'm running ruby 1.8.6 on gentoo linux.

Stefano

gem install alib

   alib.util.find(srcpath) do |path|

     # ...

   end

it follows symlinks.

-a

···

On Tue, 27 Mar 2007 robertlaferla@comcast.net wrote:

I am using ruby 1.8.5 (2006-12-25 patchlevel 12) [i686-darwin8.8.1]. I will
do more testing tonight. The broken symlinks pointed to network mounts.

--
be kind whenever possible... it is always possible.
- the dalai lama