Bug: Cache failing on Windows (With Fix)

Soks reports ”#{cache_name} cache corrupt (bad characters in file)” on every startup.

Fixed by opening the file in binary at lines 10 and 35. According to the Pickaxe ‘b’ is DOS/Windows only, I have know idea if it will hurt when running on *nix.

Index: Soks/lib/soks-storage.rb
===================================================================
--- Soks/lib/soks-storage.rb    (revision 80)
+++ Soks/lib/soks-storage.rb    (revision 91)
@@ -7,7 +7,7 @@

         cache = nil

-        File.open( cache_filename_for( cache_name ) ) do |f|
+        File.open( cache_filename_for( cache_name ), 'rb' ) do |f|
             cache = Marshal.load(f)
         end

@@ -32,7 +32,7 @@

     def save_cache( cache_name, cache_object )
         return nil unless @cache_folder
-        File.open( cache_filename_for( cache_name ), 'w' ) do |f|
+        File.open( cache_filename_for( cache_name ), 'wb' ) do |f|
             f.puts Marshal.dump(cache_object)
         end
     end

Fixed in soks-testing

Edit this page or watch for changes using RSS.