Boost C++ Libraries: Ticket #5567: boost serialization 1_46_1 incompatible with prior versions due to backwards comparison https://svn.boost.org/trac10/ticket/5567 <p> Archive's writing class_id_type between 1_41 &lt;and prior&gt; and being read back in 1_46 will fail. </p> <p> basic_binary_iarchive.hpp line 104 in 1_46 is "if(boost::archive::library_version_type(6) &lt; lvt){" </p> <p> Or 6 &lt; lvt which is lvt &gt;= 7, and because the if before it is 7 &lt; lvt, its essentially lvt == 7. </p> <p> So if the version is 7 serialize in a 16 bit integer, else versions 1 through 6 serialize in a 32 bit integer. </p> <p> The problem here is this is backwards. Version 1-6 are 16 bit, 7 might have been 32bit (because of issues in 1_42/1_43). </p> <p> The code needs to be swapped (assuming consistency throughout the file is to remain). </p> <p> tracking_type also appears to have the same issue (although it seems to be ok) </p> <p> version_type I don't get at all, going back through the basic_binary_iarchive.hpp's I don't see how the code is right at all. Anything less than version 7 should be serializing a 8 bit int from what I can tell. </p> <p> Prior versions can be viewed at: <a href="http://www.boost.org/doc/libs/1_44_0/libs/serialization/src/basic_archive.cpp">http://www.boost.org/doc/libs/1_44_0/libs/serialization/src/basic_archive.cpp</a> <a href="http://www.boost.org/doc/libs/1_41_0/libs/serialization/src/basic_archive.cpp">http://www.boost.org/doc/libs/1_41_0/libs/serialization/src/basic_archive.cpp</a> <a href="http://www.boost.org/doc/libs/1_40_0/libs/serialization/src/basic_archive.cpp">http://www.boost.org/doc/libs/1_40_0/libs/serialization/src/basic_archive.cpp</a> ... </p> <p> Library versions can be viewed at: <a href="http://www.boost.org/doc/libs/1_44_0/boost/archive/basic_binary_iarchive.hpp">http://www.boost.org/doc/libs/1_44_0/boost/archive/basic_binary_iarchive.hpp</a> <a href="http://www.boost.org/doc/libs/1_41_0/boost/archive/basic_binary_iarchive.hpp">http://www.boost.org/doc/libs/1_41_0/boost/archive/basic_binary_iarchive.hpp</a> <a href="http://www.boost.org/doc/libs/1_40_0/boost/archive/basic_binary_iarchive.hpp">http://www.boost.org/doc/libs/1_40_0/boost/archive/basic_binary_iarchive.hpp</a> ... </p> <p> Side Note: IMHO writing code such as 6 &lt; lvt is extremely unintuitive and backwards of how most people think. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5567 Trac 1.4.3 Phil Hartmann <phil.hartmann82@…> Thu, 26 May 2011 11:39:15 GMT <link>https://svn.boost.org/trac10/ticket/5567#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5567#comment:1</guid> <description> <p> Sorry, I had cleaned this up a bit but copied the wrong version in here, was the 5th time submitting this ticket because it kept being rejected as spam. </p> <p> The versions/library versions are backwards. And on tracking_type I meant 'it seems to work for some cases, but is still inverse of what it should be' </p> </description> <category>Ticket</category> </item> <item> <author>monsta@…</author> <pubDate>Wed, 27 Jul 2011 07:56:03 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5567#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5567#comment:2</guid> <description> <p> The code looks the same in 1.47, so I guess it hasn't been fixed yet. One of my projects is using 1.41 (historical reasons, you know...) and looks like it's still too early to upgrade. </p> <p> Maybe a big fat warning (with links to all the major bugs like <a class="ext-link" href="https://svn.boost.org/trac/boost/ticket/4660"><span class="icon">​</span>this one</a>) should be added to the <a href="http://www.boost.org/doc/libs/release/libs/serialization/doc/release.html">release notes</a>... </p> </description> <category>Ticket</category> </item> <item> <author>Phil Hartmann <phil.hartmann82@…></author> <pubDate>Thu, 28 Jul 2011 19:43:14 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5567#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5567#comment:3</guid> <description> <p> monsta, </p> <p> I created a patch for 1.46_1 in hopes to get it into 1.47 but I got it pretty late in the game. The patch here seems pretty stable, if your feeling adventurous maybe you can try the patch and see if it works and add to the thread. Or let me know if there are more issues that it doesnt fix. </p> <p> <a class="ext-link" href="https://svn.boost.org/trac/boost/ticket/5579"><span class="icon">​</span>https://svn.boost.org/trac/boost/ticket/5579</a> </p> </description> <category>Ticket</category> </item> <item> <author>gtsml.owevwr@…</author> <pubDate>Sun, 20 Nov 2011 10:42:25 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5567#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5567#comment:4</guid> <description> <p> Phil, </p> <p> FYI, I tried your patch on 1.48 and this is working: I can load both binary generated by 1.39 and 1.48. </p> <p> Frank </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Sat, 09 Nov 2013 08:24:11 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5567#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5567#comment:5</guid> <description> <p> why this patch is still not accepted? is the library unmaintained? should we elect a new maintainer? </p> </description> <category>Ticket</category> </item> </channel> </rss>