inukshuk / bibtex-ruby

A BibTeX library, parser, and converter for Ruby.
http://inukshuk.github.com/bibtex-ruby
GNU General Public License v3.0
155 stars 35 forks source link

error with ruby 3.3.1: names.rb:51:in `to_s': wrong number of arguments #168

Closed jheidemann closed 4 months ago

jheidemann commented 4 months ago

I'm running bibtex-ruby via jekyll-scholar via jekyll. After upgrading to ruby 3.3.1 (on Fedora 40), I get the following hard errors when rebuiling a website:

/usr/share/gems/gems/bibtex-ruby-6.0.0/lib/bibtex/names.rb:105:in `block (3 levels) in <class:Names>': undefined method `convert!' for an instance of String (NoMethodError)

        tokens.each { |t| t.send(method_id, *arguments) }
                           ^^^^^
    from /usr/share/gems/gems/bibtex-ruby-6.0.0/lib/bibtex/names.rb:105:in `each'
    from /usr/share/gems/gems/bibtex-ruby-6.0.0/lib/bibtex/names.rb:105:in `block (2 levels) in <class:Names>'
    from /usr/share/gems/gems/bibtex-ruby-6.0.0/lib/bibtex/value.rb:271:in `convert'
    from /usr/share/gems/gems/jekyll-scholar-7.1.3/lib/jekyll/scholar/utilities.rb:576:in `block in liquidify'
    from /usr/share/gems/gems/jekyll-scholar-7.1.3/lib/jekyll/scholar/utilities.rb:575:in `each'
    from /usr/share/gems/gems/jekyll-scholar-7.1.3/lib/jekyll/scholar/utilities.rb:575:in `liquidify'
    from /usr/share/gems/gems/jekyll-scholar-7.1.3/lib/jekyll/scholar/utilities.rb:541:in `reference_data'
    from /usr/share/gems/gems/jekyll-scholar-7.1.3/lib/jekyll/scholar/generators/details.rb:20:in `initialize'
    from /usr/share/gems/gems/jekyll-scholar-7.1.3/lib/jekyll/scholar/generators/details.rb:49:in `new'
    from /usr/share/gems/gems/jekyll-scholar-7.1.3/lib/jekyll/scholar/generators/details.rb:49:in `block in generate'
    from /usr/share/gems/gems/jekyll-scholar-7.1.3/lib/jekyll/scholar/generators/details.rb:48:in `each'
    from /usr/share/gems/gems/jekyll-scholar-7.1.3/lib/jekyll/scholar/generators/details.rb:48:in `generate'
    from /usr/share/gems/gems/jekyll-4.3.3/lib/jekyll/site.rb:193:in `block in generate'
    from /usr/share/gems/gems/jekyll-4.3.3/lib/jekyll/site.rb:191:in `each'
    from /usr/share/gems/gems/jekyll-4.3.3/lib/jekyll/site.rb:191:in `generate'
    from /usr/share/gems/gems/jekyll-4.3.3/lib/jekyll/site.rb:79:in `process'
    from /usr/share/gems/gems/jekyll-4.3.3/lib/jekyll/command.rb:28:in `process_site'
    from /usr/share/gems/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:65:in `build'
    from /usr/share/gems/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:36:in `process'
    from /usr/share/gems/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
    from /usr/share/gems/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `each'
    from /usr/share/gems/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
    from /usr/share/gems/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
    from /usr/share/gems/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
    from /usr/share/gems/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
    from /usr/share/gems/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
    from /usr/share/gems/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
    from /usr/share/gems/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
    from /usr/share/gems/gems/jekyll-4.3.3/exe/jekyll:15:in `<top (required)>'
    from /usr/bin/jekyll:25:in `load'
    from /usr/bin/jekyll:25:in `<main>'

I tried to fix that by changing n.to_s(options) to n.to_s (although I see that to_s is defined for the class on the very next line, so I'm not sure why it's failing.

However, I then get:

/usr/share/gems/gems/bibtex-ruby-6.0.0/lib/bibtex/names.rb:105:in `block (3 levels) in <class:Names>': undefined method `convert!' for an instance of String (NoMethodError)

        tokens.each { |t| t.send(method_id, *arguments) }
                           ^^^^^
    from /usr/share/gems/gems/bibtex-ruby-6.0.0/lib/bibtex/names.rb:105:in `each'
    from /usr/share/gems/gems/bibtex-ruby-6.0.0/lib/bibtex/names.rb:105:in `block (2 levels) in <class:Names>'
    from /usr/share/gems/gems/bibtex-ruby-6.0.0/lib/bibtex/value.rb:271:in `convert'

at which point I opened this ticket. It works fine on Fedora 39 with Ruby-3.2.4, so maybe there were incompatible changes in ruby?

(I also looked at the code for bibtex-ruby-6.1 and it didn't change these parts of names.rb.)

Suggestions? Do you need a test case, or is "try ruby-3.3" sufficient?

inukshuk commented 4 months ago

I believe version 6.1 fixes this (here's the relevant change)

jheidemann commented 4 months ago

Yes, thank you very much! Sorry to be not up-to-date.