[squeak-dev] [error] DateAndTime changes produce different result on #readFrom:

David T. Lewis lewis at mail.msen.com
Tue Mar 3 02:10:58 UTC 2020


Hi Robert,

It may also be helpful to look at the 'objects from disk' methods
in DateAndTime. These are designed to address the problem of storing
instances of the new DateAndTime representation in an external format
that is completely compatible with the original implementation.

I did something similar for the Fuel serializer, so I am confident
that the general approach is valid. The basic idea is to always use
the old instance variable format (four instance variables) for externally
stored data, and read the old format data into the new format (two
instance variables) when loading back into the image. I also did an
implementation for the Magma serializer to store DateAndTime for the
Magma framework, which proved to be unnecessary for Magma requirements,
but which works similarly to the DataStream and Fuel serializers.

I have not looked at the Cryptography tests but as Marcel says, if
the tests are relying on the internal representation of DateAndTime,
then those tests will need to be updated. The 'objects from disk'
methods hopefully will provide guidance as to how map the instance
variables from one format to the other.

Specifically, the two methods to look at are:

  DateAndTime>>readDataFrom:size:
  DateAndTime>>storeDataOn:

HTH,

Dave

On Mon, Mar 02, 2020 at 06:48:11PM +0100, Marcel Taeumel wrote:
> Hi, there.
> 
> The internal representation of DateAndTime changed from
> 
> seconds
> offset
> jdn
> nanos
> 
> in Squeak 5.2 to this in 5.3:
> 
> utcMicroseconds
> localOffsetSeconds
> 
> ---
> 
> If tests in "Cryptography" relied on the internal representation of DateAndTime, those tests have to be adapted. Looking at ASN1Test >> #testUTCTime, this is the case:
> 
> testUTCTime
> 
> | bytes obj testObj newBytes |
> bytes := #[23 13 48 55 48 51 50 50 49 53 53 56 49 55 90].
> testObj := DateAndTime fromString: '2007-03-22T15:58:17+00:00'.
> obj := ASN1InputStream decodeBytes: bytes.
> self assert: (obj = testObj).
> newBytes := ASN1OutputStream encode: testObj.
> self assert: (bytes asByteArray = newBytes).
> newBytes := ASN1OutputStream encode: obj.
> self assert: (bytes asByteArray = newBytes).
> 
> The "bytes" are different for (encoded) instances of DateAndTime in Squeak 5.3.
> 
> Best,
> Marcel
> Am 02.03.2020 18:31:51 schrieb Robert via Squeak-dev <squeak-dev at lists.squeakfoundation.org>:
> In truth, this is an issue with incomplete DateAndTime testing. As there
> are resulting differences, this ought to be tested?? and modified in the
> package containing the core DateAndTime definition and NOT an override
> in the Cryptography package. I do not know who owns DateAndTime. I will
> continue to slowly dig into the issue..
> 
> K, r
> 
> On 3/2/20 12:23 PM, Robert wrote:
> > In calling this method:
> >
> > DateAndTime fromString: '2007-03-22T15:58:17+00:00'.
> >
> > The results in 5.3 are different than in 5.2. This is breaking 2
> > ASN1Tests and 2 X509Tests. I am still in analysis of the decoding
> > differences. The methods between the two versions are completely
> > different. This breaks Cryptography.
> >
> > K, r
> >
> 
> 

> 



More information about the Squeak-dev mailing list