[Glass] MultibyteString>>encodeUsing: bug
Dale Henrichs
dale.henrichs at gemtalksystems.com
Mon Apr 21 12:39:25 PDT 2014
Johan,
Could you share some more details about the bug?
GemStone will automatically coerce a `String new` into the appropriate
*String class when a multi-byte character is added to the String, so
presumably `String new` shouldn't be a problem.
I don't know where the `MutiByteString new` is being executed (perhaps not
necessary?)
Regarding primitive failures, there is typically failure code written in
Smalltalk to throw an explicit error upon primitive failure, but that code
is clearly missing in the #encodeUsing: method ... From the comment:
If the ascii value is >= size of the encodingArray, nil is returned.
If the value from the encodingArray is a Character with value > 16rFF
or is not a kind of String, nil is returned.
So there should some Smalltalk code checking for those conditions ... also
it looks like MutiByteStrings will be problematic since they would involve
characters > 16rFF, so I will have to check into that ... If
MultiByteStrings are supported by the primitive, then perhaps moving the
primitive call to the concrete subclasses of MultiByteString will do the
trick ...
Finally, for security reasons compilation of methods with primitives must
be done by SystemUser. It is possible to give a user (like Datacurator)
the CompilePrimitives privilege to allow primitive compilation. Something
like the following:
GsCurrentSession currentSession userProfile
addPrivilege: #'CompilePrimitives';
yourself.
System commitTransaction.
I'll look into the details of the primitive and let you know if I find
anything new...
Dale
On Mon, Apr 21, 2014 at 2:29 AM, Johan Brichau <johan at inceptive.be> wrote:
> Hi,
>
> I stumbled upon a situation where the code in
> MultiByteString>>encodeUsing: is being executed (the primitive has failed?).
>
> This code does a "MultibyteString new" but that is a subclass
> responsibility:
>
> WriteStream on: MultibyteString new.
>
> I assume the code should be:
>
> WriteStream on: self species new.
>
>
> A couple of questions:
> - it seems I need to login as SystemUser to recompile this method. I get
> an error only a SystemUser can change a primitive ? Anything specific to
> watch out for when doing that?
> - is there a way to know why the primitive failed?
>
> regards
> Johan
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> http://lists.gemtalksystems.com/mailman/listinfo/glass
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20140421/8245fc3d/attachment.html>
More information about the Glass
mailing list