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

Suppress warning when loading rdoc #999

Closed
wants to merge 1 commit into from

Conversation

Earlopain
Copy link

This actually starts to warn on Ruby 3.3.5 now because that was backported. Just rescuing the LoadError is not enough, since the warning is emitted anyways.

This is not ideal, see https://bugs.ruby-lang.org/issues/20714#note-2, but I'm not aware of a different solution.
reline does the same thing for fiddle: https://github.com/ruby/reline/blob/c90f08f7e308d2f1cdd7cfaf9939fe45ce546fd2/lib/reline/terminfo.rb#L1-L15

Without this, a simple bundle exec irb on Ruby 3.3.5 shows this:

rdoc was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0.
You can add rdoc to your Gemfile or gemspec to silence this warning.

This actually starts to warn on Ruby 3.3.5 now because that was backported.
Just rescuing the LoadError is not enough, since the warning is emitted anyways.

This is not ideal, see https://bugs.ruby-lang.org/issues/20714#note-2, but I'm
not aware of a different solution
@hsbt
Copy link
Member

hsbt commented Sep 5, 2024

I consider to suppress that warning if target gem like irb already has dependency like rdoc explicitly.

@Earlopain
Copy link
Author

Oh, I didn't realize it already depends on rdoc. I agree, this PR doesn't make much sense then. I will close.

@Earlopain Earlopain closed this Sep 5, 2024
@hsbt
Copy link
Member

hsbt commented Sep 5, 2024

BTW: I couldn't reproduce this.

$ cat Gemfile
# frozen_string_literal: true

source "https://rubygems.org"

gem "irb"
$ cat Gemfile.lock
GEM
  remote: https://rubygems.org/
  specs:
    io-console (0.7.2)
    irb (1.14.0)
      rdoc (>= 4.0.0)
      reline (>= 0.4.2)
    psych (5.1.2)
      stringio
    rdoc (6.7.0)
      psych (>= 4.0.0)
    reline (0.5.9)
      io-console (~> 0.5)
    stringio (3.1.1)

PLATFORMS
  arm64-darwin-24
  ruby

DEPENDENCIES
  irb

BUNDLED WITH
   2.5.18
$ bundle exec irb
>>

This is the intentional behavior. Because irb already has rdoc dependency. If irb is invoked under the bundler, irb will load rdoc from GEM_PATH, not ruby installation path. So, bundled_gems.rb will not warn that case.

@Earlopain
Copy link
Author

You need a gemfile that doesn't depend on on irb/rdoc in some way:

$ cat Gemfile
# frozen_string_literal: true

source "https://rubygems.org"

gem "asciidoctor"
$ cat Gemfile.lock
GEM
  remote: https://rubygems.org/
  specs:
    asciidoctor (2.0.23)

PLATFORMS
  ruby
  x86_64-linux

DEPENDENCIES
  asciidoctor

BUNDLED WITH
   2.5.16

$ bundle exec irb
/home/user/.rbenv/versions/3.3.5/lib/ruby/3.3.0/reline.rb:9: warning: fiddle was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0.
You can add fiddle to your Gemfile or gemspec to silence this warning.
rdoc was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0.
You can add rdoc to your Gemfile or gemspec to silence this warning.

@hsbt
Copy link
Member

hsbt commented Sep 5, 2024

You should add irb into Gemfile if you want to use irb under the bundler.

@Earlopain
Copy link
Author

I guess you want to migrate irb to bundled gems too so in that regard that makes sense.

Regardless of my opinion of doing that, irb itself does not warn. Should I really be made to do this right now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants