# Re: Trouble with Marshal

**URL:** <https://www.ruby-forum.com/t/re-trouble-with-marshal/73778>\
**Category:** Ruby\
**Created:** [October 26, 2006, 11:41pm UTC](https://www.ruby-forum.com/t/re-trouble-with-marshal/73778 "2006-10-26T23:41:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [October 26, 2006, 11:41pm UTC](https://www.ruby-forum.com/t/re-trouble-with-marshal/73778/1 "2006-10-26T23:41:00Z")

</div>

From: Gavin K.

> I’m trying to use Marshal on Windows to cache some results that take a  
> while to generate, and I’m getting some bad results.

It took less time than I thought to bring it down to a simple,  
reproducible, moderately sanitized case:

p VERSION, PLATFORM  
#=\> “1.8.5”  
#=\> “i386-mswin32”

s1 = “Change 35573 by fred.joomblie@PD133 on 2006/09/26 11:58:21\n\n\t”  
+  
“Clear scene method to empty the XXXX display on File-\>New\n\n” +  
“Affected files …\n\n…  
//Dev03/Main/AnarkCore/Cxxxxxxxxxxxxxxxxx” +  
“/Cxxxxxxxx.cs#47 edit\n… //Dev03/Main/AnarkCore/Renderxxxx/” +  
“Scenexxxx.cpp#6 edit\n… //Dev03/Main/AnarkCore/Renderxxxx/” +  
“Scenexxxx.h#7 edit\n…  
//Dev03/Main/AnarkCore/RenderxxxxUnitTest/” +  
“RenderxxxxTestRunner.cs#7 edit\n… //Dev03/Main/AnarkCore/” +  
“RenderToolkit/Interfaces/IScene.cs#8 edit\n… //Dev03/Main/” +  
“AnarkCore/RenderToolkit/RenderController.cs#7 edit\n\n”

File.open( ‘desc.marshal’, ‘w+’ ){ |f| f \<\< Marshal.dump( s1 ) }

s2 = Marshal.load( IO.read( ‘desc.marshal’ ) )  
#=\> foo.rb:13:in `load’: marshal data too short (ArgumentError)

The data bug(?) seems to be very fragile. If I change ‘joomblie’ to  
‘jomblie’ in the string, for example, it works. There were also some  
parts of the string that I couldn’t ‘x’ out because changing (for  
example) a particular ‘C’ to ‘x’ made it stop failing.

Can someone on (a) Windows, and (b) another platform please try the  
above out to see if this is a problem on all platforms, just windows, or  
(perhaps) just my machine? You should know it worked if s1==s2
