> Thank you very much for your detailed answer. I'm afraid to
> say the program still doesn't work:
>
>   $ cat safe.rb
>   fn = 'dummy.rb'
>   File.open fn, 'w' do |f|
>     f.puts 'raise "hello"'
>   end
>   Thread.start( File.expand_path( fn)) do |fn|
>     $SAFE = 4
>     load fn, true
>   end.join
>
>   $ ruby safe.rb
>   safe.rb:7:in `load': Insecure operation - load
>   (SecurityError)
>           from safe.rb:5:in `join'
>           from safe.rb:5
>   $

Works fine for me: ruby 1.8.2 (2004-11-06) [i386-mswin32]

> All I wanted to do is run the thread in its own environment.
> I will use fork.

.... from which I understand you're on *nix, right? I think 'load' will
not access files from globally writable locations on unix. This is done
interntionally to prevent loading of non-secure files. Since you write
the file locally, it might be considered unsafe.

HTH,
Assaph