Boost C++ Libraries: Ticket #8088: Limited Forward Compatibility https://svn.boost.org/trac10/ticket/8088 <p> We use xml serialization for saving and loading several types of metadata and we have to support possibility of reading new versions of files with old versions of soft. Boost::serialization is very good at backward compatibility but does not provide anything with opposite problem. </p> <p> So, This patch introduces new flag boost::archive::skip_unknown_tail_tags. When this flag is set and basic_xml_iarchive is faced with unknown tags at the end of element it will skip them (include nested). E.g., the first version of some file was: </p> <pre class="wiki">&lt;Test class_id="0" tracking_level="0" version="0"&gt; &lt;a&gt;31&lt;/a&gt; &lt;t2 class_id="1" tracking_level="0" version="0"&gt; &lt;a&gt;11&lt;/a&gt; &lt;b&gt;12&lt;/b&gt; &lt;/t2&gt; &lt;b&gt;32&lt;/b&gt; &lt;/Test&gt; </pre><p> After a while, the second version could be: </p> <pre class="wiki">&lt;Test class_id="0" tracking_level="0" version="0"&gt; &lt;a&gt;31&lt;/a&gt; &lt;t2 class_id="1" tracking_level="0" version="1"&gt; &lt;a&gt;11&lt;/a&gt; &lt;b&gt;12&lt;/b&gt; &lt;c&gt;13&lt;/c&gt; &lt;d&gt;14&lt;/d&gt; &lt;t1 class_id="2" tracking_level="0" version="0"&gt; &lt;a&gt;1&lt;/a&gt; &lt;b&gt;2&lt;/b&gt; &lt;/t1&gt; &lt;/t2&gt; &lt;b&gt;32&lt;/b&gt; &lt;/Test&gt; </pre><p> Therefore, if the first version software set skip_unknown_tail_tags it can read second version of file (if does not set then exception will be thrown). </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8088 Trac 1.4.3 Dmitry Shesterkin <dfb@…> Sun, 17 Feb 2013 15:33:29 GMT attachment set https://svn.boost.org/trac10/ticket/8088 https://svn.boost.org/trac10/ticket/8088 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">skip_unknown_tail_tags.patch</span> </li> </ul> Ticket anonymous Sat, 20 Jun 2015 00:26:38 GMT <link>https://svn.boost.org/trac10/ticket/8088#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8088#comment:1</guid> <description> <p> Does anyone know when or if this patch will be accepted? We use boost to serialize classes for transmitting over CORBA and have just now run into the problem where a newer client application is sending a version 1 buffer to an older version of the server which causes an exception to be raised upon de-serialization. This patch seems like it would solve our problem. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Sat, 20 Jun 2015 00:36:16 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8088#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8088#comment:2</guid> <description> <p> well, this patch wouldn't change the behavior of the "older server" You'd have to upgrade that to include the new functionality. But then if you upgrade the server, you won't have the problem any more. </p> <p> Never the less, I'll take a look at this. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Sat, 20 Jun 2015 00:50:32 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8088#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8088#comment:3</guid> <description> <p> Yes it is an interesting situation, but it would at least prevent the problem from arising again which is another concern. </p> <p> Thanks for looking into it. </p> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/8088#comment:2" title="Comment 2">ramey</a>: </p> <blockquote class="citation"> <p> well, this patch wouldn't change the behavior of the "older server" You'd have to upgrade that to include the new functionality. But then if you upgrade the server, you won't have the problem any more. </p> <p> Never the less, I'll take a look at this. </p> </blockquote> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 17 Aug 2016 14:18:42 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8088#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8088#comment:4</guid> <description> <p> Does anyone know if this patch has get into the codebase? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 17 Aug 2016 14:18:45 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8088#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8088#comment:4</guid> <description> <p> Does anyone know if this patch has get into the codebase? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 17 Aug 2016 14:18:47 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8088#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8088#comment:4</guid> <description> <p> Does anyone know if this patch has get into the codebase? </p> </description> <category>Ticket</category> </item> <item> <author>Dmitry Shesterkin <dfb@…></author> <pubDate>Mon, 05 Sep 2016 21:53:49 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8088#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8088#comment:5</guid> <description> <p> No, it hasn't. The current archive_flags enum doesn't contain <strong>skip_unknown_tail_tags</strong> <a class="ext-link" href="https://github.com/boostorg/serialization/blob/develop/include/boost/archive/basic_archive.hpp#L237"><span class="icon">​</span>https://github.com/boostorg/serialization/blob/develop/include/boost/archive/basic_archive.hpp#L237</a> You can apply this patch locally and rebuild the library. </p> <blockquote> <p> <strong>ramey</strong>, does patch have any issues? I'm happy to change it according to your concerns. Also, it doesn't change a library behavior if the flag is not set </p> </blockquote> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/8088#comment:4" title="Comment 4">anonymous</a>: </p> <blockquote class="citation"> <p> Does anyone know if this patch has get into the codebase? </p> </blockquote> </description> <category>Ticket</category> </item> <item> <author>Paresh Varshney <pareshvarshney@…></author> <pubDate>Tue, 04 Apr 2017 12:53:04 GMT</pubDate> <title>cc set https://svn.boost.org/trac10/ticket/8088#comment:6 https://svn.boost.org/trac10/ticket/8088#comment:6 <ul> <li><strong>cc</strong> <span class="trac-author">pareshvarshney@…</span> added </li> </ul> <p> Does boost supports (if this made it to actual boost code) this for binary archives? </p> Ticket sena@… Mon, 27 Nov 2017 10:56:08 GMT <link>https://svn.boost.org/trac10/ticket/8088#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8088#comment:7</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/8088#comment:6" title="Comment 6">Paresh Varshney &lt;pareshvarshney@…&gt;</a>: </p> <blockquote class="citation"> <p> Does boost supports (if this made it to actual boost code) this for binary archives? </p> </blockquote> <p> This will not be possible without 2 significant modifications: </p> <ol><li>Store the name of the field in binary_oarchive, like it is done in xml_oarchive. This way binary_iarchive will be able to identify new fields. </li><li>Store the size of the field in binary_oarchive, this way binary_iarchive will know how many bytes it should skip. </li></ol><p> I created experimental archive which supports forward compatibility. It stores output in boost::property_tree::ptree, which can be serialized to json. Here is the link <a class="ext-link" href="https://github.com/sena73/ptree_archive"><span class="icon">​</span>https://github.com/sena73/ptree_archive</a> </p> </description> <category>Ticket</category> </item> </channel> </rss>