Bug #8880

Refinements bug in ruby 2.1.0dev (2013-09-08) [x86_64-linux]

Added by Daniel Mendler 7 months ago. Updated 7 months ago.

[ruby-core:57079]
Status:Closed
Priority:Normal
Assignee:-
Category:core
Target version:2.1.0
ruby -v: ruby 2.1.0dev (2013-09-08) [x86_64-linux] Backport:1.9.3: DONTNEED, 2.0.0: DONTNEED

Description

Hi,

I found a bug in the refinements implementation of Ruby 2.1.0. It is related to https://bugs.ruby-lang.org/issues/8722. On ruby 2.0.0p0 (2013-02-24 revision 39474) this does not occur.

The VM segfaults when the attached code is executed. The problem is that a used refinement is modified afterwards.

Daniel

broken.rb Magnifier (179 Bytes) Daniel Mendler, 09/09/2013 10:13 AM

Associated revisions

Revision 42896
Added by Nobuyoshi Nakada 7 months ago

vm_method.c: clear cache after refine method

  • vmmethod.c (rbaddrefinedmethod_entry): clear cache in the refined class since refining a method entry is modifying the class. [Bug #8880]

History

#1 Updated by Nobuyoshi Nakada 7 months ago

#8722 is irrelevant, and it occurs regardless of eval.

Seems refined method definition doesn't increase seq in the class.

#2 Updated by Nobuyoshi Nakada 7 months ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r42896.
Daniel, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


vm_method.c: clear cache after refine method

  • vmmethod.c (rbaddrefinedmethod_entry): clear cache in the refined class since refining a method entry is modifying the class. [Bug #8880]

#3 Updated by Nobuyoshi Nakada 7 months ago

  • Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 1.9.3: DONTNEED, 2.0.0: DONTNEED

Also available in: Atom PDF