different safe levels, which one to choose?

D

David Garamond

Is there a guide or thumb rule on choosing which safe level should one
use for different situations? I've read Pickaxe. The only thing I can be
sure of is this: $SAFE=1 is basically Ruby's equivalent of Perl's -T (in
fact, Ruby also has -T and it's also automatically set for setuid/setgid
scripts). Coming from Perl, I've known and use -T fairly frequently.

As for the other levels, it's blurry for me. Different safe levels have
different sets of restrictions (sometimes seemingly unrelated), but I
cannot understand why that restriction is placed for that level. For
example, at $SAFE=2 the restrictions are mostly file-/process-related,
so I'm guessing this level is for running things like CGI scripts. Am I
right, or is there a different goal for $SAFE=2? $SAFE=4 is usually for
embedded code. What is $SAFE=3 for? Are there definitions for $SAFE=5
and above (especially in Ruby 1.8/1.9)? Has $SAFE restrictions been
changed/modified/added/relieved for certain safe levels in the past?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top