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

ruby 3.3.0 'incompatible marshal file format` errors #4

Open
mattlindsey opened this issue Feb 15, 2024 · 2 comments
Open

ruby 3.3.0 'incompatible marshal file format` errors #4

mattlindsey opened this issue Feb 15, 2024 · 2 comments

Comments

@mattlindsey
Copy link

mattlindsey commented Feb 15, 2024

Four of the tests fail in ruby 3.3.0 (although they work in 3.2.2) with an incompatible marshal file format error, even after updating gem dependencies:

Finished in 5.32 seconds (files took 0.04708 seconds to load)
25 examples, 4 failures

Failed examples:

rspec ./spec/safe_ruby_spec.rb:5 # SafeRuby#eval allows basic operations
rspec ./spec/safe_ruby_spec.rb:10 # SafeRuby#eval returns correct object
rspec ./spec/safe_ruby_spec.rb:46 # SafeRuby#eval options timeout defaults to a 5 second timeout
rspec ./spec/safe_ruby_spec.rb:53 # SafeRuby#eval options timeout allows custom timeout

Here is the first one:

  1) SafeRuby#eval allows basic operations
     Failure/Error: raise data

     RuntimeError:
       /var/folders/cy/7pf5w_mj4fg3n6hzjxjs01mr0000gn/T/saferuby20240215-86452-xokox4:17:in `undef_method': undefined method `new' for class `String' (NameError)

           klass.send(:undef_method, method)
                ^^^^^
       Did you mean?  next
       	from /var/folders/cy/7pf5w_mj4fg3n6hzjxjs01mr0000gn/T/saferuby20240215-86452-xokox4:17:in `block in keep_methods'
       	from /var/folders/cy/7pf5w_mj4fg3n6hzjxjs01mr0000gn/T/saferuby20240215-86452-xokox4:16:in `each'
       	from /var/folders/cy/7pf5w_mj4fg3n6hzjxjs01mr0000gn/T/saferuby20240215-86452-xokox4:16:in `keep_methods'
       	from /var/folders/cy/7pf5w_mj4fg3n6hzjxjs01mr0000gn/T/saferuby20240215-86452-xokox4:37:in `<main>'
     # ./lib/safe_ruby/runner.rb:45:in `rescue in eval'
     # ./lib/safe_ruby/runner.rb:41:in `eval'
     # ./lib/safe_ruby/runner.rb:20:in `eval'
     # ./spec/safe_ruby_spec.rb:6:in `block (3 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # TypeError:
     #   incompatible marshal file format (can't be read)
     #   	format version 4.8 required; 47.118 given
     #   ./lib/safe_ruby/runner.rb:42:in `eval'
@fguillen-getsafe
Copy link

Same here:

❯ ruby -v
ruby 3.3.4 (2024-07-09 revision be1089c8ec) [x86_64-darwin23]

❯ bundle list | grep safe_ruby

  • safe_ruby (1.0.4)
irb(main):003> SafeRuby.eval('[1,2,3].map{ |n| n + 1 }') 
(irb):3:in `<main>': /var/folders/6y/3sx9kpx94sq7wpqcsncvy48c0000gn/T/saferuby20240819-8365-uo4s2w:17:in `undef_method': undefined method `new' for class `String' (NameError) (RuntimeError)

    klass.send(:undef_method, method)
         ^^^^^
Did you mean?  next
	from /var/folders/6y/3sx9kpx94sq7wpqcsncvy48c0000gn/T/saferuby20240819-8365-uo4s2w:17:in `block in keep_methods'
	from /var/folders/6y/3sx9kpx94sq7wpqcsncvy48c0000gn/T/saferuby20240819-8365-uo4s2w:16:in `each'
	from /var/folders/6y/3sx9kpx94sq7wpqcsncvy48c0000gn/T/saferuby20240819-8365-uo4s2w:16:in `keep_methods'
	from /var/folders/6y/3sx9kpx94sq7wpqcsncvy48c0000gn/T/saferuby20240819-8365-uo4s2w:37:in `<main>'

	from <internal:kernel>:187:in `loop'
	from /Users/me/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/irb-1.14.0/exe/irb:9:in `<top (required)>'
	from /Users/me/.rbenv/versions/3.3.4/bin/irb:25:in `load'
	from /Users/me/.rbenv/versions/3.3.4/bin/irb:25:in `<main>'
<internal:marshal>:34:in `load': incompatible marshal file format (can't be read) (TypeError)
	format version 4.8 required; 47.118 given
	from /Users/me/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/safe_ruby-1.0.4/lib/safe_ruby/runner.rb:42:in `eval'
	from /Users/me/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/safe_ruby-1.0.4/lib/safe_ruby/runner.rb:20:in `eval'
	from (irb):3:in `<main>'
	from /Users/me/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/irb-1.14.0/lib/irb/workspace.rb:121:in `eval'
	from /Users/fernando.gui

@jeromeag
Copy link

jeromeag commented Oct 4, 2024

Fixed in 1.0.5
New homepage is https://gitlab.com/defmastership/safe_ruby

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

Successfully merging a pull request may close this issue.

3 participants