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

Doesn't work after upgrading to Ruby 3.1 #57

Open
sixtyfive opened this issue May 24, 2022 · 2 comments
Open

Doesn't work after upgrading to Ruby 3.1 #57

sixtyfive opened this issue May 24, 2022 · 2 comments

Comments

@sixtyfive
Copy link

sixtyfive commented May 24, 2022

I believe this has something to do with Psych 4.0.4 (ruby/psych#487 ?). Just changing rehash.rb line 256 to use #safe_load is not enough and I'm not sure which permitted_classes need to be specified (for me personally, YAML.safe_load(f, permitted_classes: [OpenStruct, Pathname]) worked).

Backtrace:

/home/jrs/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/class_loader.rb:99:in `find': Tried to load unspecified class: OpenStruct (Psych::DisallowedClass)
        from /home/jrs/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/class_loader.rb:28:in `load'
        from /home/jrs/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:424:in `resolve_class'
        from /home/jrs/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:213:in `visit_Psych_Nodes_Mapping'
        from /home/jrs/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
        from /home/jrs/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
        from /home/jrs/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
        from /home/jrs/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:345:in `block in revive_hash'
        from /home/jrs/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each'
        from /home/jrs/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each_slice'
        from /home/jrs/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `revive_hash'
        from /home/jrs/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:167:in `visit_Psych_Nodes_Mapping'
        from /home/jrs/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
        from /home/jrs/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
        from /home/jrs/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
        from /home/jrs/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:318:in `visit_Psych_Nodes_Document'
        from /home/jrs/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
        from /home/jrs/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
        from /home/jrs/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
        from /home/jrs/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych.rb:335:in `safe_load'
        from /home/jrs/.rbenv/plugins/bundler/etc/rbenv.d/bundler/rehash.rb:265:in `block in build_ruby_profiles'
        from /home/jrs/.rbenv/plugins/bundler/etc/rbenv.d/bundler/rehash.rb:264:in `open'
        from /home/jrs/.rbenv/plugins/bundler/etc/rbenv.d/bundler/rehash.rb:264:in `open'
        from /home/jrs/.rbenv/plugins/bundler/etc/rbenv.d/bundler/rehash.rb:264:in `build_ruby_profiles'
        from /home/jrs/.rbenv/plugins/bundler/etc/rbenv.d/bundler/rehash.rb:460:in `<main>'

Perhaps related?

❯ rbenv version
3.1.2 (set by /home/jrs/testdir/.ruby-version)
❯ ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
❯ rbenv bundler on
rbenv: ruby: command not found

The `ruby' command exists in these Ruby versions:
  3.1.2
@cirdes
Copy link

cirdes commented Jul 12, 2022

same here! =/

@carsomyr
Copy link
Owner

carsomyr commented Aug 31, 2022

@sixtyfive @cirdes Thanks for the reports! I will be making time to address this issue, as well as make the internal architecture more future proof.

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