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

syntax_suggest CLI doesn't work when it is a standard gem #215

Open
jeremyevans opened this issue Jan 18, 2024 · 1 comment
Open

syntax_suggest CLI doesn't work when it is a standard gem #215

jeremyevans opened this issue Jan 18, 2024 · 1 comment

Comments

@jeremyevans
Copy link

The syntax_suggest CLI that ships in Ruby 3.3.0 and Ruby 3.2.3 fails:

$ /usr/local/bin/syntax_suggest33 -h
/usr/local/lib/ruby/gems/3.3/gems/syntax_suggest-2.0.0/exe/syntax_suggest:3:in `require_relative': cannot load such file -- /usr/local/lib/ruby/gems/3.3/gems/syntax_suggest-2.0.0/lib/syntax_suggest/api (LoadError)
        from /usr/local/lib/ruby/gems/3.3/gems/syntax_suggest-2.0.0/exe/syntax_suggest:3:in `<top (required)>'
        from /usr/local/bin/syntax_suggest33:25:in `load'
        from /usr/local/bin/syntax_suggest33:25:in `<main>'

$ /usr/local/bin/syntax_suggest32 -h
/usr/local/lib/ruby/gems/3.2/gems/syntax_suggest-1.1.0/exe/syntax_suggest:3:in `require_relative': cannot load such file -- /usr/local/lib/ruby/gems/3.2/gems/syntax_suggest-1.1.0/lib/syntax_suggest/api (LoadError)
        from /usr/local/lib/ruby/gems/3.2/gems/syntax_suggest-1.1.0/exe/syntax_suggest:3:in `<top (required)>'
        from /usr/local/bin/syntax_suggest32:25:in `load'
        from /usr/local/bin/syntax_suggest32:25:in `<main>'

To handle this case, I think syntax_suggest should rescue a LoadError failure in the require_relative call, and try to use a regular require. You can use require File.join(RbConfig::CONFIG['rubylibdir'], 'syntax_suggest', 'api') if you want to use an absolute path.

@eregon
Copy link
Member

eregon commented Jun 21, 2024

@andrykonchin and I noticed the same issue when updating to Ruby 3.2.4.
There is a new executable syntax_suggest but it doesn't work:

$ chruby 3.2.2                                                                                        
Using ruby-3.2.2: ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
$ syntax_suggest
zsh: syntax_suggest: command not found...

$ ruby -v
ruby 3.2.4 (2024-04-23 revision af471c0e01) [x86_64-linux]
$ syntax_suggest      
/home/eregon/.rubies/ruby-3.2.4/lib/ruby/gems/3.2.0/gems/syntax_suggest-1.1.0/exe/syntax_suggest:3:in `require_relative': cannot load such file -- /home/eregon/.rubies/ruby-3.2.4/lib/ruby/gems/3.2.0/gems/syntax_suggest-1.1.0/lib/syntax_suggest/api (LoadError)
	from /home/eregon/.rubies/ruby-3.2.4/lib/ruby/gems/3.2.0/gems/syntax_suggest-1.1.0/exe/syntax_suggest:3:in `<top (required)>'
	from /home/eregon/.rubies/ruby-3.2.4/bin/syntax_suggest:25:in `load'
	from /home/eregon/.rubies/ruby-3.2.4/bin/syntax_suggest:25:in `<main>'

It would be good to fix this or to remove this executable if unnecessary.

graalvmbot pushed a commit to oracle/truffleruby that referenced this issue Jun 24, 2024
It's removed because it doesn't work. See ruby/syntax_suggest#215
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants