Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Truffle] Method constant_table needed for Gem commands #2900

Closed
bjfish opened this issue Apr 30, 2015 · 3 comments
Closed

[Truffle] Method constant_table needed for Gem commands #2900

bjfish opened this issue Apr 30, 2015 · 3 comments
Assignees

Comments

@bjfish
Copy link
Contributor

bjfish commented Apr 30, 2015

Example

a = [4, 8, 123, 21, 58, 16, 101, 110, 118, 95, 115, 104, 101, 98, 97, 110, 103, 70, 58, 13, 100, 111, 99, 117, 109, 101, 110, 116, 91, 6, 73, 34, 7, 114, 105, 6, 58, 6, 69, 84, 58, 11, 100, 111, 109, 97, 105, 110, 58, 9, 98, 111, 116, 104, 58, 10, 102, 111, 114, 99, 101, 70, 58, 22, 102, 111, 114, 109, 97, 116, 95, 101, 120, 101, 99, 117, 116, 97, 98, 108, 101, 70, 58, 24, 105, 103, 110, 111, 114, 101, 95, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 70, 58, 15, 112, 114, 101, 114, 101, 108, 101, 97, 115, 101, 70, 58, 20, 115, 101, 99, 117, 114, 105, 116, 121, 95, 112, 111, 108, 105, 99, 121, 48, 58, 13, 119, 114, 97, 112, 112, 101, 114, 115, 84, 58, 15, 98, 117, 105, 108, 100, 95, 97, 114, 103, 115, 48, 58, 29, 98, 117, 105, 108, 100, 95, 100, 111, 99, 115, 95, 105, 110, 95, 98, 97, 99, 107, 103, 114, 111, 117, 110, 100, 70, 58, 23, 105, 110, 115, 116, 97, 108, 108, 95, 97, 115, 95, 100, 101, 102, 97, 117, 108, 116, 70, 58, 9, 108, 111, 99, 107, 84, 58, 22, 115, 117, 103, 103, 101, 115, 116, 95, 97, 108, 116, 101, 114, 110, 97, 116, 101, 84, 58, 12, 118, 101, 114, 115, 105, 111, 110, 85, 58, 21, 71, 101, 109, 58, 58, 82, 101, 113, 117, 105, 114, 101, 109, 101, 110, 116, 91, 6, 91, 6, 91, 7, 73, 34, 7, 62, 61, 6, 59, 7, 84, 85, 58, 17, 71, 101, 109, 58, 58, 86, 101, 114, 115, 105, 111, 110, 91, 6, 73, 34, 6, 48, 6, 59, 7, 70, 58, 19, 119, 105, 116, 104, 111, 117, 116, 95, 103, 114, 111, 117, 112, 115, 91, 0]
str = a.pack('c*')
puts Marshal.load(str)

Expected (ruby,jruby)

$ruby marshal.rb 
{:env_shebang=>false, :document=>["ri"], :domain=>:both, :force=>false, :format_executable=>false, :ignore_dependencies=>false, :prerelease=>false, :security_policy=>nil, :wrappers=>true, :build_args=>nil, :build_docs_in_background=>false, :install_as_default=>false, :lock=>true, :suggest_alternate=>true, :version=>#<Gem::Requirement:0x007ff19388d5b0 @requirements=[[">=", #<Gem::Version "0">]]>, :without_groups=>[]}

Actual

$ ~/Documents/jruby/bin/jruby -X+T marshal.rb 
core:/core/rubinius/common/type.rb:276:in `method_missing': undefined method `constant_table' for Object:Class (NoMethodError)
    from core:/core/rubinius/common/type.rb:276:in `const_exists?'
    from core:/core/rubinius/common/marshal.rb:474:in `block in const_lookup'
    from core:/core/rubinius/common/marshal.rb:473:in `each'
    from core:/core/rubinius/common/marshal.rb:473:in `const_lookup'
    from core:/core/rubinius/common/marshal.rb:864:in `construct_user_marshal'
    from core:/core/rubinius/common/marshal.rb:549:in `construct'
    from core:/core/rubinius/common/marshal.rb:701:in `block in construct_hash'
    from core:/core/rubinius/common/marshal.rb:699:in `times'
    from core:/core/rubinius/common/marshal.rb:699:in `construct_hash'
    from core:/core/rubinius/common/marshal.rb:539:in `construct'
    from core:/core/rubinius/common/marshal.rb:1233:in `load'
    from marshal.rb:3:in `<main>'
@chrisseaton chrisseaton added this to the truffle-dev milestone May 4, 2015
@chrisseaton chrisseaton self-assigned this May 8, 2015
@chrisseaton
Copy link
Contributor

I think fixed in 0b342f7, but I can't run your program as it looks like it's missing other code from what you were trying to run:

core:/core/rubinius/common/marshal.rb:475:in `block in const_lookup': undefined class/module Gem::Requirement (ArgumentError)
    from core:/core/rubinius/common/marshal.rb:473:in `const_lookup'
    from core:/core/rubinius/common/marshal.rb:864:in `construct_user_marshal'
    from core:/core/rubinius/common/marshal.rb:549:in `construct'
    from core:/core/rubinius/common/marshal.rb:701:in `block in construct_hash'
    from core:/core/rubinius/common/marshal.rb:699:in `construct_hash'
    from core:/core/rubinius/common/marshal.rb:539:in `construct'
    from core:/core/rubinius/common/marshal.rb:1233:in `load'

@bjfish
Copy link
Contributor Author

bjfish commented May 9, 2015

I think this is still an issue:
Actual

jt e 'puts Marshal.send(:restore, "\x04\bc\vString")'
core:/core/rubinius/common/type.rb:240:in `method_missing': undefined method `constant_table' for Object:Class (NoMethodError)
    from core:/core/rubinius/common/type.rb:240:in `const_get'
    from core:/core/rubinius/common/marshal.rb:478:in `block in const_lookup'
    from core:/core/rubinius/common/marshal.rb:473:in `const_lookup'
    from core:/core/rubinius/common/marshal.rb:602:in `construct_class'
    from core:/core/rubinius/common/marshal.rb:519:in `construct'
    from core:/core/rubinius/common/marshal.rb:1233:in `load'
    from -e:1:in `<main>'

Expected

ruby -e 'puts Marshal.send(:restore, "\x04\bc\vString")'
String

@bjfish bjfish reopened this May 9, 2015
@chrisseaton
Copy link
Contributor

Fixed in c557db0

This was a different but related issue. The Rubinius marshal implementation directly calls some internal methods. Those try to access data structures which aren't there - so we need to replace these methods with our versions.

@enebo enebo added this to the Invalid or Duplicate milestone Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants