Bugs: Browse | Submit New | Admin

[#7678] Troublesome -T ruby interpret flag

Date:
2007-01-08 19:38
Priority:
3
Submitted By:
Steve N/A (isteve)
Assigned To:
Shyouhei Urabe (shyouhei)
Category:
Language / Runtime / Core Libraries
State:
Open
Platform:
 
Summary:
Troublesome -T ruby interpret flag

Detailed description
Hello,
I'm confused by the following ambiguity of -T and $SAFE: after short examination of source code, it appears that -T
only sets safe level (using function rb_set_safe_level), which is basically what safe_getter and safe_setter used to
handle $SAFE do.

However, the behavior of -T1 and $SAFE=1 differ slightly, as described below. It may be a non-issue and I'm doing something
the Wrong Way(tm), however, the fact that require complains about NULL pointer given itself would suggest otherwise.

Thanks in advance for any comments.


##################
## Test case #1:
## Using -T1
 
isteve@silver:~$ ruby -T1 yap.rb
yap.rb:5:in `require': NULL pointer given (ArgumentError)
        from yap.rb:5
isteve@silver:~$ cat yap.rb
#!/usr/bin/ruby -T1
 
#$SAFE=1
 
require 'test.rb'
 
puts "asd"
 
isteve@silver:~$ cat test.rb
#!/usr/bin/env ruby
def foo(s)
        "s"
end
 
##################
## Test case #2: #
## I've only altered yap.rb in fashion to be seen far below (ie. use $SAFE instead of -T1)
 
isteve@silver:~$ ruby yap.rb
asd
 
isteve@silver:~$ cat yap.rb
#!/usr/bin/ruby 
 
$SAFE=1
 
require 'test.rb'
 
puts "asd"

Add A Comment: Notepad

Please login


Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

Field Old Value Date By
assigned_tonone2007-06-12 02:24zenspider
category_idMisc / Other Standard Library2007-05-29 17:49zenspider
category_idLanguage / Runtime / Core Libraries2007-05-29 15:54zenspider