Boost C++ Libraries: Ticket #4903: Serialization library in Boost 1.45 is unable to read archive created with Boost 1.39 https://svn.boost.org/trac10/ticket/4903 <p> The way the serialization library is handling object version and property information has obviously changed so that an attempt to read an archive with a simple object fails with version 1.45. </p> <p> The archive header is correctly read in (as opposed to 1.44) but an attempt to read a simple object fails because the version 1.45 is reading too much data. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4903 Trac 1.4.3 Rüdiger Brünner <rbruenner@…> Mon, 29 Nov 2010 09:39:04 GMT attachment set https://svn.boost.org/trac10/ticket/4903 https://svn.boost.org/trac10/ticket/4903 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">TestSerial.7z</span> </li> </ul> <p> The attached VS 2010 project demonstrates the problem </p> Ticket Rüdiger Brünner <rbruenner@…> Mon, 29 Nov 2010 09:48:45 GMT <link>https://svn.boost.org/trac10/ticket/4903#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:1</guid> <description> <p> Be sure to adjust the path to the boost library properly in the project settings before you build the solution. </p> <p> The project contains two archives, Test139.bin and Test145.bin. Run the programme and type "l" to load both archives. Test139.bin will fail to load. </p> <p> Maybe, the new version of the serialization library requires some setting for the class in question. Otherwise, I am stuck to version 1.39. </p> <p> Any help is appreciated. </p> <p> Best regards </p> </description> <category>Ticket</category> </item> <item> <author>keckmatd@…</author> <pubDate>Mon, 29 Nov 2010 14:29:27 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4903#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:2</guid> <description> <p> I'm suffering from the same issue, with the same results, i.e. simple objects are not read correctly. I'm coming from 1.38, but error manifests the same way. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Mon, 29 Nov 2010 15:51:51 GMT</pubDate> <title>component changed; owner set https://svn.boost.org/trac10/ticket/4903#comment:3 https://svn.boost.org/trac10/ticket/4903#comment:3 <ul> <li><strong>owner</strong> set to <span class="trac-author">Robert Ramey</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">serialization</span> </li> </ul> Ticket Robert Ramey Mon, 29 Nov 2010 20:44:08 GMT <link>https://svn.boost.org/trac10/ticket/4903#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:4</guid> <description> <p> Is this the 1.45 beta or official release. I think I got a change into late for the beta but that it made it into the release? </p> <p> Robert Ramey </p> </description> <category>Ticket</category> </item> <item> <author>keckmatd@…</author> <pubDate>Mon, 29 Nov 2010 20:45:44 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4903#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:5</guid> <description> <p> I can verify this as of today, with 1.45 release also downloaded from the site today. </p> </description> <category>Ticket</category> </item> <item> <author>keckmatd@…</author> <pubDate>Mon, 29 Nov 2010 21:34:35 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4903#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:6</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/4903#comment:5" title="Comment 5">keckmatd@…</a>: </p> <blockquote class="citation"> <p> I can verify this as of today, with 1.45 release also downloaded from the site today. </p> </blockquote> <p> I can verify this is still a problem, rather, with 1.45 official release. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Mon, 29 Nov 2010 22:47:29 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4903#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:7</guid> <description> <p> how about sending a small file which you're having trouble with. I would like to know if the problem is when one reads the header, or some other part further down in the file </p> <p> Robert Ramey </p> </description> <category>Ticket</category> </item> <item> <author>Rüdiger Brünner <rbruenner@…></author> <pubDate>Tue, 30 Nov 2010 06:52:37 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4903#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:8</guid> <description> <p> Please find the attached project <a class="missing wiki">TestSerial</a>.7z. It contains two binary files, Test139.bin which was created using version 1.39, and Test145.bin created using 1.45. It is currently configured to use the 1.45 version. When the Test139.bin file is loaded, the preamble is read correctly. The version number 5 is determined and the magic values for sizeof(int) etc. are loaded correctly. However, the new version reads too much bytes for the object header. The first item to load is a string. Its string length (32 bit) is composed of the last byte of the actual string length and the first three bytes of the string. </p> </description> <category>Ticket</category> </item> <item> <author>Rüdiger Brünner <rbruenner@…></author> <pubDate>Tue, 30 Nov 2010 06:56:55 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/4903 https://svn.boost.org/trac10/ticket/4903 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">Serialisation #4903.pdf</span> </li> </ul> <p> Demonstration of binary layout differences causing the problem </p> Ticket keckmatd@… Mon, 13 Dec 2010 18:05:54 GMT <link>https://svn.boost.org/trac10/ticket/4903#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:9</guid> <description> <p> Is there any status update on this? I realize everyone is probably busy, but this is a pretty big showstopper for those of us stuck at earlier versions. </p> <p> If I can be of any help, although I'm seeing the same thing Rüdiger is seeing, please let me know. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Sat, 18 Dec 2010 23:20:23 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4903#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:10</guid> <description> <p> I've been struggling with this. Here is the output from test_simple in xml format </p> <pre class="wiki">&lt;?xml version="1.0" encoding="UTF-8" standalone="yes" ?&gt; &lt;!DOCTYPE boost_serialization&gt; &lt;boost_serialization signature="serialization::archive" version="8"&gt; &lt;a class_id="0" tracking_level="0" version="0"&gt; &lt;b&gt;1&lt;/b&gt; &lt;f&gt;757147&lt;/f&gt; &lt;g&gt;167851000&lt;/g&gt; &lt;l&gt;2&lt;/l&gt; &lt;m&gt;15724&lt;/m&gt; &lt;n&gt;11478&lt;/n&gt; &lt;o&gt;29358&lt;/o&gt; &lt;p&gt;26962&lt;/p&gt; &lt;q&gt;24464&lt;/q&gt; &lt;r&gt;5705&lt;/r&gt; &lt;c&gt;-15&lt;/c&gt; &lt;s&gt;-15&lt;/s&gt; &lt;t&gt;187&lt;/t&gt; &lt;u&gt;9961&lt;/u&gt; &lt;v&gt;491&lt;/v&gt; &lt;w&gt;2995&lt;/w&gt; &lt;x&gt;11942&lt;/x&gt; &lt;y&gt;uirxnrvpfehwtrbifmqaylbxblotupkjewsfcgbupvdkwfravemvnrnfpnuxlk&lt;/y&gt; &lt;z&gt;n&lt;/z&gt; &lt;/a&gt; &lt;/boost_serialization&gt; </pre><p> I've looked carefully at Serialisation <a class="new ticket" href="https://svn.boost.org/trac10/ticket/4903" title="#4903: Bugs: Serialization library in Boost 1.45 is unable to read archive created ... (new)">#4903</a>.pdf and see you're comments - this is very helpful. BUT there are several possible alternative explanations: </p> <p> Either class_id, tracking_level or version expanded from on byte to 4 bytes. My suspicion is that the culprit is tracking_level. The whole problem came about when I tweaked some types to eliminate some warnings. This changed the size of these types which then changed the archive format. This looks easy now, but the whole issue was obscured by a number of things like implicit conversions. Turns out that I never touched tracking_type. And there is confusing point on this as well. The type trait is an enum of 3 values - the usage in the file is bool - indicated whether that particular type has been tracked in that file. So I believe that something is mixed up here - unfortunately it's very, very hard to pin down since i can't build archives in older formats without re-installing and building old library versions. </p> <p> So at this moment I'm stuck - I don't know if this makes anyone feel better, but there it is. </p> <p> Robert Ramey </p> </description> <category>Ticket</category> </item> <item> <author>Rüdiger Brünner <rbruenner@…></author> <pubDate>Tue, 21 Dec 2010 08:20:58 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/4903 https://svn.boost.org/trac10/ticket/4903 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">TestSerial versioned.zip</span> </li> </ul> <p> Updated with a version number </p> Ticket Rüdiger Brünner <rbruenner@…> Tue, 21 Dec 2010 08:34:31 GMT <link>https://svn.boost.org/trac10/ticket/4903#comment:11 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:11</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/4903#comment:10" title="Comment 10">ramey</a>: </p> <blockquote class="citation"> <p> I've been struggling with this. Here is the output from test_simple in xml format </p> </blockquote> <p> Thanks for looking into the issue. However, I believe that it is the version number which has got expanded to 4 bytes. I have attached two new binary files with the same structure, both in 1.39 and 1.45. The object has now the version number 37 (0x25). In the binary file, it can be clearly seen that the version number is stored in 4 bytes in version 1.45. When reading an archive created with 1.39 the library, although it read the archive version 5 correctly, wrongly assumes to be able to read a 4-byte version number instead of a 1-byte number (as stored by 1.39). I think it is necessary to split the version number reading function based on the archive version number. For archives up to 1.39 (or 1.40 or so) it must read only one byte, newer archives must read 4 bytes. </p> <p> Rüdiger </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Thu, 23 Dec 2010 20:55:11 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4903#comment:12 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:12</guid> <description> <p> looking your PDF file </p> <p> In BOTH versions the version # is in position 0x1a. In the 1.39 version it's equal to 0x05 and in the 1.45 version it's equal to 0x08. This is what I expect. In 1.39 the version # is just one byte while in 1.45 it's two bytes (0x0800). Then come the sizes of the types. In both cases it's 0x04 0x04 0x04 0x08 0x01. Then on 1.39 it's followed by 5 x 0x00 while in 1.4 it's followed by 8 x 0x00. This is after the header has been processed. On my test file, this number is the boolean flag. In 1.39 this is one byte while on 1.45 this is one byte. I believe this is the error. </p> <p> Robert Ramey </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Thu, 23 Dec 2010 22:40:13 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4903#comment:13 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:13</guid> <description> <p> I've updated the trunk in an attempt to fix this problem. Please check this out and let me know if it addresses the situation. </p> <p> Robert Ramey </p> </description> <category>Ticket</category> </item> <item> <author>keckmatd@…</author> <pubDate>Tue, 11 Jan 2011 14:47:03 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4903#comment:14 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:14</guid> <description> <p> After rebuilding from the trunk with your latest patch, Mr. Ramey, I am still seeing the problem with archives before 1.42 not being able to be consumed properly. I am most definitely still seeing the problem in the header. I will try to see if I'm still seeing the problem in the same way as before when I have a moment. </p> <p> But, regardless, for me at least, this has not remedied the issue for older archives. If it makes a difference, I'm running on MSVC 9.0. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Sun, 23 Jan 2011 02:50:04 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4903#comment:15 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:15</guid> <description> <p> OK - looks like you're on to something here. I'm testing the following now: </p> <pre class="wiki"> void load_override(class_id_type &amp; t, int version){ library_version_type lvt = this-&gt;get_library_version(); if(boost::archive::library_version_type(7) &lt; lvt){ this-&gt;detail_common_iarchive::load_override(t, version); } else if(boost::archive::library_version_type(6) &lt; lvt){ int_least16_t x=0; * this-&gt;This() &gt;&gt; x; t = boost::archive::class_id_type(x); } else if(boost::archive::library_version_type(3) &lt; lvt){ { int x=0; * this-&gt;This() &gt;&gt; x; t = boost::archive::class_id_type(x); } else{ // upto 255 versions unsigned char x=0; * this-&gt;This() &gt;&gt; x; t = version_type(x); } } </pre><p> This should be a more general solution. </p> <p> Robert Ramey </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Sun, 23 Jan 2011 03:22:00 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4903#comment:16 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:16</guid> <description> <p> Whoops - ignore the above - I meant to paste that into a different track item. </p> <p> I'm testing another change. It should be in the trunk by monday. </p> <p> Robert Ramey </p> </description> <category>Ticket</category> </item> <item> <author>Rüdiger Brünner <rbruenner@…></author> <pubDate>Fri, 25 Feb 2011 15:43:12 GMT</pubDate> <title>version changed https://svn.boost.org/trac10/ticket/4903#comment:17 https://svn.boost.org/trac10/ticket/4903#comment:17 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.45.0</span> → <span class="trac-field-new">Boost 1.46.0</span> </li> </ul> Ticket Rüdiger Brünner <rbruenner@…> Fri, 25 Feb 2011 15:44:50 GMT <link>https://svn.boost.org/trac10/ticket/4903#comment:18 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:18</guid> <description> <p> Hello Robert, </p> <p> thank you for looking into the issue. Now, it seems that serialising objects is working. However, serialisation through pointers crashes the app. </p> <p> I am going to attach a VS 2010 project that shows the issue with Boost 1.46. </p> <p> Rüdiger </p> </description> <category>Ticket</category> </item> <item> <author>Rüdiger Brünner <rbruenner@…></author> <pubDate>Fri, 25 Feb 2011 15:45:59 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/4903 https://svn.boost.org/trac10/ticket/4903 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">TestSerial.2.7z</span> </li> </ul> <p> Sample project showing the issue </p> Ticket Rüdiger Brünner <rbruenner@…> Fri, 25 Feb 2011 15:49:53 GMT <link>https://svn.boost.org/trac10/ticket/4903#comment:19 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:19</guid> <description> <p> Hello Robert, </p> <p> the attached project can be compiled using different versions of boost by changing the Boost.props file. </p> <p> When the app is built with ver 1.39 it can successfully read the included file 0.ref which was created using 1.39. However, building with 1.46 crashes the app. The serialisation of the plain object works now, but serialising through a pointer aborts the app. </p> <p> Any suggestions? </p> <p> Rüdiger </p> </description> <category>Ticket</category> </item> <item> <author>keckmatd@…</author> <pubDate>Fri, 04 Mar 2011 14:39:32 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4903#comment:20 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:20</guid> <description> <p> Robert, </p> <p> I can again confirm that I am seeing the same problem as Rüdiger. If we can be of any help to solving this, let us know. This is most definitely a showstopper for us moving forward to a different boost version without resorting to something like converting massive amounts of saved archives in a tool that reads the information as 1.38 archives and writes them back out as 1.46 archives. </p> <p> Thanks, Matthew </p> </description> <category>Ticket</category> </item> <item> <author>keckmatd@…</author> <pubDate>Wed, 28 Sep 2011 14:23:29 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4903#comment:21 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:21</guid> <description> <p> Robert, </p> <p> Any update on this? We are literally stuck almost ten versions behind now in boost. We'd like to get away from the old archives and move forward, but it's just something at this point we can't migrate away from. </p> <p> Thanks, Matthew </p> </description> <category>Ticket</category> </item> <item> <author>Rüdiger Brünner <rbruenner@…></author> <pubDate>Thu, 17 Nov 2011 08:43:24 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4903#comment:22 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:22</guid> <description> <p> Hello all, </p> <p> just FYI, I downloaded version 1.48 today and built the <a class="missing wiki">TestSerial</a> project with this version. Unfortunately, the behaviour is the same as in 1.46. So, the issue is still unresolved. </p> <p> Rüdiger </p> </description> <category>Ticket</category> </item> <item> <author>Rüdiger Brünner <rbruenner@…></author> <pubDate>Thu, 17 Nov 2011 12:25:03 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/4903 https://svn.boost.org/trac10/ticket/4903 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">AltSerial.7z</span> </li> </ul> <p> Ripped stand-alone serialization library </p> Ticket Rüdiger Brünner <rbruenner@…> Thu, 17 Nov 2011 12:38:58 GMT <link>https://svn.boost.org/trac10/ticket/4903#comment:23 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4903#comment:23</guid> <description> <p> Hello, </p> <p> please find the attached <a class="missing wiki">AltSerial</a>.7z file. It contains an MSVC library project of the 1.39 serialization library. I have renamed the namespaces to boost::alt_serialization and boost::alt_archive, respectively. In a preliminary test, using this library, I was able to load my old archives in a test project which is otherwise using boost 1.48. It is important to a) replace all occurrences of the old namespaces in the client code with alt_serialization and alt_archive, respectively. b) pay attention that the headers of the <a class="missing wiki">AltSerial</a> library must go BEFORE including any of the other boost includes. This will effectively hide the 1.48 headers from client code. The names of the header files (as well as their include guards) are the same as in boost, so it is sufficient to e. g. change the statement </p> <pre class="wiki">#include &lt;boost/serialization/export.hpp&gt; </pre><p> to </p> <pre class="wiki">#include "serialization/export.hpp" </pre><p> (note the dropping of the boost folder name and the usage of quotation marks). </p> <p> Maybe, this information is of help for anyone having trouble with the binary serialization. </p> <p> Please note that I did not fully test the library yet. You may use it as a starting point for your own evaluations. </p> <p> Best regards Rüdiger </p> </description> <category>Ticket</category> </item> </channel> </rss>