Hi, Eric.

Your solution works fine on Windows.

Just add comments to these lines what those returns are mean.

On 12/4/06, Eric Hodel <[EMAIL PROTECTED]> wrote:

On Dec 2, 2006, at 23:51 , Anatol Pomozov wrote:

> Look at test code at test_gem_source_info_cache.rb:80 . Chmod and
> stat functions are very limited on Windows platform.
>
> I have added code that shows us what permission file has after we
> try to set 0222 mode
>     FileUtils.chmod 0222, @sic.system_cache_file
>     puts sprintf("%o", File.stat(@sic.system_cache_file).mode)
>
> It returns me
> 100644
>
> It means that "real" file mode is 644. So RubyGems engine could
> read cache data.

How about this patch:

Index: test/test_gem_source_info_cache.rb
===================================================================
--- test/test_gem_source_info_cache.rb  (revision 1111)
+++ test/test_gem_source_info_cache.rb  (working copy)
@@ -79,6 +79,8 @@
    def test_cache_data_none_readable
      FileUtils.chmod 0222, @sic.system_cache_file
      FileUtils.chmod 0222, @sic.user_cache_file
+    return if (File.stat(@sic.system_cache_file).mode & 0222) != 0222
+    return if (File.stat(@sic.user_cache_file).mode & 0222) != 0222
      assert_equal({}, @sic.cache_data)
    end

--
Eric Hodel - [EMAIL PROTECTED] - http://blog.segment7.net

--
anatol (http://feeds.feedburner.com/apomozov-eng)
_______________________________________________
Rubygems-developers mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rubygems-developers

Reply via email to