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

On Ruby 3.3.5: warning: fiddle was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0 #851

Open
davidrunger opened this issue Sep 6, 2024 · 3 comments · May be fixed by #852

Comments

@davidrunger
Copy link

Problem description

A warning is printed to stderr when using byebug on Ruby 3.3.5:

/home/david/.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.

Expected behavior

No warning is printed.

Actual behavior

The aforementioned warning is printed.

Steps to reproduce the problem

Reproduction script

# File: run-byebug-from-inline-gemfile.rb
# Run with: `ruby run-byebug-from-inline-gemfile.rb`

require 'bundler/inline'

gemfile do
  ruby '3.3.5'
  source 'https://rubygems.org'
  gem 'byebug', github: 'deivid-rodriguez/byebug', ref: '7e7384836defcfb40b675f5405428515b48eea9e'
end

puts("Ruby version: #{RUBY_VERSION}")

require 'byebug/version'
puts("Byebug version: #{Byebug::VERSION}")

require 'fiddle/version'
puts("Fiddle version: #{Fiddle::VERSION}")

byebug

Output

$ ruby run-byebug-from-inline-gemfile.rb
Ruby version: 3.3.5
Byebug version: 11.1.3
Fiddle version: 1.1.2
/home/david/.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.

This issue is about the fact that those last two lines of warning output are printed. We don't want any warnings to be printed.

@davidrunger
Copy link
Author

davidrunger commented Sep 6, 2024

I believe that this issue is at least somewhat related to this Ruby bug: https://bugs.ruby-lang.org/issues/20714 . (I say that because the title of that Ruby bug is "Handle optional dependencies in bundled_gems.rb", and I think that fiddle is indeed (in at least some versions of Ruby) indirectly an "optional dependency" of byebug. byebug requires readline, which might try to require reline, which requires reline/terminfo, which "optionally" tries to require fiddle.)

That Ruby bug, in turn, has generated these two PRs:

  1. [Bug #20714] Handle optional dependencies for bundled_gems.rb ruby/ruby#11545
  2. Only warn about bundled gems when require succeeds ruby/ruby#11550

However:

  1. I guess that, even if those PRs fix the issue in future versions of Ruby, this issue still exists (and presumably always will) in at least Ruby version 3.3.5.
  2. I am not sure that either of those PRs actually will fix the fundamental issue, even in future versions of Ruby. If byebug does need fiddle (though I have zero idea whether or not byebug actually does need fiddle), then I guess that what would happen if Only warn about bundled gems when require succeeds ruby/ruby#11550 were to be merged, for example, is that we would no longer warn about the attempt to optionally require fiddle, but the attempt to require fiddle will start failing in future versions of Ruby that don't include fiddle in the standard library, and so byebug will not have the functionality that it needs from fiddle (which, again, I don't know whether or not there actually is any functionality from fiddle that byebug does need).

davidrunger added a commit to davidrunger/byebug that referenced this issue Sep 6, 2024
Fixes deivid-rodriguez#851

The following warning is printed to stderr when using byebug on Ruby
3.3.5:

> /home/david/.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.

This change aims to cause that warning no longer to appear, by
implementing one of the suggestions in the warning message, i.e. by
adding the `fiddle` gem to byebug's gemspec as a runtime dependency.
@davidrunger davidrunger linked a pull request Sep 6, 2024 that will close this issue
@davidrunger
Copy link
Author

davidrunger commented Sep 6, 2024

I have just submitted a PR that I think will fix this issue: #852 (though I don't really know whether or not it's a good idea to merge that PR).

@davidrunger
Copy link
Author

davidrunger commented Sep 6, 2024

Note: Looking at the path of requires that ultimately lead to requiring fiddle, I think that this bug will only occur if require "readline.#{RbConfig::CONFIG["DLEXT"]}" raises an exception? See here, where we only try to require reline (which then requires fiddle) if that require "readline.#{RbConfig::CONFIG["DLEXT"]}" attempt fails. On my machine, that require attempt does raise an exception, and so I do see these warnings on Ruby 3.3.5. But, for someone on whose machine require "readline.#{RbConfig::CONFIG["DLEXT"]}" succeeds, I guess that they won't see the warning that is the subject of this bug report.

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

Successfully merging a pull request may close this issue.

1 participant