Exception not caught / require BUG

Hello,

I found that the following exception does not raise an exception
but kills the ruby interpreter.

def test_traceback()
begin
require "Socket"
rescue => detail
print "Not available"
end
end

it works when i require “socket” instead of the non existing “Socket”.
In the latter case i only get:

c:/ruby/lib/ruby/1.8/i386-mswin32/Socket.so: 127: The specified procedure could not be found. - Init_Socket (LoadError)
c:/ruby/lib/ruby/1.8/i386-mswin32/Socket.so from common/ruby/arachno_traceback.rb:25:in `test_traceback’
from common/ruby/arachno_traceback.rb:45

But since the file does not exist the error message about a not found
procedure is also wrong.

···


Best regards,
Lothar mailto:mailinglists@scriptolutions.com

I found that the following exception does not raise an exception
but kills the ruby interpreter.

normal, LoadError don't inherit from StandardError

svg% ruby -e 'p LoadError < StandardError'
false
svg%

svg% ruby -e 'p LoadError < ScriptError'
true
svg%

def test_traceback()
begin
  require "Socket"
rescue => detail
  print "Not available"
end
end

Your rescue is for StandardError only

c:/ruby/lib/ruby/1.8/i386-mswin32/Socket.so: 127: The specified
procedure could not be found. - Init_Socket (LoadError)
c:/ruby/lib/ruby/1.8/i386-mswin32/Socket.so from
common/ruby/arachno_traceback.rb:25:in `test_traceback'
        from common/ruby/arachno_traceback.rb:45

But since the file does not exist the error message about a not found
procedure is also wrong.

You probably work with a system which don't make the difference between
the file Socket.so and socket.so and the error is right

Init_Socket is not defined in socket.so

Guy Decoux