[comp.lang.smalltalk] Bug in PP ST-80 R4, and a fix

fche@db.toronto.edu ("Frank Ch. Eigler") (05/25/91)

Hi, folks -

I just ran into a strange bug in R4.  Attempting to store a long
ByteArray using the storeOn: message produces incorrect results if
its length is > 300 bytes.

The problem apparently lies in the asPackedString method where
the system attempts to encode the byte array into a UUENCODE-type
string, but the output sometimes ends up with non-ascii characters.

This routine decides which of two subsidiary methods it should use for
this process - for >300 bytes, it calls `fastEncodeInto:' to convert most
of the byte-array.  For the rest, and for <300 bytes, the 'slowEncode...'
method is used.

Apparently `fastEncodeInto:' is broken, because ByteArrays passed to it
come out with non-ascii characters in them.  This makes storeOn: unreliable
when applied to large ByteArrays.

Apparently, a simple fix is possible - force asPackedString to use the
slower (but *working*) method only.  You can do this in your image
if you browse the `asPackedString' method of class ByteArray and
change the fourth code line that says:

	size > 300
to
	false

Until some official fix comes from ParcPlace, this should avoid this problem
with ByteArrays.

- Frank
-- 

-- Frank Ch. Eigler -- Comp Eng -- <fche@db.toronto.edu> --