From: zn@... Date: 2020-12-22T16:25:19+00:00 Subject: [ruby-core:101631] [Ruby master Bug#17426] method_missing can't override kernel#system method anymore Issue #17426 has been updated by znz (Kazuhiro NISHIYAMA). If you want to intercept `system` on both, you can use `undef` or `undef_method`. ```ruby class Klass undef_method :system end ``` ---------------------------------------- Bug #17426: method_missing can't override kernel#system method anymore https://bugs.ruby-lang.org/issues/17426#change-89422 * Author: freiden (charles fd) * Status: Rejected * Priority: Normal * ruby -v: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- Hello, It seems like I found a behavior change on the way method missing is working on Ruby 2.7.2 in comparison with 2.6.6. `method_missing` can't intercept call to a method called `system`. The following code help reproducing the behavior ```ruby class Klass def method_missing(meth, *args, &blk) if %i[system foo].include?(meth) puts 'behavior not reproductible' else super end end # Work on 2.6.6 def call_system_from_self self.system end # Doesn't work on both def call_system_from_implicit_self system end # Work on both def call_foo_from_self self.foo end # Work on both def call_foo_from_implicit_self foo end # Doesn't work on both def call_system_with_send_from_self self.send(:system) end # Work on both def call_foo_with_send_from_self self.send(:foo) end # Work on both def call_system_with_public_send self.public_send(:system) end # Work on both def call_foo_with_public_send self.public_send(:foo) end end ``` Is it an expected behavior change in 2.7.2? -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>