Boost logo

Boost :

Subject: Re: [boost] [Serialization] Bizarre bug
From: Jarl Lindrud (jarl.lindrud_at_[hidden])
Date: 2009-08-05 07:05:30


Jarl Lindrud <jarl.lindrud <at> gmail.com> writes:

>
>
> Robert Ramey <ramey <at> rrsd.com> writes:
>
> > ar >> ptr isn't. I'll look into it. For now you could work around this by
> > a) including more dummy code.
> > b) removing the dummy code
> > c) explicitly setting tracking for the type to track_alwyas or track_never.
> >
> > Robert Ramey
>
> Thanks Robert.
>
> I've entered the issue into trac:
>
> https://svn.boost.org/trac/boost/attachment/ticket/3315/
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
>

I see this issue has now been closed, without a fix.

In my view it's a pretty serious bug, that this code:

    std::vector<char> v0(25, 'A');
    std::vector<char> v1;

    std::ostringstream ostr;
    boost::archive::text_oarchive(ostr) & v0;

    std::istringstream istr(ostr.str());
    boost::archive::text_iarchive(istr) & v1;
    
    bool ok = (v0 == v1);

, will fail, because of implicit compile-time instantiation in a completely
different part of the program. For the typical user, this is next to impossible
to diagnose, let alone understand. I guess I don't see how this can be thought
of as a design feature.

I would have thought it would be possible to include sufficient metadata in the
output archive, so that B.Ser. is able to correctly deserialize its own output
archives, without depending on implicit compile-time instantiation. Sure, that
would change the archive format, but it would hardly be the first such change,
so I would think whatever backwards compatibility scheme is already in place,
could deal with this as well.

Hope that makes some sense - I don't know very much about B.Ser. internals.

Thanks,
Jarl.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk