Marshal format changed between 4.06 and 4.10?

I understand that there is no such guarantee that Marshal is stable across versions, so this is just questions for learning purpose, it is not request for changes.

Currently, I have some marshalled generated in 4.10.2 and feed to 4.06, I got a runtime exception:

Fatal error: exception Failure("input_value: ill-formed message")

The binary diff for marshalled output between 4.06 and 4.10 looks like this:

  • under 4.06
(* Map *)"\132\149\166\190\000\000L\184\000\000\020z\000\000C^\000\000B\218\160\144\176$Make\144\160\160A@@\144\148\192A\160\176\001\006\171&funarg@@\197B\176\001\007\171&height@\148\192A\160\176\001\007\172%param@@\189\144\004\004\151\176\161D\147!h\160\004\007@\176\192&_none_A@\000\255\004\002A\146\160\018_i
  • under 4.10
(* Map *)"\132\149\166\190\000\000L\184\000\000\020z\000\000C^\000\000B\218\160\144\176$Make\144\160\160A@@\144\148\192A\160\176\001\006\171&funarg@@\197B\176\001\007\171&height@\148\192A\160\176\001\007\172%param@@\189\144\004\004\151\176\161D\147!h\160\004\007@\176\192&_none_A@\000\255\004\002A\146\160\025_i

So you can see that \018 is turned into \025 and it seems that 4.06 can not consume data generated from 4.10, I have not tested the other direction.

Thanks – Hongbo

The marshalling of Custom_tag objects (such as Nativeint, Int32, Int64) changed in 4.08 (ocaml#1683). I don’t know of other changes.


that’s good to know, thanks!

While this isn’t a guarantee, in practise the other direction should work (4.10 should be able to consume the 4.06 marshalled output).

1 Like