Marshal#dump incorrerctly serializes objects that respond to _dump.
-------------------------------------------------------------------

                 Key: JRUBY-1980
                 URL: http://jira.codehaus.org/browse/JRUBY-1980
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1RC1
         Environment: Latest JRuby 1.1RC1 from trunk
            Reporter: Vladimir Sizikov
            Assignee: Vladimir Sizikov


Consider the following example:

{noformat}
module Meths
end

class Custom
  def _dump(depth); "stuff"; end
  def self._load(s); Custom.new; end
end

obj = Custom.new.extend(Meths)

p Marshal.dump(obj)
p Marshal.dump(Marshal.load(Marshal.dump(obj))) == Marshal.dump(obj)
{noformat}

MRI prints:
"\004\bu:\vCustom\nstuff"
true
JRuby prints:
"\004\bu:\nMeths\nstuff"
Meths does not refer class (ArgumentError)

This leads to two rubyspec failures:
2)
Marshal.dump with any extended_object having _dump method returns a 
string-serialized version of the          given argument FAILED
Expected "\004\bu:\nMeths\nstuff" to equal "\004\bu:\vCustom\nstuff":
./mspec/expectations.rb:10:in `fail_with'
./mspec/matchers/base.rb:8:in `=='
/opt/work/rubinius/./spec/ruby/1.8/core/marshal/dump_spec.rb:310
/opt/work/rubinius/./spec/ruby/1.8/core/marshal/dump_spec.rb:309:in `call'
./mspec/runner/runner.rb:136:in `describe'
./mspec/runner/runner.rb:135:in `each'
./mspec/runner/runner.rb:130:in `describe'
./mspec/runner/runner.rb:135:in `describe'
/opt/work/rubinius/./spec/ruby/1.8/core/marshal/dump_spec.rb:308
/opt/work/rubinius/./spec/ruby/1.8/core/marshal/dump_spec.rb:308:in `load'
tmp/last_ci.rb:52
tmp/last_ci.rb:44:in `each'
tmp/last_ci.rb:44

3)
Marshal.dump with any extended_object having marshal_dump method returns a 
string-serialized version          of the given argument FAILED
Expected "\004\bU:\nMeths\"\nstuff" to equal "\004\bU:\020OtherCustom\"\nstuff":
./mspec/expectations.rb:10:in `fail_with'
./mspec/matchers/base.rb:8:in `=='
/opt/work/rubinius/./spec/ruby/1.8/core/marshal/dump_spec.rb:334
/opt/work/rubinius/./spec/ruby/1.8/core/marshal/dump_spec.rb:333:in `call'
./mspec/runner/runner.rb:136:in `describe'
./mspec/runner/runner.rb:135:in `each'
./mspec/runner/runner.rb:130:in `describe'
./mspec/runner/runner.rb:135:in `describe'
/opt/work/rubinius/./spec/ruby/1.8/core/marshal/dump_spec.rb:332
/opt/work/rubinius/./spec/ruby/1.8/core/marshal/dump_spec.rb:332:in `load'
tmp/last_ci.rb:52
tmp/last_ci.rb:44:in `each'
tmp/last_ci.rb:44

Fix is coming.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to