[squeak-dev] FFI issue in Squeak 4.2 ?
leves at elte.hu
Mon Feb 21 04:44:42 UTC 2011
On Sun, 20 Feb 2011, mkobetic at gmail.com wrote:
> "Levente Uzonyi"<leves at elte.hu> wrote:
>> There's no need to turn off #allowUnderscoreAsAssignment if the code is
>> not ambiguous (it's not).
> I was getting desperate, so I was trying whatever could possibly make a difference :-). I'll clean it up again.
Oh, so you added the selector to every class. In that case there may be
ambiguity, but the chance is very small.
>> The need for the global
>> #allowUnderscoreSelectors is because of MC. It tries to load EVPMD >>
>> #'block_size' before EVPMD class >> #allowUnderscoreSelectors which won't
>> IMHO it's better to just use the global preference, since the per class
>> methods are not good enough.
>> FFI is fine. The cause of the problem is String >> #numArgs. $_ is not
>> accepted by it as a valid selector character, so it returns -1 instead of
>> 1 for #'HMAC_CTX_cleanup:'. It will be fixed in the Trunk soon, along
>> with the other underscore related problems.
>> I doubt FFI will be preloaded in images, because it has some security risk.
> Security risks that outweigh benefits of having the ability to call the outside world without much hassle? I'm curious, but it sounds like the community already had this argument and decided it's not worth it. No need to stir up old arguments, I'll see if I can find something in the archives.
IIRC the last discussion about it was years ago, so maybe it's worth
reviewing the idea.
>> However there's a simple solution: Metacello. A Metacello
>> configuration can ensure that FFI is loaded before the FFI specific parts
>> are loaded, take care about platform specific stuff, like changing the
>> preferences, etc.
> Hm, so if I create a metacello configuration and assuming there are some pre/post load hooks, can I turn the global flag on just for the duration of the load ? I prefer not to mess with global state of people's images if it can be avoided (I mean beyond adding a pile of new code to it :-).
Yes. I hacked together a basic Metacello configuration for Xtreams, which
automatically loads FFI if the Xtras package is requested (and FFI is
not loaded) and fixes the underscore problems for Squeak. I uploaded it to
the MetacelloRepository (http://squeaksource.com/MetacelloRepository ).
You can load Xtreams into Squeak 4.2 with it using the following script:
(Smalltalk at: #ConfigurationOfXtreams) perform: #loadBleedingEdge
The Pharo version of this script should use Gofer instead of Installer to
load the configuration itself, but the last line should remain the same.
There are no versions yet, just a baseline, so one can only load the
#bleedingEdge versions of the packages. This is equivalent with the
current loader scripts.
I also defined some groups which only load some, but not all packages
(no tests, no Xtras, etc). See the commit message or the specification
itself for details.
>> I managed to load XTreams to Squeak Trunk (possibly works with 4.2 too)
>> using the following script:
>> I also uploaded a new version of Xtreams-Xtras to the repository which
>> fixes XTHMACTest and XTHashTest for Squeak.
>> With these changes, all tests are green on Windows.
> Excellent! So that means the new Bcrypt based hashing worked for you too. Thank you very much! I really appreciate your help.
Yes. Before XP users start wondering why this doesn't work for them,
bcrypt is only supported on Vista and later versions (according to msdn).
More information about the Squeak-dev