From: "Earlopain (Earlopain _) via ruby-core" Date: 2026-08-16T14:02:03+00:00 Subject: [ruby-core:126410] [Ruby Misc#14190] What are the semantics of $SAFE? Issue #14190 has been updated by Earlopain (Earlopain _). Status changed from Open to Closed `$SAFE` is removed since Ruby 3.0 ---------------------------------------- Misc #14190: What are the semantics of $SAFE? https://bugs.ruby-lang.org/issues/14190#change-118552 * Author: Eregon (Benoit Daloze) * Status: Closed ---------------------------------------- $SAFE is documented in many places as thread-local, but it seems more than that. For example: # a.rb $SAFE=1 p $SAFE require "#{Dir.pwd.untaint}/b.rb" # b.rb p [:in_b, $SAFE] gives: $ ruby -r./a -e 'p $SAFE' 1 [:in_b, 0] 0 So in b and in -e, $SAFE is 0. Is it file-based somehow? I was trying to understand what https://github.com/ruby/ruby/blob/7c4306e6e9c3c4a255f4ad20134c1832dbe45ba2/test/rubygems/test_gem.rb#L9-L13 is supposed to do. Does it make sense? What does it do? It seems the test_* methods in that file actually read $SAFE as 0, not 1. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/