Project

General

Profile

Actions

Bug #10170

closed

Core dumped when using recursion in define_method

Added by liligga (Igor Grebennikov) almost 11 years ago. Updated almost 6 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
2.0.0p247, 2.0.0p353,
[ruby-core:64570]

Description

So if we have this

class A
  define_method :a do
    a
  end
end

and call A.new.a we got SystemStackError
but with alias

class A
  define_method :a do
    a
  end
end

when calling

x=A.new
x.a

in irb or

x=A.new
x.a; x.a

in pry gives

segmentation fault (core dumped)

But ruby -e 'class A; define_method :a do; a; end; end; A.new.a;'
gives segfault randomly
Ubuntu 13.10

Updated by liligga (Igor Grebennikov) almost 11 years ago

Initial issue is wrong a little.
So if we have this

class A
  define_method :a do
    a
  end
end

when calling in irb

x=A.new
x.a

or in pry

x=A.new
x.a; x.a

gives

segmentation fault (core dumped)

But
ruby -e 'class A; define_method :a do; a; end; end; A.new.a;'
gives segfault randomly

Updated by nobu (Nobuyoshi Nakada) almost 11 years ago

  • Description updated (diff)
  • Status changed from Open to Feedback

Could you try newer versions?

Updated by liligga (Igor Grebennikov) almost 11 years ago

Okay, ruby 2.1.2 gives everytime
abort (core dumped)

for
A.new.a
in pry, irb and ruby -e 'class A; define_method :a do; a; end; end; A.new.a'

Updated by nobu (Nobuyoshi Nakada) almost 11 years ago

2.1.2p207 seems working.

Actions #5

Updated by jeremyevans0 (Jeremy Evans) almost 6 years ago

  • Status changed from Feedback to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0