Boost logo

Boost Users :

From: Brian Davis (bitminer_at_[hidden])
Date: 2008-06-08 16:59:22


I looked into this it looks as thought the issue is occuring in
collections_load_imp.hpp where the library version returned from
.get_library_version() does not return a value greater than 3.... or never
gets called. So in our case when loading a serialized vector item version
is never deserialized even though it is in the incoming message. I also had
one of our guys (my laptop died... long story) try calling
"set_library_version(unsigned int archive_library_version);" from
basic_iarchive on the archive such as ia.set_library_version(4) and I
believe this crashed the app with and exception. I will try this workaround
once my laptop is back as temporary work around for others until this gets
fixed may be a good alternative to a patch. Hopfully a fix will be there by
the time my laptop is resurrected.

inline void load_collection(Archive & ar, Container &s)
{
    s.clear();
    // retrieve number of elements
    collection_size_type count;
    unsigned int item_version;
    ar >> BOOST_SERIALIZATION_NVP(count);
    if(3 < ar.get_library_version())
        ar >> BOOST_SERIALIZATION_NVP(item_version);
    else
        item_version = 0;
...

Also of note from basic_iarchive ..

basic_iarchive::get_library_version() const{
    return pimpl->m_archive_library_version;
}

m_archive_library_version is set in the constructor of basic_iarchive_impl
..

    basic_iarchive_impl(unsigned int flags) :
        m_archive_library_version(ARCHIVE_VERSION()),

where ARCHIVE_VERSION is defined in basic_archive.cpp to to be 4

ARCHIVE_VERSION(){
    return 4;
}

That's about all I know about the issue. I am curious to see if calling
set_library_version on the archive before deserialization of the archive
occurs works for anyone.

Brian.

On Fri, Jun 6, 2008 at 12:55 PM, Johan Råde <rade_at_[hidden]> wrote:

> Johan Råde wrote:
> > I just ran some tests on Windows, and I can confirm the problem.
> > Here is output from serialization of an std::vector<X*>
> > where the class X has an empty serialization function.
> >
> > Boost 1.34.1:
> >
> > <v class_id="0" tracking_level="0" version="0">
> > <count>2</count>
> > <item_version>0</item_version>
> > <item class_id="1" tracking_level="1" version="0"
> object_id="_0"></item>
> > <item class_id_reference="1" object_id="_1"></item>
> > </v>
> >
> > Boost 1.35:
> >
> > <v class_id="0" tracking_level="0" version="0">
> > <count>2</count>
> > <item class_id="1" tracking_level="1" version="0"
> object_id="_0"></item>
> > <item class_id_reference="1" object_id="_1"></item>
> > </v>
> >
> > This is a *major problem* for us, because we will release a new version
> of our app soon.
> > The app has "Export" and "Import" functions that are implemented using
> Boost.Serialization.
> > It is required that files that have been exported with one version of our
> app
> > can be imported with a later version.
> >
> > Is there a patch for this problem yet?
> >
> > Thank you,
> > Johan Råde
>
> Does anyone know if the problem can be fixed by just replacing the file
> serialization/vector.hpp
> in Boost 1.35 with the Boost 1.34.1 version (but keeping the rest of 1.35)?
>
> --Johan
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net