Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

marshal data too short error when reading cache file on Windows with 0.34.1 #2241

Closed
cboos opened this issue Sep 12, 2015 · 1 comment
Closed
Assignees

Comments

@cboos
Copy link

cboos commented Sep 12, 2015

The fix for #2213 (7122c50) was not complete: the cache is now written as "binary" but is not read as "binary" which will be a problem on Windows.

After upgrading to 0.34.1:

...
Inheriting configuration from c:/Dev/ruby193/lib/ruby/gems/1.9.1/gems/rubocop-0.34.1/config/disabled.yml


0 files inspected, no offenses detected
marshal data too short
c:/Dev/ruby193/lib/ruby/gems/1.9.1/gems/rubocop-0.34.1/lib/rubocop/result_cache.rb:23:in `load'
...

The fix is simple enough I don't think it's worth creating a pull request:

--- result_cache.rb-0.34.1  Sat Sep 12 14:33:57 2015
+++ result_cache.rb Sat Sep 12 14:34:07 2015
@@ -20,7 +20,7 @@
     end

     def load
-      Marshal.load(IO.read(@path))
+      Marshal.load(IO.binread(@path))
     end

     def save(offenses, disabled_line_ranges, comments)
@jonas054
Copy link
Collaborator

Sorry about that. I'll create a pull request. It's worth it.

@jonas054 jonas054 self-assigned this Sep 12, 2015
bbatsov added a commit that referenced this issue Sep 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants