Skip to content

Problem due to commit 75d15117643d17a3c3d92b41512bd7840c91705b included with 6.12.0 #1394

@heirecka

Description

@heirecka

First of all, I should add that this is not really a bug, more of an uncomfortable compatibility problem, but README encourages me to report anything I have a problem with (nice, thanks!), so here's the problem:

I have a project which inherits from RDoc::Parser::C to generate documention for its ruby bindings.

module RDoc

    class C_Parser_Paludis < Parser::C
        #override C_Parse
        parse_files_matching(/\.(c|cc|cpp|CC)$/)

        def initialize(top_level, file_name, body, options, stats)
            ...
            super(top_level, file_name, new_body, options, stats)
        end
    ...
    end
end
begin
    r = RDoc::RDoc.new
    r.document(ARGV)
rescue RDoc::Error => e
    $stderr.puts e.message
    exit(1)
end

(Full code here: https://gitlab.exherbo.org/paludis/paludis/-/blob/master/doc/api/ruby/create_ruby_doc.rb)

After updating ruby 3.4.4 to 3.4.5, which updated rdoc from 6.10.0 to 6.14.0 I get:

RDoc is not a full Ruby parser and will fail when fed invalid ruby programs.

The internal error was:

        (ArgumentError) wrong number of arguments (given 4, expected 5)

/home/heiko/Quelltexte/git-sources/exherbo/paludis/doc/api/ruby/create_ruby_doc.rb:13:in 'initialize': wrong number of arguments (given 4, expected 5) (ArgumentError)
        from /usr/x86_64-pc-linux-gnu/lib/ruby/3.4/rdoc/parser.rb:194:in 'Class#new'
        from /usr/x86_64-pc-linux-gnu/lib/ruby/3.4/rdoc/parser.rb:194:in 'RDoc::Parser.for'
        from /usr/x86_64-pc-linux-gnu/lib/ruby/3.4/rdoc/rdoc.rb:350:in 'RDoc::RDoc#parse_file'
        from /usr/x86_64-pc-linux-gnu/lib/ruby/3.4/rdoc/rdoc.rb:406:in 'block in RDoc::RDoc#parse_files'
        from /usr/x86_64-pc-linux-gnu/lib/ruby/3.4/rdoc/rdoc.rb:404:in 'Array#map'
        from /usr/x86_64-pc-linux-gnu/lib/ruby/3.4/rdoc/rdoc.rb:404:in 'RDoc::RDoc#parse_files'
        from /usr/x86_64-pc-linux-gnu/lib/ruby/3.4/rdoc/rdoc.rb:467:in 'RDoc::RDoc#document'
        from /home/heiko/Quelltexte/git-sources/exherbo/paludis/doc/api/ruby/create_ruby_doc.rb:87:in '<main>'

This is "caused" by 75d1511, which changed initialize's signature. I could conditionalize the call to super(..), but I don't know how to do that for C_Parser_Paludis's initialize itself.

Any pointers how this could be best solved without requiring rdoc >= 6.12.0 would be very welcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions