M
mla mla
It seems that when you marshal hashes the binary representations aren't
stable.
This is an issue with PStore because it uses the md5 of the marshaled
data to decide whether it's changed and whether a disk write is needed.
Perl's serialization module, Storable, has a $Storable::canonical option
which, if true, sorts the keys of hashes. Would it be reasonable to add
such an option to Marshal?
I read that Ruby 1.9 will have ordered hashes. So maybe that will make
the issue moot?
Script that illustrates the issue:
http://mla.homeunix.com/tmp/marshal-test.rb
Output that I see:
http://mla.homeunix.com/tmp/marshal-test.txt
ruby 1.8.6 (2007-11-18 patchlevel 5000) [i686-linux]
stable.
This is an issue with PStore because it uses the md5 of the marshaled
data to decide whether it's changed and whether a disk write is needed.
Perl's serialization module, Storable, has a $Storable::canonical option
which, if true, sorts the keys of hashes. Would it be reasonable to add
such an option to Marshal?
I read that Ruby 1.9 will have ordered hashes. So maybe that will make
the issue moot?
Script that illustrates the issue:
http://mla.homeunix.com/tmp/marshal-test.rb
Output that I see:
http://mla.homeunix.com/tmp/marshal-test.txt
ruby 1.8.6 (2007-11-18 patchlevel 5000) [i686-linux]