From: nobu@... Date: 2016-12-08T04:41:46+00:00 Subject: [ruby-core:78537] [Ruby trunk Bug#12729] crash after refining private method to public Issue #12729 has been updated by Nobuyoshi Nakada. Description updated Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED ---------------------------------------- Bug #12729: crash after refining private method to public https://bugs.ruby-lang.org/issues/12729#change-61920 * Author: George Koehler * Status: Open * Priority: Normal * Assignee: * ruby -v: ruby 2.4.0dev (2016-09-06 trunk 56078) [x86_64-openbsd6.0] * Backport: 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED ---------------------------------------- If I am using a refinement to make a private method into a public one, and I call the method, then Ruby crashes. Here's a simple example: ~~~ ruby class Cow private def moo() end end module PublicCows refine(Cow) { public :moo } end using PublicCows Cow.new.moo ~~~ It segfaults: ~~~ $ ruby scratch.rb scratch.rb:13: [BUG] Segmentation fault at 0x007f7fffbbdff8 ruby 2.4.0dev (2016-09-06 trunk 56078) [x86_64-openbsd6.0] -- Control frame information ----------------------------------------------- c:0002 p:0049 s:0007 e:000005 EVAL scratch.rb:13 [FINISH] c:0001 p:0000 s:0003 E:001d50 (none) [FINISH] -- Ruby level backtrace information ---------------------------------------- scratch.rb:13:in `
' -- Other runtime information ----------------------------------------------- * Loaded script: scratch.rb * Loaded features: 0 enumerator.so 1 thread.rb 2 rational.so 3 complex.so 4 /home/kernigh/prefix/lib/ruby/2.4.0/x86_64-openbsd6.0/enc/encdb.so 5 /home/kernigh/prefix/lib/ruby/2.4.0/x86_64-openbsd6.0/enc/trans/transdb.so 6 /home/kernigh/prefix/lib/ruby/2.4.0/unicode_normalize.rb 7 /home/kernigh/prefix/lib/ruby/2.4.0/x86_64-openbsd6.0/rbconfig.rb 8 /home/kernigh/prefix/lib/ruby/2.4.0/rubygems/compatibility.rb 9 /home/kernigh/prefix/lib/ruby/2.4.0/rubygems/defaults.rb 10 /home/kernigh/prefix/lib/ruby/2.4.0/rubygems/deprecate.rb 11 /home/kernigh/prefix/lib/ruby/2.4.0/rubygems/errors.rb 12 /home/kernigh/prefix/lib/ruby/2.4.0/rubygems/version.rb 13 /home/kernigh/prefix/lib/ruby/2.4.0/rubygems/requirement.rb 14 /home/kernigh/prefix/lib/ruby/2.4.0/rubygems/platform.rb 15 /home/kernigh/prefix/lib/ruby/2.4.0/rubygems/basic_specification.rb 16 /home/kernigh/prefix/lib/ruby/2.4.0/rubygems/stub_specification.rb 17 /home/kernigh/prefix/lib/ruby/2.4.0/rubygems/util/list.rb 18 /home/kernigh/prefix/lib/ruby/2.4.0/x86_64-openbsd6.0/stringio.so 19 /home/kernigh/prefix/lib/ruby/2.4.0/rubygems/specification.rb 20 /home/kernigh/prefix/lib/ruby/2.4.0/rubygems/exceptions.rb 21 /home/kernigh/prefix/lib/ruby/2.4.0/rubygems/dependency.rb 22 /home/kernigh/prefix/lib/ruby/2.4.0/rubygems/core_ext/kernel_gem.rb 23 /home/kernigh/prefix/lib/ruby/2.4.0/monitor.rb 24 /home/kernigh/prefix/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb 25 /home/kernigh/prefix/lib/ruby/2.4.0/rubygems.rb 26 /home/kernigh/prefix/lib/ruby/2.4.0/rubygems/path_support.rb [NOTE] You may have encountered a bug in the Ruby interpreter or extension libraries. Bug reports are welcome. For details: http://www.ruby-lang.org/bugreport.html Abort trap (core dumped) ~~~ There's a small chance that I get a `SystemStackError` instead of a segfault: ~~~ $ ruby scratch.rb scratch.rb:13:in `
': stack level too deep (SystemStackError) ~~~ Feature #12697 had inspired me to try making a refinement where `Module#attr_accessor` and `Module#define_method` are public. That's how I found this bug. -- https://bugs.ruby-lang.org/ Unsubscribe: