Mantis - Squeak
Viewing Issue Advanced Details
7709 System minor always 12-21-12 14:15 01-25-13 23:04
Lars  
FrankShearar  
normal  
resolved  
fixed  
none    
none trunk  
0007709: Image Segments can't be written to file anymore
ImageSegment new
    copyFromRoots: (Array with: TestCase) sizeHint: 100;
    extract;
    writeToFile: 'TestCase';
    yourself
raises an error in writeToFile: aName because the standard nextPutAll: tactic has changed. The assumption is, that any file will be written with either aByteArray or some UTF8-String.

The forward solution of appending MultiByteFileStream>>nextPutAll: is attached.
 MultiByteFileStream-nextPutAll.st [^] (472 bytes) 12-21-12 14:16

Notes
(0014272)
FrankShearar   
01-01-13 22:04   
In the Inbox as Multilingual-fbs.157 and Tests-fbs.177.
(0014297)
FrankShearar   
01-25-13 15:45   
In Trunk as Tests-fbs.186 and Multilingual-fbs.157.
(0014298)
Lars   
01-25-13 16:11   
Thanks for accepting the fix.
I'm not sure whether the testcase is ok. When stepping through the test case, it took a different path (maybe also different to the one it would take if not stepped through), and thus ended up never calling nextPutAll. I'd suggest creating a segment of another class, e.g. ScriptLoader, any class that is not referenced on the stack.
Best, Lars
(0014299)
FrankShearar   
01-25-13 16:14   
Hm, OK. I saw the test fail before applying the fix and pass afterwards.

Would you mind giving me a test that you think would be representative?
(0014300)
Lars   
01-25-13 16:18   
Just switch the exportet TestCase for ScriptLoader:

ImageSegment new
    copyFromRoots: (Array with: ScriptLoader) sizeHint: 100;
    extract;
    writeToFile: 'ScriptLoader';
    yourself

Oh, and while you're at it, you may want to delete the created file (ScriptLoader.seg) after success.
(0014301)
Lars   
01-25-13 16:19   
but only after access ScriptLoader ...
(0014302)
FrankShearar   
01-25-13 17:41   
I must be missing something. Both seem to trigger the bug in the same way, in that some bit somewhere doesn't understand #asUnicode. I can see in both cases that MultiByteFileStream >> #nextPutAll: on the call stack.

"but only after access ScriptLoader ..." <-- I also don't understand this.
(0014303)
Lars   
01-25-13 22:13   
Sorry for answering so late, but I got interrupted and had work ...

When I stepped through the test case, while exporting TestCase, the instance variable status was set to #inactive. Because of that, exporting always aborted early. I assumed, the status #inactive as opposed to the expected #active was due to my stepping through a subclass of TestCase.

If you saw it call nextPutAll, everything is fine. My bad, sorry.

The last comment, was because ImageSegments is meant to export classes into files, removing them from the Image. If you delete the file before reloading the class, the image might break, shouldn't it?
(0014304)
FrankShearar   
01-25-13 23:04   
Certainly if you delete them injudiciously you can get into a very nasty state, as I discovered!

OK, so I think we just leave the issue as is, unless you can think of anything else we might need?