Re: Trouble with Marshal

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:

#=> “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” ‘desc.marshal’, ‘w+’ ){ |f| f << Marshal.dump( s1 ) }

s2 = Marshal.load( ‘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