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

Ubuntu 20.04, Ruby 2.7.0p0, mdless 2.1.28 gem - syntax error in string.rb #97

Open
ernstki opened this issue Dec 15, 2023 · 4 comments
Open

Comments

@ernstki
Copy link

ernstki commented Dec 15, 2023

Attempting to gem install --user mdless with the default ruby from the Ubuntu 20.04 repositories results in the following backtrace, due to syntax errors in string.rb.

$ mdless --help
Traceback (most recent call last):
	7: from /home/me/.gem/ruby/2.7.0/bin/mdless:23:in `<main>'
	6: from /home/me/.gem/ruby/2.7.0/bin/mdless:23:in `load'
	5: from /home/me/.gem/ruby/2.7.0/gems/mdless-2.1.28/bin/mdless:4:in `<top (required)>'
	4: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
	3: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
	2: from /home/me/.gem/ruby/2.7.0/gems/mdless-2.1.28/lib/mdless.rb:16:in `<top (required)>'
	1: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
/usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require': /home/me/.gem/ruby/2.7.0/gems/mdless-2.1.28/lib/mdless/string.rb:70: syntax error, unexpected =>, expecting '}' (SyntaxError)
...map { |k, v| "#{k.downcase}" => v }
...                             ^~
/home/me/.gem/ruby/2.7.0/gems/mdless-2.1.28/lib/mdless/string.rb:164: syntax error, unexpected `end', expecting end-of-input

$ ruby --version
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]

$ gem list | grep mdless
mdless (2.1.28)

I suspect this is because the world has left Ruby 2.7.x behind, so I'll try with a newer Ruby and report back.

I also noticed that the version of string.rb in master has some changes in that area, so I'll try the version from Git, too. But my guess is Ruby syntax changed, and that's actually the root cause.

@ernstki ernstki changed the title mdless 2.1.28 from RubyGems Ubuntu 20.04, Ruby 2.7.0p0, syntax error in string.rb Ubuntu 20.04, Ruby 2.7.0p0, and mdless 2.1.28 from RubyGems - syntax error in string.rb Dec 15, 2023
@ernstki ernstki changed the title Ubuntu 20.04, Ruby 2.7.0p0, and mdless 2.1.28 from RubyGems - syntax error in string.rb Ubuntu 20.04, Ruby 2.7.0p0, mdless 2.1.28 gem - syntax error in string.rb Dec 15, 2023
@ttscoff
Copy link
Owner

ttscoff commented Dec 15, 2023

This should be fixed in 2.1.33. Please test and confirm.

@ernstki
Copy link
Author

ernstki commented Dec 15, 2023

This should be fixed in 2.1.33. Please test and confirm.

I'll give it a go. I think there's an intermediate dependency (maybe redcarpet) that can't be resolved, which is why a fresh gem install --user mdless gave me 2.1.28, and I'd still like to document a workaround for that, if there is one.

For the benefit of my still-stuck-on-Ubuntu-20.04 compatriots. :)

@finite8
Copy link

finite8 commented Dec 20, 2023

Unfortunately this error seems to persist even with the latest version.

$ mdless --help
Traceback (most recent call last):
        7: from /usr/local/bin/mdless:23:in `<main>'
        6: from /usr/local/bin/mdless:23:in `load'
        5: from /root/.local/share/gem/ruby/2.7.0/gems/mdless-2.1.33/bin/mdless:4:in `<top (required)>'
        4: from /usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb:85:in `require'
        3: from /usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb:85:in `require'
        2: from /root/.local/share/gem/ruby/2.7.0/gems/mdless-2.1.33/lib/mdless.rb:21:in `<top (required)>'
        1: from /usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb:85:in `require'
/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb:85:in `require': /root/.local/share/gem/ruby/2.7.0/gems/mdless-2.1.33/lib/mdless/console.rb:756: syntax error, unexpected =>, expecting '}' (SyntaxError)
...map { |k, v| "#{k.downcase}" => v }
...                             ^~
/root/.local/share/gem/ruby/2.7.0/gems/mdless-2.1.33/lib/mdless/console.rb:757: syntax error, unexpected =>
...escue Psych::DisallowedClass => e
...                             ^~

$ ruby --version
ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux-gnu]

$ gem list | grep mdless
mdless (2.1.33)

@ttscoff
Copy link
Owner

ttscoff commented Dec 20, 2023 via email

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