I was trying out Find.find() today and found that if you pass it a
directory without a trailing slash, it doesn’t traverse the directory.
This seems like a bug to me. Is it? If so, how do I report it?
e.g.
require ‘find’
Find.find("/tmp/") do |path|
puts path
end
vs.
require ‘find’
Find.find("/tmp/") do |path|
puts path
end
On 2/15/07, [email protected] [email protected] wrote:
end
vs.
require ‘find’
Find.find(“/tmp/”) do |path|
puts path
end
Unless I’m missing something, your two examples are exactly
the same.
I am running ruby 1.8.5 (2006-12-25 patchlevel 12) [i386-freebsd6]
And I tried a quick test
of: Find.find(“/tmp”)
vs: Find.find(“/tmp/”)
And I seemed to get the same result from both. In my case, both
tests found 131 directories and 27 “other things” (ie, “not
directories”).
What platform are you running ruby on?
Which version of ruby are you running?
On Fri, 16 Feb 2007, Garance A Drosehn wrote:
Find.find("/tmp/") do |path|
tests found 131 directories and 27 “other things” (ie, “not directories”).
What platform are you running ruby on?
Which version of ruby are you running?
i think this could happen if /tmp were a soft link… ??
-a
Find.find("/tmp/") do |path|
tests found 131 directories and 27 “other things” (ie, “not directories”).
What platform are you running ruby on?
Which version of ruby are you running?
i think this could happen if /tmp were a soft link… ??
It can using normal OS commands so I’d imagine the same is true with
Ruby…
On 2/15/07, [email protected] [email protected] wrote:
directories").
What platform are you running ruby on?
Which version of ruby are you running?
i think this could happen if /tmp were a soft link… ??
Ooo. Good catch!
If I switch to testing this on MacOS 10, then ‘/tmp’ is a symlink
to the directory ‘/private/tmp’. And in that case, I get:
found 1 dirs, 0 other types in ‘/tmp’.
vs
found 10 dirs, 27 other types in ‘/tmp/’.
On Fri, Feb 16, 2007, [email protected] wrote:
i think this could happen if /tmp were a soft link… ??
Yup! This bites me all the time on osx:
folio ~/projects > ls /tmp
/tmp@
folio ~/projects > ls -l /tmp
lrwxr-xr-x 1 root admin 11 Dec 12 15:34 /tmp@ -> private/tmp
folio ~/projects > ls /tmp/
1f7ead7c295b42d3030a746438a8d222 2285/ …
Ben
On 2/15/07, Garance A Drosehn [email protected] wrote:
found 1 dirs, 0 other types in '/tmp'.
vs
found 10 dirs, 27 other types in ‘/tmp/’.
After spending another 10 seconds to think about this, I wonder if
Find.find should throw an exception if passed in a symlink? As it
is, Find.find() will only check the symlink itself if it was given a
symlink.
I probably should take another 60 seconds to think about it, but I
should move on to other email right now…
On Fri, 16 Feb 2007, Ben B. wrote:
folio ~/projects > ls /tmp/
1f7ead7c295b42d3030a746438a8d222 2285/ …
Ben
moral:
path = File.expand_path path
-a