theseion / Fuel

Fuel, the Smalltalk object serializer
https://theseion.github.io/Fuel
MIT License
26 stars 12 forks source link

Rescuing Data in Fuel v. 194 format #261

Closed seandenigris closed 2 years ago

seandenigris commented 2 years ago

I'm putting this here for posterity. I needed to load fuel v. 1.9.4 data in P9.

Here are the steps I followed, which seem to have worked:

  1. Start with a Moose 8 64-bit image (the data's project depended on Moose)
  2. Downgrade Fuel to 1.9.4 with:
    Metacello new
    repository: 'http://smalltalkhub.com/mc/Pharo/Fuel/main';
    configuration: 'Fuel';
        version: '1.9.4';
    load
  3. I tried to materialize, but I hit two errors: 1) SmallFloat64s can only be created by performing arithmetic 2) SmalltalkImage DNU isBigEndian
  4. To overcome the first, I compiled the following based on #224:
    Float class>>#materializeFrom: aDecoder
    ^ (BoxedFloat64 new: 2)
        at: 1 put: aDecoder nextEncodedUint32;
        at: 2 put: aDecoder nextEncodedUint32;
        * 1.
  5. To overcome the second, (based on a guess), in FLWordjectCluster>>#materializeInstanceWith:, I changed aDecoder isBigEndian = Smalltalk isBigEndian asBit to aDecoder isBigEndian = EndianDetector isBigEndian

If anyone is faced with a similar problem, hopefully this helps!

seandenigris commented 2 years ago

I did find a problem, alluded to by #224, with WideStrings, which did not rematerialized correctly, and look like this:

Screen Shot 2021-12-30 at 7 36 07 AM

Any way to recover the data, @theseion?

theseion commented 2 years ago

As far as I remember (and can glean from the issue), the changes in #224 only concern WideStrings in class names and globals. Regular instances of WideString are serialized as collections and there shouldn't be any differences. Unless the problem is related to the integer encoding for 64 bit. Can you construct a simple test case that I can work with?

seandenigris commented 2 years ago

Can you construct a simple test case that I can work with?

The problem is that the data I was rescuing was materialized on an unknown vm/arch, so I don’t know how to reproduce. Would it be helpful if I could figure out where the WideString was supposed to contain?

Unless the problem is related to the integer encoding for 64 bit.

Could very well be. How can I investigate this possibility? Any way to recover the data in this case?

theseion commented 2 years ago

It would help to know the contents, yes. I also think you made a mistake when changing FLWordjectCluster>>#materializeInstanceWith:. FLDecoder>>isBigEndian is not a boolean (although it should be) but an integer. To compare it, you have to compare it to an integer, so you should compare it to EndianDetector isBigEndian asBit.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will remain open but will probably not come into focus. If you still think this should receive some attention, leave a comment. Thank you for your contributions.

theseion commented 2 years ago

@seandenigris can I close this issue?

seandenigris commented 2 years ago

Sure

seandenigris commented 2 years ago

I condensed the insights from this conversation into the Pharo-Enhancements project's Pharo Lepiter DB, which will (hopefully soon) also be exported as GH markdown

seandenigris commented 2 years ago

I got this additional error in P8:

  1. Materializing via Fuel 1.9.4
  2. Load Fuel 5.0.1
  3. Attempt to serialize

Any ideas?

Screen Shot 2022-04-30 at 12 30 06 PM
theseion commented 2 years ago

Looks to me like loading didn't work as expected. I know this happens under certain circumstances (though I don't know what those are exactly). Your best bet is to fully unload the old version before loading the new one.

seandenigris commented 2 years ago

Okay thanks. I’ll close for now