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

Compatibility in ruby >=3.2 ? #233

Open
Jaco-Pretorius opened this issue Dec 17, 2023 · 9 comments · May be fixed by #258
Open

Compatibility in ruby >=3.2 ? #233

Jaco-Pretorius opened this issue Dec 17, 2023 · 9 comments · May be fixed by #258

Comments

@Jaco-Pretorius
Copy link

I am having issues with running derailed against a Rails app with Ruby 3.2.2. The issue is rather obscure, but I'll put the stacktrace here

/Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/dead_end-1.1.6/lib/dead_end/auto.rb:30:in `require': cannot load such file -- /Users/my-user-name/src/ext/save-history.rb (LoadError)
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/dead_end-1.1.6/lib/dead_end/auto.rb:30:in `require_relative'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/3.2.0/irb/extend-command.rb:368:in `save_history='
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/3.2.0/irb/context.rb:137:in `initialize'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/3.2.0/irb.rb:473:in `new'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/3.2.0/irb.rb:473:in `initialize'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/3.2.0/irb.rb:419:in `new'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/3.2.0/irb.rb:419:in `start'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.4/lib/rails/commands/console/console_command.rb:70:in `start'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.4/lib/rails/commands/console/console_command.rb:19:in `start'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.4/lib/rails/commands/console/console_command.rb:102:in `perform'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.4/lib/rails/command/base.rb:87:in `perform'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.4/lib/rails/command.rb:48:in `invoke'
    from /Users/my-user-name/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

I suspect this is because the dead_end gem - which is the syntax_suggest repo - has been integrated with Ruby 3.2. At the very least it's not clear to me what is expected to happen if you include that gem while running Ruby 3.2 or later. There is an issue against the syntax_suggest repo which seems to indicate that you no longer need to include the gem but it doesn't say what will happen when you do. The stacktrace above does point to some of the require_relative overrides going on in that gem.

@schneems
Copy link
Member

This would only ever fire if you’ve got a syntax error or are trying to load a file that doesn’t exist.

if someone wants to remove dead-end or upgrade it to syntax_suggest I would accept the change.

@s01ipsist
Copy link

(possibly) addresssed by #228 which replaces dead_end with syntax_suggest which is the renamed library
https://github.com/ruby/syntax_suggest/blob/main/CHANGELOG.md#100-library-renamed-to-syntax_suggest-

@pcai
Copy link
Contributor

pcai commented Sep 29, 2024

Hi @Jaco-Pretorius as @schneems mentioned, this doesnt appear to be a dead_end/syntax_suggest issue and the main branch now has coverage for ruby 3.2 specifically. Since #230 already tracks the dead_end migration work I'll close this for now. Please reopen with repro steps against the latest derailed if you still believe there's a bug here. Thanks!

@pcai pcai closed this as not planned Won't fix, can't repro, duplicate, stale Sep 29, 2024
@fkoessler
Copy link

For the record, I am experiencing a similar issue with Ruby 3.1.3 and derailed_benchmark 2.2.1

/home/username/.rvm/gems/ruby-3.1.3@project/gems/derailed_benchmarks-2.2.1/lib/derailed_benchmarks.rb:7:in `require': cannot load such file -- syntax_suggest (LoadError)
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/derailed_benchmarks-2.2.1/lib/derailed_benchmarks.rb:7:in `<top (required)>'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/bundler-2.4.7/lib/bundler/runtime.rb:60:in `require'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/bundler-2.4.7/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/bundler-2.4.7/lib/bundler/runtime.rb:55:in `each'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/bundler-2.4.7/lib/bundler/runtime.rb:55:in `block in require'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/bundler-2.4.7/lib/bundler/runtime.rb:44:in `each'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/bundler-2.4.7/lib/bundler/runtime.rb:44:in `require'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/bundler-2.4.7/lib/bundler.rb:195:in `require'
	from /home/username/Code/project/project/config/application.rb:8:in `<top (required)>'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/railties-7.0.8.6/lib/rails/commands/server/server_command.rb:137:in `require'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/railties-7.0.8.6/lib/rails/commands/server/server_command.rb:137:in `block in perform'
	from <internal:kernel>:90:in `tap'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/railties-7.0.8.6/lib/rails/commands/server/server_command.rb:134:in `perform'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/thor-1.3.2/lib/thor/command.rb:28:in `run'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/thor-1.3.2/lib/thor/invocation.rb:127:in `invoke_command'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/thor-1.3.2/lib/thor.rb:538:in `dispatch'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/railties-7.0.8.6/lib/rails/command/base.rb:87:in `perform'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/railties-7.0.8.6/lib/rails/command.rb:48:in `invoke'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/railties-7.0.8.6/lib/rails/commands.rb:18:in `<top (required)>'
	from bin/rails:4:in `require'
	from bin/rails:4:in `<main>'

@pcai
Copy link
Contributor

pcai commented Oct 31, 2024

Can you provide a minimal repro please? Your output suggests that syntax_suggest is missing from bundle path but its not clear what command you’re running or how things are set up

@unRARed
Copy link

unRARed commented Nov 12, 2024

For the record, I am experiencing a similar issue with Ruby 3.1.3 and derailed_benchmark 2.2.1

/home/username/.rvm/gems/ruby-3.1.3@project/gems/derailed_benchmarks-2.2.1/lib/derailed_benchmarks.rb:7:in `require': cannot load such file -- syntax_suggest (LoadError)
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/derailed_benchmarks-2.2.1/lib/derailed_benchmarks.rb:7:in `<top (required)>'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/bundler-2.4.7/lib/bundler/runtime.rb:60:in `require'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/bundler-2.4.7/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/bundler-2.4.7/lib/bundler/runtime.rb:55:in `each'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/bundler-2.4.7/lib/bundler/runtime.rb:55:in `block in require'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/bundler-2.4.7/lib/bundler/runtime.rb:44:in `each'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/bundler-2.4.7/lib/bundler/runtime.rb:44:in `require'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/bundler-2.4.7/lib/bundler.rb:195:in `require'
	from /home/username/Code/project/project/config/application.rb:8:in `<top (required)>'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/railties-7.0.8.6/lib/rails/commands/server/server_command.rb:137:in `require'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/railties-7.0.8.6/lib/rails/commands/server/server_command.rb:137:in `block in perform'
	from <internal:kernel>:90:in `tap'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/railties-7.0.8.6/lib/rails/commands/server/server_command.rb:134:in `perform'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/thor-1.3.2/lib/thor/command.rb:28:in `run'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/thor-1.3.2/lib/thor/invocation.rb:127:in `invoke_command'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/thor-1.3.2/lib/thor.rb:538:in `dispatch'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/railties-7.0.8.6/lib/rails/command/base.rb:87:in `perform'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/railties-7.0.8.6/lib/rails/command.rb:48:in `invoke'
	from /home/username/.rvm/gems/ruby-3.1.3@project/gems/railties-7.0.8.6/lib/rails/commands.rb:18:in `<top (required)>'
	from bin/rails:4:in `require'
	from bin/rails:4:in `<main>'

I just ran into the same error in 3.1.2. I'm guessing the syntax_suggest gem is missing from the derailed gemspec? Simply adding the gem to my Gemfile fixed it:

group :development do
 ...
  gem "syntax_suggest" # <-- added this
  gem "derailed_benchmarks"
  gem "stackprof"
  ...
end

@schneems schneems reopened this Nov 15, 2024
@schneems
Copy link
Member

I think an issue is the conditional in the gemspec. If you look at the dependencies on rubygems it doesn't list out syntax_suggest https://rubygems.org/gems/derailed_benchmarks/versions/2.2.1. It works with Ruby 3.2+ on CI because that gem exists

@pcai
Copy link
Contributor

pcai commented Nov 16, 2024

The intent of the conditional was to avoid declaring syntax_suggest for ruby versions where it is already a default gem, but if there's no harm in declaring it unconditionally -- I'll just make that change? wdyt @schneems

@schneems
Copy link
Member

schneems commented Nov 19, 2024 via email

@pcai pcai linked a pull request Nov 19, 2024 that will close this issue
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.

6 participants