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
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 2/15/07, robertlaferla@comcast.net <robertlaferla@comcast.net> wrote:
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
--
Garance Alistair Drosehn = drosihn@gmail.com
Senior Systems Programmer
Rensselaer Polytechnic Institute; Troy, NY; USA
i __think__ this could happen if /tmp were a soft link... ??
-a
···
On Fri, 16 Feb 2007, Garance A Drosehn wrote:
On 2/15/07, robertlaferla@comcast.net <robertlaferla@comcast.net> wrote:
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
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?
--
we can deny everything, except that we have the possibility of being better.
simply reflect on that.
- the dalai lama
It can using normal OS commands so I'd imagine the same is true with Ruby...
···
On 2/15/07, robertlaferla@comcast.net <robertlaferla@comcast.net> wrote:
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
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?
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 2/15/07, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:
On Fri, 16 Feb 2007, Garance A Drosehn wrote:
> 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?
i __think__ this could happen if /tmp were a soft link... ??
--
Garance Alistair Drosehn = drosihn@gmail.com
Senior Systems Programmer
Rensselaer Polytechnic Institute; Troy, NY; USA
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 Fri, Feb 16, 2007, ara.t.howard@noaa.gov wrote:
i __think__ this could happen if /tmp were a soft link... ??
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 2/15/07, Garance A Drosehn <drosihn@gmail.com> wrote:
On 2/15/07, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:
>
> 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/'.
--
Garance Alistair Drosehn = drosihn@gmail.com
Senior Systems Programmer
Rensselaer Polytechnic Institute; Troy, NY; USA
moral:
path = File.expand_path path
-a
···
On Fri, 16 Feb 2007, Ben Bleything wrote:
On Fri, Feb 16, 2007, ara.t.howard@noaa.gov 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
--
we can deny everything, except that we have the possibility of being better.
simply reflect on that.
- the dalai lama