L --

For some reason FileTest.exist? was returning false,
> and FileTest.directory? returns true.
>
>
>   # Find this module in the modulepath.
>   def path
> -    environment.modulepath.collect { |path| File.join(path, name) }.find {
> |d| FileTest.exist?(d) }
> +    environment.modulepath.collect { |path| File.join(path, name) }.find {
> |d| FileTest.directory?(d) }
>   end
>

I find this rather disturbing.  On most versions of ruby FileTest.exist?()
is implemented as:

    if (rb_stat(fname, &st) < 0) return Qfalse;
    return Qtrue;

...while FileTest.directory?() is implemented as:

    if (rb_stat(fname, &st) < 0) return Qfalse;
    if (S_ISDIR(st.st_mode)) return Qtrue;
    return Qfalse;

Note specifically that the first line of each is identical; therefore any
case which returns false for exist?() should perforce be returning false for
directory?()

At best, we have some leaky stubbing in a tests or some other confounding
factor (but nothing that should require changing lib-code); at worst, we
have something going on that is messing with the c-level semantics of ruby.
How sure are you of the diagnosis?  Was there anything odd about your setup
(running an unusual ruby version or...)?

-- M
-----------------------------------------------------------
When in trouble or in doubt, run in circles,
scream and shout. -- 1920's parody of the
maritime general prudential rule
------------------------------------------------------------

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to