[#101179] Spectre Mitigations — Amel <amel.smajic@...>
Hi there!
5 messages
2020/12/01
[#101694] Ruby 3.0.0 Released — "NARUSE, Yui" <naruse@...>
V2UgYXJlIHBsZWFzZWQgdG8gYW5ub3VuY2UgdGhlIHJlbGVhc2Ugb2YgUnVieSAzLjAuMC4gRnJv
4 messages
2020/12/25
[ruby-core:101400] [Ruby master Bug#17379] Refinement with modules redefinition bug
From:
marcandre-ruby-core@...
Date:
2020-12-10 17:36:00 UTC
List:
ruby-core #101400
Issue #17379 has been updated by marcandre (Marc-Andre Lafortune).
Probably same bug, without `using`, found by Daniel DeLorme:
```ruby
class Foo
def foo
p :hello
end
end
module Code
def foo
p :A
end
end
module Extension
refine Foo do
prepend Code
end
end
Foo.new.foo unless ENV['SKIP'] # => :hello (ok)
Foo.prepend Code
Foo.new.foo # => depends (not ok)
```
gives:
```
$ ruby refinement.rb
:hello
:hello
$ SKIP=t ruby refinement.rb
:A
```
----------------------------------------
Bug #17379: Refinement with modules redefinition bug
https://bugs.ruby-lang.org/issues/17379#change-89160
* Author: marcandre (Marc-Andre Lafortune)
* Status: Open
* Priority: Normal
* Assignee: shugo (Shugo Maeda)
* ruby -v: ruby 3.0.0dev (2020-12-05T10:40:00Z master 9dbb2bfd73) [x86_64-darwin18]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
Depending on the circumstance, a refinement can be modified even after being used:
```ruby
def foo
[:base]
end
module M
def foo
super << :M
end
end
module Ext
refine Object do
include M
end
end
using Ext
p 'asd'.foo unless ENV['SKIP'] # => [:base, :M] (ok)
module M
def foo
super << :new_ref
end
end
p 'asd'.foo # => depends (not ok)
```
Running this gives:
```
$ ruby refinement.rb
[:base, :M]
[:base, :M] # => ok
$ SKIP=t ruby refinement.rb
[:base, :new_ref] # => should be [:base, :M]
```
--
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>