Forum: Ruby-core [ruby-trunk - Bug #7564][Open] r38175 introduces incompatibility

Posted by tenderlovemaking (Aaron Patterson) (Guest)
on 2012-12-14 19:03
(Received via mailing list)
Issue #7564 has been reported by tenderlovemaking (Aaron Patterson).

----------------------------------------
Bug #7564: r38175 introduces incompatibility
https://bugs.ruby-lang.org/issues/7564

Author: tenderlovemaking (Aaron Patterson)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: ruby 2.0.0dev (2012-12-15 trunk 38381) [x86_64-darwin12.2.1]


r38175 introduces incompatibility with 1.9.3.  Before r38175, when 
looking for _dump, Marshal would not call method_missing.  Now marshal 
calls method_missing when trying to dump.

The following example exits with no error on 1.9.3, but on trunk it 
raises an exception (_dump() must return string (TypeError)):

class TR
  def initialize calls = []
    @calls = calls
  end

  def method_missing name, *args
    @calls << [name, args]
  end
end

Marshal.dump TR.new

I've attached a test case.
Posted by ko1 (Koichi Sasada) (Guest)
on 2012-12-17 18:34
(Received via mailing list)
Issue #7564 has been updated by ko1 (Koichi Sasada).

Category set to core
Assignee set to mame (Yusuke Endoh)
Target version set to 2.0.0

mame-san, how about this ticket?

----------------------------------------
Bug #7564: r38175 introduces incompatibility
https://bugs.ruby-lang.org/issues/7564#change-34803

Author: tenderlovemaking (Aaron Patterson)
Status: Open
Priority: Normal
Assignee: mame (Yusuke Endoh)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-12-15 trunk 38381) [x86_64-darwin12.2.1]


r38175 introduces incompatibility with 1.9.3.  Before r38175, when 
looking for _dump, Marshal would not call method_missing.  Now marshal 
calls method_missing when trying to dump.

The following example exits with no error on 1.9.3, but on trunk it 
raises an exception (_dump() must return string (TypeError)):

class TR
  def initialize calls = []
    @calls = calls
  end

  def method_missing name, *args
    @calls << [name, args]
  end
end

Marshal.dump TR.new

I've attached a test case.
Posted by tenderlovemaking (Aaron Patterson) (Guest)
on 2012-12-18 18:47
(Received via mailing list)
Issue #7564 has been updated by tenderlovemaking (Aaron Patterson).


Bump. /cc nobu
----------------------------------------
Bug #7564: r38175 introduces incompatibility
https://bugs.ruby-lang.org/issues/7564#change-34834

Author: tenderlovemaking (Aaron Patterson)
Status: Open
Priority: Normal
Assignee: mame (Yusuke Endoh)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-12-15 trunk 38381) [x86_64-darwin12.2.1]


r38175 introduces incompatibility with 1.9.3.  Before r38175, when 
looking for _dump, Marshal would not call method_missing.  Now marshal 
calls method_missing when trying to dump.

The following example exits with no error on 1.9.3, but on trunk it 
raises an exception (_dump() must return string (TypeError)):

class TR
  def initialize calls = []
    @calls = calls
  end

  def method_missing name, *args
    @calls << [name, args]
  end
end

Marshal.dump TR.new

I've attached a test case.
Posted by zenspider (Ryan Davis) (Guest)
on 2012-12-19 02:06
(Received via mailing list)
Issue #7564 has been updated by zenspider (Ryan Davis).


I'm getting bit by this in my multi-version CI on Flay and any other 
project that uses the sexp gem and calls my deep_clone:

  def deep_clone
    Marshal.load(Marshal.dump(self))
  end

----------------------------------------
Bug #7564: r38175 introduces incompatibility
https://bugs.ruby-lang.org/issues/7564#change-34837

Author: tenderlovemaking (Aaron Patterson)
Status: Open
Priority: Normal
Assignee: mame (Yusuke Endoh)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-12-15 trunk 38381) [x86_64-darwin12.2.1]


r38175 introduces incompatibility with 1.9.3.  Before r38175, when 
looking for _dump, Marshal would not call method_missing.  Now marshal 
calls method_missing when trying to dump.

The following example exits with no error on 1.9.3, but on trunk it 
raises an exception (_dump() must return string (TypeError)):

class TR
  def initialize calls = []
    @calls = calls
  end

  def method_missing name, *args
    @calls << [name, args]
  end
end

Marshal.dump TR.new

I've attached a test case.
Posted by usa (Usaku NAKAMURA) (Guest)
on 2012-12-21 14:20
(Received via mailing list)
Issue #7564 has been updated by usa (Usaku NAKAMURA).

Status changed from Open to Assigned


----------------------------------------
Bug #7564: r38175 introduces incompatibility
https://bugs.ruby-lang.org/issues/7564#change-34943

Author: tenderlovemaking (Aaron Patterson)
Status: Assigned
Priority: Normal
Assignee: mame (Yusuke Endoh)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-12-15 trunk 38381) [x86_64-darwin12.2.1]


r38175 introduces incompatibility with 1.9.3.  Before r38175, when 
looking for _dump, Marshal would not call method_missing.  Now marshal 
calls method_missing when trying to dump.

The following example exits with no error on 1.9.3, but on trunk it 
raises an exception (_dump() must return string (TypeError)):

class TR
  def initialize calls = []
    @calls = calls
  end

  def method_missing name, *args
    @calls << [name, args]
  end
end

Marshal.dump TR.new

I've attached a test case.
Posted by Nobuyoshi Nakada (nobu)
on 2012-12-23 02:04
(Received via mailing list)
Issue #7564 has been updated by nobu (Nobuyoshi Nakada).

Status changed from Assigned to Rejected

If method_missing does not deal with a method call, it should raise 
NoMethodError.

 def method_missing name, *args
   @calls << [name, args]
   super
 end
----------------------------------------
Bug #7564: r38175 introduces incompatibility
https://bugs.ruby-lang.org/issues/7564#change-35017

Author: tenderlovemaking (Aaron Patterson)
Status: Rejected
Priority: Normal
Assignee: mame (Yusuke Endoh)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-12-15 trunk 38381) [x86_64-darwin12.2.1]


r38175 introduces incompatibility with 1.9.3.  Before r38175, when 
looking for _dump, Marshal would not call method_missing.  Now marshal 
calls method_missing when trying to dump.

The following example exits with no error on 1.9.3, but on trunk it 
raises an exception (_dump() must return string (TypeError)):

class TR
  def initialize calls = []
    @calls = calls
  end

  def method_missing name, *args
    @calls << [name, args]
  end
end

Marshal.dump TR.new

I've attached a test case.
Posted by Aaron Patterson (tenderlove)
on 2012-12-23 20:56
(Received via mailing list)
On Sun, Dec 23, 2012 at 10:01:33AM +0900, nobu (Nobuyoshi Nakada) wrote:
>  end
Before this changeset, `method_missing` *did* deal with all method
calls.  That's why this is not backwards compatible.
Posted by zenspider (Ryan Davis) (Guest)
on 2012-12-29 05:39
(Received via mailing list)
Issue #7564 has been updated by zenspider (Ryan Davis).


I still think this is a bug, as shown by needing a respond_to? that does 
nothing more than call super:

class Sexp < Array
  def inspect
    "s(#{map(&:inspect).join ', '})"
  end

  def respond_to? meth
    super
  end if ENV["WHY_DO_I_NEED_THIS"]

  def method_missing meth, delete = false
    raise "shouldn't be here: #{meth.inspect}"
  end
end

def s *args
  Sexp.new args
end

p Marshal.load Marshal.dump s(1, 2, 3)
puts

# % WHY_DO_I_NEED_THIS=1 ruby20 trunk_bug.rb && ruby20 trunk_bug.rb
# s(1, 2, 3)
#
# trunk_bug.rb:11:in `method_missing': shouldn't be here: :marshal_dump 
(RuntimeError)
#       from trunk_bug.rb:19:in `dump'
#       from trunk_bug.rb:19:in `<main>'

----------------------------------------
Bug #7564: r38175 introduces incompatibility
https://bugs.ruby-lang.org/issues/7564#change-35131

Author: tenderlovemaking (Aaron Patterson)
Status: Rejected
Priority: Normal
Assignee: mame (Yusuke Endoh)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-12-15 trunk 38381) [x86_64-darwin12.2.1]


r38175 introduces incompatibility with 1.9.3.  Before r38175, when 
looking for _dump, Marshal would not call method_missing.  Now marshal 
calls method_missing when trying to dump.

The following example exits with no error on 1.9.3, but on trunk it 
raises an exception (_dump() must return string (TypeError)):

class TR
  def initialize calls = []
    @calls = calls
  end

  def method_missing name, *args
    @calls << [name, args]
  end
end

Marshal.dump TR.new

I've attached a test case.
Posted by zenspider (Ryan Davis) (Guest)
on 2013-01-02 23:26
(Received via mailing list)
Issue #7564 has been updated by zenspider (Ryan Davis).

Status changed from Rejected to Open

No, really. This is a bug that needs more eyeballs.

A respond_to? with just a super should be equivalent to no code at all.

Can we get Matz and Mame to weigh in?
----------------------------------------
Bug #7564: r38175 introduces incompatibility
https://bugs.ruby-lang.org/issues/7564#change-35184

Author: tenderlovemaking (Aaron Patterson)
Status: Open
Priority: Normal
Assignee: mame (Yusuke Endoh)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-12-15 trunk 38381) [x86_64-darwin12.2.1]


r38175 introduces incompatibility with 1.9.3.  Before r38175, when 
looking for _dump, Marshal would not call method_missing.  Now marshal 
calls method_missing when trying to dump.

The following example exits with no error on 1.9.3, but on trunk it 
raises an exception (_dump() must return string (TypeError)):

class TR
  def initialize calls = []
    @calls = calls
  end

  def method_missing name, *args
    @calls << [name, args]
  end
end

Marshal.dump TR.new

I've attached a test case.
Posted by Nobuyoshi Nakada (nobu)
on 2013-01-04 05:02
(Received via mailing list)
Issue #7564 has been updated by nobu (Nobuyoshi Nakada).


Anonymous wrote:
>  Before this changeset, `method_missing` *did* deal with all method
>  calls.

No, previously `respond_to?' was called so `method_missing' did *not* 
get called.

>  That's why this is not backwards compatible.

It depended on the internal behavior too much.
And the bug that overriding `method_missing' without 
`respond_to_missing?' has been revealed.
Just like overriding `hash' without `eql?'.

----------------------------------------
Bug #7564: r38175 introduces incompatibility
https://bugs.ruby-lang.org/issues/7564#change-35198

Author: tenderlovemaking (Aaron Patterson)
Status: Open
Priority: Normal
Assignee: mame (Yusuke Endoh)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-12-15 trunk 38381) [x86_64-darwin12.2.1]


r38175 introduces incompatibility with 1.9.3.  Before r38175, when 
looking for _dump, Marshal would not call method_missing.  Now marshal 
calls method_missing when trying to dump.

The following example exits with no error on 1.9.3, but on trunk it 
raises an exception (_dump() must return string (TypeError)):

class TR
  def initialize calls = []
    @calls = calls
  end

  def method_missing name, *args
    @calls << [name, args]
  end
end

Marshal.dump TR.new

I've attached a test case.
Posted by zenspider (Ryan Davis) (Guest)
on 2013-01-11 01:38
(Received via mailing list)
Issue #7564 has been updated by zenspider (Ryan Davis).


=begin
This seems highly inconsistent to me. Specifically, MM + RT is the only 
working solution, but RT implementation is entirely meaningless. It 
doesn't make sense to me that I need a method table entry that does 
nothing but super. That should be the same as not existing in the method 
table.

 ##
 # Notes:
 #
 # Runtime        = Passes        Failures
 # 
---------------------------------------------------------------------------
 # (none)         =             | 1.8 1.9 2.0 fails #blah (expected)
 # MM             = 1.8 1.9     | 2.0 raises w/ marshal_dump
 # MM + RT        = 1.8 1.9 2.0 |
 # MM +      RTM  = 1.8 1.9     | 2.0 raises w/ marshal_dump (doesn't 
use RTM)
 # MM + RT + RTM  = 1.8 1.9 2.0 |
 # MM +      ARTM = 1.8         | 1.9 SSE, 2.0 raises
 # MM + RT + ARTM = 1.8         | 1.9 SSE, 2.0 SSE (SystemStackError)
 #      RT        =             | 1.8 1.9 2.0 fails #blah (expected)
 #           RTM  =             | 1.8 1.9 2.0 fails #blah (expected)
 #           ARTM =             | 1.8 2.0 fails #blah (expected), 1.9 
SSE

  class Sexp < Array
    def inspect
      "s(#{map(&:inspect).join ', '})"
    end

    def method_missing meth, delete = false
      x = nil
      return x if x = find { |o| Sexp === o && o.first == meth }
      raise "shouldn't be here: #{inspect}.#{meth}"
    end if ENV["MM"]

    def respond_to? meth, private = false
      p :respond_to? => meth if ENV["V"]
      super
    end if ENV["RT"]

    def respond_to_missing? meth, private = false
      p :respond_to_missing? => meth if ENV["V"]
      super
    end if ENV["RTM"]

    alias respond_to_missing? respond_to? if ENV["ARTM"]
  end

  def s *args
    Sexp.new args
  end

  END { puts }
  p Marshal.load Marshal.dump s(1, 2, 3)
  p s(1, 2, s(:blah)).blah

=end

----------------------------------------
Bug #7564: r38175 introduces incompatibility
https://bugs.ruby-lang.org/issues/7564#change-35337

Author: tenderlovemaking (Aaron Patterson)
Status: Open
Priority: Normal
Assignee: mame (Yusuke Endoh)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-12-15 trunk 38381) [x86_64-darwin12.2.1]


r38175 introduces incompatibility with 1.9.3.  Before r38175, when 
looking for _dump, Marshal would not call method_missing.  Now marshal 
calls method_missing when trying to dump.

The following example exits with no error on 1.9.3, but on trunk it 
raises an exception (_dump() must return string (TypeError)):

class TR
  def initialize calls = []
    @calls = calls
  end

  def method_missing name, *args
    @calls << [name, args]
  end
end

Marshal.dump TR.new

I've attached a test case.
Posted by ko1 (Koichi Sasada) (Guest)
on 2013-01-15 02:02
(Received via mailing list)
Issue #7564 has been updated by ko1 (Koichi Sasada).

Priority changed from Normal to Immediate


----------------------------------------
Bug #7564: r38175 introduces incompatibility
https://bugs.ruby-lang.org/issues/7564#change-35418

Author: tenderlovemaking (Aaron Patterson)
Status: Open
Priority: Immediate
Assignee: mame (Yusuke Endoh)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-12-15 trunk 38381) [x86_64-darwin12.2.1]


r38175 introduces incompatibility with 1.9.3.  Before r38175, when 
looking for _dump, Marshal would not call method_missing.  Now marshal 
calls method_missing when trying to dump.

The following example exits with no error on 1.9.3, but on trunk it 
raises an exception (_dump() must return string (TypeError)):

class TR
  def initialize calls = []
    @calls = calls
  end

  def method_missing name, *args
    @calls << [name, args]
  end
end

Marshal.dump TR.new

I've attached a test case.
Posted by matz (Yukihiro Matsumoto) (Guest)
on 2013-01-18 19:48
(Received via mailing list)
Issue #7564 has been updated by matz (Yukihiro Matsumoto).


Since this is incompatibility, I propose to get back to the old 
behavior, for 2.0.
We have to discuss the issue that @zenspider mentioned in separated 
thread.

Matz.

----------------------------------------
Bug #7564: r38175 introduces incompatibility
https://bugs.ruby-lang.org/issues/7564#change-35479

Author: tenderlovemaking (Aaron Patterson)
Status: Open
Priority: Immediate
Assignee: mame (Yusuke Endoh)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-12-15 trunk 38381) [x86_64-darwin12.2.1]


r38175 introduces incompatibility with 1.9.3.  Before r38175, when 
looking for _dump, Marshal would not call method_missing.  Now marshal 
calls method_missing when trying to dump.

The following example exits with no error on 1.9.3, but on trunk it 
raises an exception (_dump() must return string (TypeError)):

class TR
  def initialize calls = []
    @calls = calls
  end

  def method_missing name, *args
    @calls << [name, args]
  end
end

Marshal.dump TR.new

I've attached a test case.
Posted by mame (Yusuke Endoh) (Guest)
on 2013-01-20 08:55
(Received via mailing list)
Issue #7564 has been updated by mame (Yusuke Endoh).

Status changed from Open to Assigned
Assignee changed from mame (Yusuke Endoh) to nobu (Nobuyoshi Nakada)

I agree with Matz.  Nobu, please handle this.
----------------------------------------
Bug #7564: r38175 introduces incompatibility
https://bugs.ruby-lang.org/issues/7564#change-35494

Author: tenderlovemaking (Aaron Patterson)
Status: Assigned
Priority: Immediate
Assignee: nobu (Nobuyoshi Nakada)
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-12-15 trunk 38381) [x86_64-darwin12.2.1]


r38175 introduces incompatibility with 1.9.3.  Before r38175, when 
looking for _dump, Marshal would not call method_missing.  Now marshal 
calls method_missing when trying to dump.

The following example exits with no error on 1.9.3, but on trunk it 
raises an exception (_dump() must return string (TypeError)):

class TR
  def initialize calls = []
    @calls = calls
  end

  def method_missing name, *args
    @calls << [name, args]
  end
end

Marshal.dump TR.new

I've attached a test case.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.