ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:67722] [ruby-trunk - Bug #10765] [Open] Module#remove_method remove refined method entry.
       [not found] <redmine.issue-10765.20150121134713@ruby-lang.org>
@ 2015-01-21 13:47 ` hanachin
  2015-01-21 13:50 ` [ruby-core:67723] [ruby-trunk - Bug #10765] " hanachin
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: hanachin @ 2015-01-21 13:47 UTC (permalink / raw
  To: ruby-core

Issue #10765 has been reported by Seiei Higa.

----------------------------------------
Bug #10765: Module#remove_method remove refined method entry.
https://bugs.ruby-lang.org/issues/10765

* Author: Seiei Higa
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.0dev (2015-01-21 trunk 49326) [x86_64-darwin14]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
`Module#remove_method` should raise a `NameError`
if method is not defined in refined class, such as [`undef`](https://bugs.ruby-lang.org/issues/8966).
But if method is defined in refined class, `Module#remove_method` should keep refined method and remove original method.

I confirmed by following examples in ruby-trunk, 2.2.0, 2.1.5, 2.0.0-p598

``` ruby
class C
  def foo
    "C#foo"
  end
end

module RefinementBug
  refine C do
    def foo
      "RefinementBug#foo"
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

puts C.new.foo

# expected:
#   RefinementBug#foo
#
# actual:
#   bug.rb:21:in `<main>': undefined method `foo' for #<C:0x007f9e5c087b48> (NoMethodError)
```

``` ruby
class C
end

module RefinementBug
  refine C do
    def foo
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

# expected:
#   bug2.rb:14:in `remove_method': method `foo' not defined in C (NameError)
#   from bug2.rb:14:in `<class:C>'
#   from bug2.rb:13:in `<main>'
#
# actual:
#   # => nothing raised.
```

---Files--------------------------------
bug.rb (342 Bytes)
bug2.rb (327 Bytes)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:67723] [ruby-trunk - Bug #10765] Module#remove_method remove refined method entry.
       [not found] <redmine.issue-10765.20150121134713@ruby-lang.org>
  2015-01-21 13:47 ` [ruby-core:67722] [ruby-trunk - Bug #10765] [Open] Module#remove_method remove refined method entry hanachin
@ 2015-01-21 13:50 ` hanachin
  2015-02-03  6:15 ` [ruby-core:67967] [ruby-trunk - Bug #10765] [Assigned] " shugo
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: hanachin @ 2015-01-21 13:50 UTC (permalink / raw
  To: ruby-core

Issue #10765 has been updated by Seiei Higa.

File 0001-vm_method.c-fix-remove-refined-method.patch added

I attached a patch for this.

----------------------------------------
Bug #10765: Module#remove_method remove refined method entry.
https://bugs.ruby-lang.org/issues/10765#change-51150

* Author: Seiei Higa
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.0dev (2015-01-21 trunk 49326) [x86_64-darwin14]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
`Module#remove_method` should raise a `NameError`
if method is not defined in refined class, such as [`undef`](https://bugs.ruby-lang.org/issues/8966).
But if method is defined in refined class, `Module#remove_method` should keep refined method and remove original method.

I confirmed by following examples in ruby-trunk, 2.2.0, 2.1.5, 2.0.0-p598

``` ruby
class C
  def foo
    "C#foo"
  end
end

module RefinementBug
  refine C do
    def foo
      "RefinementBug#foo"
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

puts C.new.foo

# expected:
#   RefinementBug#foo
#
# actual:
#   bug.rb:21:in `<main>': undefined method `foo' for #<C:0x007f9e5c087b48> (NoMethodError)
```

``` ruby
class C
end

module RefinementBug
  refine C do
    def foo
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

# expected:
#   bug2.rb:14:in `remove_method': method `foo' not defined in C (NameError)
#   from bug2.rb:14:in `<class:C>'
#   from bug2.rb:13:in `<main>'
#
# actual:
#   # => nothing raised.
```

---Files--------------------------------
bug2.rb (327 Bytes)
bug.rb (342 Bytes)
0001-vm_method.c-fix-remove-refined-method.patch (2.68 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:67967] [ruby-trunk - Bug #10765] [Assigned] Module#remove_method remove refined method entry.
       [not found] <redmine.issue-10765.20150121134713@ruby-lang.org>
  2015-01-21 13:47 ` [ruby-core:67722] [ruby-trunk - Bug #10765] [Open] Module#remove_method remove refined method entry hanachin
  2015-01-21 13:50 ` [ruby-core:67723] [ruby-trunk - Bug #10765] " hanachin
@ 2015-02-03  6:15 ` shugo
  2015-02-03  6:30 ` [ruby-core:67969] [ruby-trunk - Bug #10765] " shugo
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: shugo @ 2015-02-03  6:15 UTC (permalink / raw
  To: ruby-core

Issue #10765 has been updated by Shugo Maeda.

Status changed from Open to Assigned
Assignee set to Shugo Maeda

----------------------------------------
Bug #10765: Module#remove_method remove refined method entry.
https://bugs.ruby-lang.org/issues/10765#change-51353

* Author: Seiei Higa
* Status: Assigned
* Priority: Normal
* Assignee: Shugo Maeda
* ruby -v: ruby 2.3.0dev (2015-01-21 trunk 49326) [x86_64-darwin14]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
`Module#remove_method` should raise a `NameError`
if method is not defined in refined class, such as [`undef`](https://bugs.ruby-lang.org/issues/8966).
But if method is defined in refined class, `Module#remove_method` should keep refined method and remove original method.

I confirmed by following examples in ruby-trunk, 2.2.0, 2.1.5, 2.0.0-p598

``` ruby
class C
  def foo
    "C#foo"
  end
end

module RefinementBug
  refine C do
    def foo
      "RefinementBug#foo"
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

puts C.new.foo

# expected:
#   RefinementBug#foo
#
# actual:
#   bug.rb:21:in `<main>': undefined method `foo' for #<C:0x007f9e5c087b48> (NoMethodError)
```

``` ruby
class C
end

module RefinementBug
  refine C do
    def foo
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

# expected:
#   bug2.rb:14:in `remove_method': method `foo' not defined in C (NameError)
#   from bug2.rb:14:in `<class:C>'
#   from bug2.rb:13:in `<main>'
#
# actual:
#   # => nothing raised.
```

---Files--------------------------------
bug2.rb (327 Bytes)
bug.rb (342 Bytes)
0001-vm_method.c-fix-remove-refined-method.patch (2.68 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:67969] [ruby-trunk - Bug #10765] Module#remove_method remove refined method entry.
       [not found] <redmine.issue-10765.20150121134713@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2015-02-03  6:15 ` [ruby-core:67967] [ruby-trunk - Bug #10765] [Assigned] " shugo
@ 2015-02-03  6:30 ` shugo
  2015-02-03 13:26 ` [ruby-core:67978] [ruby-trunk - Bug #10765] [Assigned] " v.ondruch
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: shugo @ 2015-02-03  6:30 UTC (permalink / raw
  To: ruby-core

Issue #10765 has been updated by Shugo Maeda.

Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED

----------------------------------------
Bug #10765: Module#remove_method remove refined method entry.
https://bugs.ruby-lang.org/issues/10765#change-51356

* Author: Seiei Higa
* Status: Closed
* Priority: Normal
* Assignee: Shugo Maeda
* ruby -v: ruby 2.3.0dev (2015-01-21 trunk 49326) [x86_64-darwin14]
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED
----------------------------------------
`Module#remove_method` should raise a `NameError`
if method is not defined in refined class, such as [`undef`](https://bugs.ruby-lang.org/issues/8966).
But if method is defined in refined class, `Module#remove_method` should keep refined method and remove original method.

I confirmed by following examples in ruby-trunk, 2.2.0, 2.1.5, 2.0.0-p598

``` ruby
class C
  def foo
    "C#foo"
  end
end

module RefinementBug
  refine C do
    def foo
      "RefinementBug#foo"
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

puts C.new.foo

# expected:
#   RefinementBug#foo
#
# actual:
#   bug.rb:21:in `<main>': undefined method `foo' for #<C:0x007f9e5c087b48> (NoMethodError)
```

``` ruby
class C
end

module RefinementBug
  refine C do
    def foo
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

# expected:
#   bug2.rb:14:in `remove_method': method `foo' not defined in C (NameError)
#   from bug2.rb:14:in `<class:C>'
#   from bug2.rb:13:in `<main>'
#
# actual:
#   # => nothing raised.
```

---Files--------------------------------
bug2.rb (327 Bytes)
bug.rb (342 Bytes)
0001-vm_method.c-fix-remove-refined-method.patch (2.68 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:67978] [ruby-trunk - Bug #10765] [Assigned] Module#remove_method remove refined method entry.
       [not found] <redmine.issue-10765.20150121134713@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2015-02-03  6:30 ` [ruby-core:67969] [ruby-trunk - Bug #10765] " shugo
@ 2015-02-03 13:26 ` v.ondruch
  2015-02-03 15:20 ` [ruby-core:67982] [ruby-trunk - Bug #10765] " hanachin
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: v.ondruch @ 2015-02-03 13:26 UTC (permalink / raw
  To: ruby-core

Issue #10765 has been updated by Vit Ondruch.

Status changed from Closed to Assigned

This breaks CentOS7, OpenSuse and Fedora at minimum:

http://rubyci.blob.core.windows.net/opensuse13/ruby-trunk/log/20150203T123003Z.log.html.gz
http://rubyci.blob.core.windows.net/fedora20/ruby-trunk/log/20150203T110002Z.log.html.gz
http://rubyci.blob.core.windows.net/centos7/ruby-trunk/log/20150203T110002Z.log.html.gz

~~~
/home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/.ext/common/json/common.rb:60:in `remove_method': method `to_json' not defined in Hash (NameError)
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/.ext/common/json/common.rb:60:in `block (3 levels) in generator='
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/.ext/common/json/common.rb:59:in `each'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/.ext/common/json/common.rb:59:in `block (2 levels) in generator='
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/.ext/common/json/common.rb:58:in `class_eval'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/.ext/common/json/common.rb:58:in `block in generator='
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/.ext/common/json/common.rb:55:in `each'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/.ext/common/json/common.rb:55:in `generator='
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/.ext/common/json/ext.rb:17:in `<module:Ext>'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/.ext/common/json/ext.rb:12:in `<module:JSON>'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/.ext/common/json/ext.rb:9:in `<top (required)>'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/.ext/common/json.rb:58:in `<module:JSON>'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/.ext/common/json.rb:54:in `<top (required)>'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/test/json/setup_variant.rb:10:in `<top (required)>'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/test/json/test_json.rb:5:in `<top (required)>'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/test/lib/test/unit.rb:826:in `block in non_options'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/test/lib/test/unit.rb:820:in `each'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/test/lib/test/unit.rb:820:in `non_options'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/test/lib/test/unit.rb:63:in `process_args'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/test/lib/test/unit.rb:101:in `process_args'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/test/lib/test/unit.rb:962:in `process_args'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/test/lib/test/unit.rb:967:in `run'
	from /home/hsbt/chkbuild/tmp/build/20150203T110002Z/ruby/test/lib/test/unit.rb:974:in `run'
	from ./test/runner.rb:40:in `<main>'
gmake: *** [yes-test-all] Error 1
exit 2
~~~

----------------------------------------
Bug #10765: Module#remove_method remove refined method entry.
https://bugs.ruby-lang.org/issues/10765#change-51367

* Author: Seiei Higa
* Status: Assigned
* Priority: Normal
* Assignee: Shugo Maeda
* ruby -v: ruby 2.3.0dev (2015-01-21 trunk 49326) [x86_64-darwin14]
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED
----------------------------------------
`Module#remove_method` should raise a `NameError`
if method is not defined in refined class, such as [`undef`](https://bugs.ruby-lang.org/issues/8966).
But if method is defined in refined class, `Module#remove_method` should keep refined method and remove original method.

I confirmed by following examples in ruby-trunk, 2.2.0, 2.1.5, 2.0.0-p598

``` ruby
class C
  def foo
    "C#foo"
  end
end

module RefinementBug
  refine C do
    def foo
      "RefinementBug#foo"
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

puts C.new.foo

# expected:
#   RefinementBug#foo
#
# actual:
#   bug.rb:21:in `<main>': undefined method `foo' for #<C:0x007f9e5c087b48> (NoMethodError)
```

``` ruby
class C
end

module RefinementBug
  refine C do
    def foo
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

# expected:
#   bug2.rb:14:in `remove_method': method `foo' not defined in C (NameError)
#   from bug2.rb:14:in `<class:C>'
#   from bug2.rb:13:in `<main>'
#
# actual:
#   # => nothing raised.
```

---Files--------------------------------
bug2.rb (327 Bytes)
bug.rb (342 Bytes)
0001-vm_method.c-fix-remove-refined-method.patch (2.68 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:67982] [ruby-trunk - Bug #10765] Module#remove_method remove refined method entry.
       [not found] <redmine.issue-10765.20150121134713@ruby-lang.org>
                   ` (4 preceding siblings ...)
  2015-02-03 13:26 ` [ruby-core:67978] [ruby-trunk - Bug #10765] [Assigned] " v.ondruch
@ 2015-02-03 15:20 ` hanachin
  2015-02-04  5:39 ` [ruby-core:67996] " shugo
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: hanachin @ 2015-02-03 15:20 UTC (permalink / raw
  To: ruby-core

Issue #10765 has been updated by Seiei Higa.


If touch the `me` after `rb_unlink_method_entry`, it could cause error?

``` patch
diff --git vm_method.c vm_method.c
index 8ad2b72..41a311c 100644
--- vm_method.c
+++ vm_method.c
@@ -775,11 +775,13 @@ remove_method(VALUE klass, ID mid)
     key = (st_data_t)mid;
     st_delete(RCLASS_M_TBL(klass), &key, &data);

+    int keep_refined_method_entry = me->def->type == VM_METHOD_TYPE_REFINED;
+
     rb_vm_check_redefinition_opt_method(me, klass);
     rb_clear_method_cache_by_class(klass);
     rb_unlink_method_entry(me);

-    if (me->def->type == VM_METHOD_TYPE_REFINED) {
+    if (keep_refined_method_entry) {
 	rb_add_refined_method_entry(klass, mid);
     }
```

----------------------------------------
Bug #10765: Module#remove_method remove refined method entry.
https://bugs.ruby-lang.org/issues/10765#change-51370

* Author: Seiei Higa
* Status: Assigned
* Priority: Normal
* Assignee: Shugo Maeda
* ruby -v: ruby 2.3.0dev (2015-01-21 trunk 49326) [x86_64-darwin14]
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED
----------------------------------------
`Module#remove_method` should raise a `NameError`
if method is not defined in refined class, such as [`undef`](https://bugs.ruby-lang.org/issues/8966).
But if method is defined in refined class, `Module#remove_method` should keep refined method and remove original method.

I confirmed by following examples in ruby-trunk, 2.2.0, 2.1.5, 2.0.0-p598

``` ruby
class C
  def foo
    "C#foo"
  end
end

module RefinementBug
  refine C do
    def foo
      "RefinementBug#foo"
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

puts C.new.foo

# expected:
#   RefinementBug#foo
#
# actual:
#   bug.rb:21:in `<main>': undefined method `foo' for #<C:0x007f9e5c087b48> (NoMethodError)
```

``` ruby
class C
end

module RefinementBug
  refine C do
    def foo
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

# expected:
#   bug2.rb:14:in `remove_method': method `foo' not defined in C (NameError)
#   from bug2.rb:14:in `<class:C>'
#   from bug2.rb:13:in `<main>'
#
# actual:
#   # => nothing raised.
```

---Files--------------------------------
bug2.rb (327 Bytes)
bug.rb (342 Bytes)
0001-vm_method.c-fix-remove-refined-method.patch (2.68 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:67996] [ruby-trunk - Bug #10765] Module#remove_method remove refined method entry.
       [not found] <redmine.issue-10765.20150121134713@ruby-lang.org>
                   ` (5 preceding siblings ...)
  2015-02-03 15:20 ` [ruby-core:67982] [ruby-trunk - Bug #10765] " hanachin
@ 2015-02-04  5:39 ` shugo
  2015-02-04  5:52 ` [ruby-core:67998] " shugo
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: shugo @ 2015-02-04  5:39 UTC (permalink / raw
  To: ruby-core

Issue #10765 has been updated by Shugo Maeda.


Seiei Higa wrote:
> If touch the `me` after `rb_unlink_method_entry`, it could cause error?

It's not the problem.

r49480 exposed the following potential problem:

```ruby
class X
  def foo
  end
end

class Y < X
end

module Bar
  refine Y do
    def foo
    end
  end
end

p Y.instance_methods(false).include?(:foo) # false expected, but true is returned
```

----------------------------------------
Bug #10765: Module#remove_method remove refined method entry.
https://bugs.ruby-lang.org/issues/10765#change-51382

* Author: Seiei Higa
* Status: Assigned
* Priority: Normal
* Assignee: Shugo Maeda
* ruby -v: ruby 2.3.0dev (2015-01-21 trunk 49326) [x86_64-darwin14]
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED
----------------------------------------
`Module#remove_method` should raise a `NameError`
if method is not defined in refined class, such as [`undef`](https://bugs.ruby-lang.org/issues/8966).
But if method is defined in refined class, `Module#remove_method` should keep refined method and remove original method.

I confirmed by following examples in ruby-trunk, 2.2.0, 2.1.5, 2.0.0-p598

``` ruby
class C
  def foo
    "C#foo"
  end
end

module RefinementBug
  refine C do
    def foo
      "RefinementBug#foo"
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

puts C.new.foo

# expected:
#   RefinementBug#foo
#
# actual:
#   bug.rb:21:in `<main>': undefined method `foo' for #<C:0x007f9e5c087b48> (NoMethodError)
```

``` ruby
class C
end

module RefinementBug
  refine C do
    def foo
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

# expected:
#   bug2.rb:14:in `remove_method': method `foo' not defined in C (NameError)
#   from bug2.rb:14:in `<class:C>'
#   from bug2.rb:13:in `<main>'
#
# actual:
#   # => nothing raised.
```

---Files--------------------------------
bug2.rb (327 Bytes)
bug.rb (342 Bytes)
0001-vm_method.c-fix-remove-refined-method.patch (2.68 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:67998] [ruby-trunk - Bug #10765] Module#remove_method remove refined method entry.
       [not found] <redmine.issue-10765.20150121134713@ruby-lang.org>
                   ` (6 preceding siblings ...)
  2015-02-04  5:39 ` [ruby-core:67996] " shugo
@ 2015-02-04  5:52 ` shugo
  2015-02-04  8:16 ` [ruby-core:68002] [ruby-trunk - Bug #10765] [Closed] " shugo
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: shugo @ 2015-02-04  5:52 UTC (permalink / raw
  To: ruby-core

Issue #10765 has been updated by Shugo Maeda.


The problem reported by Vit can be reproduced by the following command:

    $ make test-all TESTS="test/ruby/test_refinement.rb test/json"

----------------------------------------
Bug #10765: Module#remove_method remove refined method entry.
https://bugs.ruby-lang.org/issues/10765#change-51386

* Author: Seiei Higa
* Status: Assigned
* Priority: Normal
* Assignee: Shugo Maeda
* ruby -v: ruby 2.3.0dev (2015-01-21 trunk 49326) [x86_64-darwin14]
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED
----------------------------------------
`Module#remove_method` should raise a `NameError`
if method is not defined in refined class, such as [`undef`](https://bugs.ruby-lang.org/issues/8966).
But if method is defined in refined class, `Module#remove_method` should keep refined method and remove original method.

I confirmed by following examples in ruby-trunk, 2.2.0, 2.1.5, 2.0.0-p598

``` ruby
class C
  def foo
    "C#foo"
  end
end

module RefinementBug
  refine C do
    def foo
      "RefinementBug#foo"
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

puts C.new.foo

# expected:
#   RefinementBug#foo
#
# actual:
#   bug.rb:21:in `<main>': undefined method `foo' for #<C:0x007f9e5c087b48> (NoMethodError)
```

``` ruby
class C
end

module RefinementBug
  refine C do
    def foo
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

# expected:
#   bug2.rb:14:in `remove_method': method `foo' not defined in C (NameError)
#   from bug2.rb:14:in `<class:C>'
#   from bug2.rb:13:in `<main>'
#
# actual:
#   # => nothing raised.
```

---Files--------------------------------
bug2.rb (327 Bytes)
bug.rb (342 Bytes)
0001-vm_method.c-fix-remove-refined-method.patch (2.68 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:68002] [ruby-trunk - Bug #10765] [Closed] Module#remove_method remove refined method entry.
       [not found] <redmine.issue-10765.20150121134713@ruby-lang.org>
                   ` (7 preceding siblings ...)
  2015-02-04  5:52 ` [ruby-core:67998] " shugo
@ 2015-02-04  8:16 ` shugo
  2015-02-04 15:46 ` [ruby-core:68007] [ruby-trunk - Bug #10765] " v.ondruch
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: shugo @ 2015-02-04  8:16 UTC (permalink / raw
  To: ruby-core

Issue #10765 has been updated by Shugo Maeda.

Status changed from Assigned to Closed

Fixed in r49493.

----------------------------------------
Bug #10765: Module#remove_method remove refined method entry.
https://bugs.ruby-lang.org/issues/10765#change-51393

* Author: Seiei Higa
* Status: Closed
* Priority: Normal
* Assignee: Shugo Maeda
* ruby -v: ruby 2.3.0dev (2015-01-21 trunk 49326) [x86_64-darwin14]
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED
----------------------------------------
`Module#remove_method` should raise a `NameError`
if method is not defined in refined class, such as [`undef`](https://bugs.ruby-lang.org/issues/8966).
But if method is defined in refined class, `Module#remove_method` should keep refined method and remove original method.

I confirmed by following examples in ruby-trunk, 2.2.0, 2.1.5, 2.0.0-p598

``` ruby
class C
  def foo
    "C#foo"
  end
end

module RefinementBug
  refine C do
    def foo
      "RefinementBug#foo"
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

puts C.new.foo

# expected:
#   RefinementBug#foo
#
# actual:
#   bug.rb:21:in `<main>': undefined method `foo' for #<C:0x007f9e5c087b48> (NoMethodError)
```

``` ruby
class C
end

module RefinementBug
  refine C do
    def foo
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

# expected:
#   bug2.rb:14:in `remove_method': method `foo' not defined in C (NameError)
#   from bug2.rb:14:in `<class:C>'
#   from bug2.rb:13:in `<main>'
#
# actual:
#   # => nothing raised.
```

---Files--------------------------------
bug2.rb (327 Bytes)
bug.rb (342 Bytes)
0001-vm_method.c-fix-remove-refined-method.patch (2.68 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:68007] [ruby-trunk - Bug #10765] Module#remove_method remove refined method entry.
       [not found] <redmine.issue-10765.20150121134713@ruby-lang.org>
                   ` (8 preceding siblings ...)
  2015-02-04  8:16 ` [ruby-core:68002] [ruby-trunk - Bug #10765] [Closed] " shugo
@ 2015-02-04 15:46 ` v.ondruch
  2015-02-19  7:20 ` [ruby-core:68182] [Ruby trunk " naruse
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: v.ondruch @ 2015-02-04 15:46 UTC (permalink / raw
  To: ruby-core

Issue #10765 has been updated by Vit Ondruch.


Testing with r49495 and it seems to be fixed. Thanks.

----------------------------------------
Bug #10765: Module#remove_method remove refined method entry.
https://bugs.ruby-lang.org/issues/10765#change-51397

* Author: Seiei Higa
* Status: Closed
* Priority: Normal
* Assignee: Shugo Maeda
* ruby -v: ruby 2.3.0dev (2015-01-21 trunk 49326) [x86_64-darwin14]
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED
----------------------------------------
`Module#remove_method` should raise a `NameError`
if method is not defined in refined class, such as [`undef`](https://bugs.ruby-lang.org/issues/8966).
But if method is defined in refined class, `Module#remove_method` should keep refined method and remove original method.

I confirmed by following examples in ruby-trunk, 2.2.0, 2.1.5, 2.0.0-p598

``` ruby
class C
  def foo
    "C#foo"
  end
end

module RefinementBug
  refine C do
    def foo
      "RefinementBug#foo"
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

puts C.new.foo

# expected:
#   RefinementBug#foo
#
# actual:
#   bug.rb:21:in `<main>': undefined method `foo' for #<C:0x007f9e5c087b48> (NoMethodError)
```

``` ruby
class C
end

module RefinementBug
  refine C do
    def foo
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

# expected:
#   bug2.rb:14:in `remove_method': method `foo' not defined in C (NameError)
#   from bug2.rb:14:in `<class:C>'
#   from bug2.rb:13:in `<main>'
#
# actual:
#   # => nothing raised.
```

---Files--------------------------------
bug2.rb (327 Bytes)
bug.rb (342 Bytes)
0001-vm_method.c-fix-remove-refined-method.patch (2.68 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:68182] [Ruby trunk - Bug #10765] Module#remove_method remove refined method entry.
       [not found] <redmine.issue-10765.20150121134713@ruby-lang.org>
                   ` (9 preceding siblings ...)
  2015-02-04 15:46 ` [ruby-core:68007] [ruby-trunk - Bug #10765] " v.ondruch
@ 2015-02-19  7:20 ` naruse
  2015-02-25  6:01 ` [ruby-core:68302] " usa
  2015-03-17 16:13 ` [ruby-core:68544] " nagachika00
  12 siblings, 0 replies; 13+ messages in thread
From: naruse @ 2015-02-19  7:20 UTC (permalink / raw
  To: ruby-core

Issue #10765 has been updated by Yui NARUSE.

Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED to 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: DONE

ruby_2_2 r49647 merged revision(s) 49480,49493.

----------------------------------------
Bug #10765: Module#remove_method remove refined method entry.
https://bugs.ruby-lang.org/issues/10765#change-51555

* Author: Seiei Higa
* Status: Closed
* Priority: Normal
* Assignee: Shugo Maeda
* ruby -v: ruby 2.3.0dev (2015-01-21 trunk 49326) [x86_64-darwin14]
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: DONE
----------------------------------------
`Module#remove_method` should raise a `NameError`
if method is not defined in refined class, such as [`undef`](https://bugs.ruby-lang.org/issues/8966).
But if method is defined in refined class, `Module#remove_method` should keep refined method and remove original method.

I confirmed by following examples in ruby-trunk, 2.2.0, 2.1.5, 2.0.0-p598

``` ruby
class C
  def foo
    "C#foo"
  end
end

module RefinementBug
  refine C do
    def foo
      "RefinementBug#foo"
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

puts C.new.foo

# expected:
#   RefinementBug#foo
#
# actual:
#   bug.rb:21:in `<main>': undefined method `foo' for #<C:0x007f9e5c087b48> (NoMethodError)
```

``` ruby
class C
end

module RefinementBug
  refine C do
    def foo
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

# expected:
#   bug2.rb:14:in `remove_method': method `foo' not defined in C (NameError)
#   from bug2.rb:14:in `<class:C>'
#   from bug2.rb:13:in `<main>'
#
# actual:
#   # => nothing raised.
```

---Files--------------------------------
bug2.rb (327 Bytes)
bug.rb (342 Bytes)
0001-vm_method.c-fix-remove-refined-method.patch (2.68 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:68302] [Ruby trunk - Bug #10765] Module#remove_method remove refined method entry.
       [not found] <redmine.issue-10765.20150121134713@ruby-lang.org>
                   ` (10 preceding siblings ...)
  2015-02-19  7:20 ` [ruby-core:68182] [Ruby trunk " naruse
@ 2015-02-25  6:01 ` usa
  2015-03-17 16:13 ` [ruby-core:68544] " nagachika00
  12 siblings, 0 replies; 13+ messages in thread
From: usa @ 2015-02-25  6:01 UTC (permalink / raw
  To: ruby-core

Issue #10765 has been updated by Usaku NAKAMURA.

Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: DONE to 2.0.0: DONE, 2.1: REQUIRED, 2.2: DONE

ruby_2_0_0 r49738 merged revision(s) 49222,49480,49493.

----------------------------------------
Bug #10765: Module#remove_method remove refined method entry.
https://bugs.ruby-lang.org/issues/10765#change-51654

* Author: Seiei Higa
* Status: Closed
* Priority: Normal
* Assignee: Shugo Maeda
* ruby -v: ruby 2.3.0dev (2015-01-21 trunk 49326) [x86_64-darwin14]
* Backport: 2.0.0: DONE, 2.1: REQUIRED, 2.2: DONE
----------------------------------------
`Module#remove_method` should raise a `NameError`
if method is not defined in refined class, such as [`undef`](https://bugs.ruby-lang.org/issues/8966).
But if method is defined in refined class, `Module#remove_method` should keep refined method and remove original method.

I confirmed by following examples in ruby-trunk, 2.2.0, 2.1.5, 2.0.0-p598

``` ruby
class C
  def foo
    "C#foo"
  end
end

module RefinementBug
  refine C do
    def foo
      "RefinementBug#foo"
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

puts C.new.foo

# expected:
#   RefinementBug#foo
#
# actual:
#   bug.rb:21:in `<main>': undefined method `foo' for #<C:0x007f9e5c087b48> (NoMethodError)
```

``` ruby
class C
end

module RefinementBug
  refine C do
    def foo
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

# expected:
#   bug2.rb:14:in `remove_method': method `foo' not defined in C (NameError)
#   from bug2.rb:14:in `<class:C>'
#   from bug2.rb:13:in `<main>'
#
# actual:
#   # => nothing raised.
```

---Files--------------------------------
bug2.rb (327 Bytes)
bug.rb (342 Bytes)
0001-vm_method.c-fix-remove-refined-method.patch (2.68 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [ruby-core:68544] [Ruby trunk - Bug #10765] Module#remove_method remove refined method entry.
       [not found] <redmine.issue-10765.20150121134713@ruby-lang.org>
                   ` (11 preceding siblings ...)
  2015-02-25  6:01 ` [ruby-core:68302] " usa
@ 2015-03-17 16:13 ` nagachika00
  12 siblings, 0 replies; 13+ messages in thread
From: nagachika00 @ 2015-03-17 16:13 UTC (permalink / raw
  To: ruby-core

Issue #10765 has been updated by Tomoyuki Chikanaga.

Backport changed from 2.0.0: DONE, 2.1: REQUIRED, 2.2: DONE to 2.0.0: DONE, 2.1: DONE, 2.2: DONE

Backported into `ruby_2_1` branch at r49992.

----------------------------------------
Bug #10765: Module#remove_method remove refined method entry.
https://bugs.ruby-lang.org/issues/10765#change-51863

* Author: Seiei Higa
* Status: Closed
* Priority: Normal
* Assignee: Shugo Maeda
* ruby -v: ruby 2.3.0dev (2015-01-21 trunk 49326) [x86_64-darwin14]
* Backport: 2.0.0: DONE, 2.1: DONE, 2.2: DONE
----------------------------------------
`Module#remove_method` should raise a `NameError`
if method is not defined in refined class, such as [`undef`](https://bugs.ruby-lang.org/issues/8966).
But if method is defined in refined class, `Module#remove_method` should keep refined method and remove original method.

I confirmed by following examples in ruby-trunk, 2.2.0, 2.1.5, 2.0.0-p598

``` ruby
class C
  def foo
    "C#foo"
  end
end

module RefinementBug
  refine C do
    def foo
      "RefinementBug#foo"
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

puts C.new.foo

# expected:
#   RefinementBug#foo
#
# actual:
#   bug.rb:21:in `<main>': undefined method `foo' for #<C:0x007f9e5c087b48> (NoMethodError)
```

``` ruby
class C
end

module RefinementBug
  refine C do
    def foo
    end
  end
end

using RefinementBug

class C
  remove_method :foo
end

# expected:
#   bug2.rb:14:in `remove_method': method `foo' not defined in C (NameError)
#   from bug2.rb:14:in `<class:C>'
#   from bug2.rb:13:in `<main>'
#
# actual:
#   # => nothing raised.
```

---Files--------------------------------
bug2.rb (327 Bytes)
bug.rb (342 Bytes)
0001-vm_method.c-fix-remove-refined-method.patch (2.68 KB)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-03-17 16:06 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-10765.20150121134713@ruby-lang.org>
2015-01-21 13:47 ` [ruby-core:67722] [ruby-trunk - Bug #10765] [Open] Module#remove_method remove refined method entry hanachin
2015-01-21 13:50 ` [ruby-core:67723] [ruby-trunk - Bug #10765] " hanachin
2015-02-03  6:15 ` [ruby-core:67967] [ruby-trunk - Bug #10765] [Assigned] " shugo
2015-02-03  6:30 ` [ruby-core:67969] [ruby-trunk - Bug #10765] " shugo
2015-02-03 13:26 ` [ruby-core:67978] [ruby-trunk - Bug #10765] [Assigned] " v.ondruch
2015-02-03 15:20 ` [ruby-core:67982] [ruby-trunk - Bug #10765] " hanachin
2015-02-04  5:39 ` [ruby-core:67996] " shugo
2015-02-04  5:52 ` [ruby-core:67998] " shugo
2015-02-04  8:16 ` [ruby-core:68002] [ruby-trunk - Bug #10765] [Closed] " shugo
2015-02-04 15:46 ` [ruby-core:68007] [ruby-trunk - Bug #10765] " v.ondruch
2015-02-19  7:20 ` [ruby-core:68182] [Ruby trunk " naruse
2015-02-25  6:01 ` [ruby-core:68302] " usa
2015-03-17 16:13 ` [ruby-core:68544] " nagachika00

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).