ttscoff / mdless

MIT License
871 stars 39 forks source link

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

Open ernstki opened 11 months ago

ernstki commented 11 months ago

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.

ttscoff commented 11 months ago

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

ernstki commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

Weirdly my fix didn't stick, the code reverted to the previous, problematic statement. Just pushed a new version, hopefully this one works (2.1.35)

-Brett

On 19 Dec 2023, at 23:05, finite8 wrote:

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)

-- Reply to this email directly or view it on GitHub: https://github.com/ttscoff/mdless/issues/97#issuecomment-1863858857 You are receiving this because you commented.

Message ID: @.***>